Commit 37d617cd authored by Jason R. Coombs's avatar Jason R. Coombs

Extract _resolve

parent 773f1ec3
......@@ -60,13 +60,17 @@ def find_module(module, paths=None):
def get_frozen_object(module, paths):
spec = importlib.util.find_spec(module, paths)
if hasattr(spec, 'submodule_search_locations'):
spec = importlib.util.spec_from_loader('__init__.py', spec.loader)
return spec.loader.get_code(module)
return spec.loader.get_code(_resolve(module))
def _resolve(spec):
return (
importlib.util.spec_from_loader('__init__.py', spec.loader)
if hasattr(spec, 'submodule_search_locations')
else spec
)
def get_module(module, paths, info):
spec = importlib.util.find_spec(module, paths)
if hasattr(spec, 'submodule_search_locations'):
spec = importlib.util.spec_from_loader('__init__.py', spec.loader)
return importlib.util.module_from_spec(spec)
return importlib.util.module_from_spec(_resolve(spec))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment