mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Python: Allow absolute imports in directories with scripts
Fixes the import logic to account for absolute imports. We do this by classifying which files and folders may serve as the entry point for execution, based on a few simple heuristics. If the file `module.py` is in the same folder as a file `main.py` that may be executed directly, then we allow `module` to be a valid name for `module.py` so that `import module` will work as expected.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
| main | code/main.py:0:0:0:0 | Script main |
|
||||
| module | code/module.py:0:0:0:0 | Module module |
|
||||
| package | code/package:0:0:0:0 | Package package |
|
||||
| package.__init__ | code/package/__init__.py:0:0:0:0 | Module package.__init__ |
|
||||
| package.package_main | code/package/package_main.py:0:0:0:0 | Module package.package_main |
|
||||
|
||||
Reference in New Issue
Block a user