File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 1313 */
1414
1515import python
16- private import LegacyPointsTo
16+ private import semmle.python.dataflow.new.internal.ImportResolution
1717private import semmle.python.types.ImportTime
1818
19- predicate import_star ( ImportStar imp , ModuleValue exporter ) {
20- exporter .importedAs ( imp .getImportedModuleName ( ) )
21- }
22-
23- predicate all_defined ( ModuleValue exporter ) {
24- exporter .isBuiltin ( )
25- or
26- exporter .getScope ( ) .( ImportTimeScope ) .definesName ( "__all__" )
19+ predicate all_defined ( Module exporter ) {
20+ exporter .( ImportTimeScope ) .definesName ( "__all__" )
2721 or
28- exporter .getScope ( ) . getInitModule ( ) .( ImportTimeScope ) .definesName ( "__all__" )
22+ exporter .getInitModule ( ) .( ImportTimeScope ) .definesName ( "__all__" )
2923}
3024
31- from ImportStar imp , ModuleValue exporter
32- where import_star ( imp , exporter ) and not all_defined ( exporter ) and not exporter .isAbsent ( )
25+ from ImportStar imp , Module exporter
26+ where
27+ exporter = ImportResolution:: getModuleImportedByImportStar ( imp ) and
28+ not all_defined ( exporter )
3329select imp ,
3430 "Import pollutes the enclosing namespace, as the imported module $@ does not define '__all__'." ,
3531 exporter , exporter .getName ( )
You can’t perform that action at this time.
0 commit comments