Added support for packages that define __all__ in terms of a tuple rather than a list.

This commit is contained in:
Eric Traut 2020-09-27 22:21:13 -07:00
parent b51b131351
commit c085b91dcc

View File

@ -67,6 +67,18 @@ export function getNamesInDunderAll(symbolTable: SymbolTable): string[] | undefi
}
});
return namesToImport;
} else if (expr.nodeType === ParseNodeType.Tuple) {
expr.expressions.forEach((tupleEntryNode) => {
if (
tupleEntryNode.nodeType === ParseNodeType.StringList &&
tupleEntryNode.strings.length === 1 &&
tupleEntryNode.strings[0].nodeType === ParseNodeType.String
) {
namesToImport.push(tupleEntryNode.strings[0].value);
}
});
return namesToImport;
}
}