core/structure: help locate/extract gdpr exports (#175)

* core/structure: help locate/extract gdpr exports

* ci: add install-types to install stub packages
This commit is contained in:
Sean Breckenridge 2021-07-07 16:44:55 -07:00 committed by GitHub
parent 8ca88bde2e
commit 821bc08a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 192 additions and 2 deletions

View file

@ -18,6 +18,7 @@ def import_file(p: PathIsh, name: Optional[str]=None) -> types.ModuleType:
name = p.stem
import importlib.util
spec = importlib.util.spec_from_file_location(name, p)
assert spec is not None, f"Fatal error; Could not create module spec from {name} {p}"
foo = importlib.util.module_from_spec(spec)
loader = spec.loader; assert loader is not None
loader.exec_module(foo) # type: ignore[attr-defined]