improved star import support preparation
This commit is contained in:
1 parent
d0b2a2ce4f
commit
358472b21f
2 files changed
+24
-3
No files matched your search
@@ -239,6 +239,23 @@ class NestedImportModule(pr.Module):
|
||||
self._module)
|
||||
|
||||
|
||||
class StarImportModule(pr.Module):
|
||||
"""
|
||||
Used if a module contains star imports.
|
||||
"""
|
||||
def __init__(self, module, star_import_modules):
|
||||
self._module = module
|
||||
self._star_import_modules = star_import_modules
|
||||
|
||||
def scope_generator(self):
|
||||
yield self.module
|
||||
for s in self._star_import_modules:
|
||||
yield s
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._module, name)
|
||||
|
||||
|
||||
def get_importer(evaluator, import_path, module, level=0):
|
||||
"""
|
||||
Checks the evaluator caches first, which resembles the ``sys.modules``
|
||||
|
||||
Reference in new issue
Block a user