Import a python module from a path
(full_name: str, path: str)
| 62 | |
| 63 | |
| 64 | def import_file(full_name: str, path: str) -> Any: |
| 65 | """Import a python module from a path""" |
| 66 | |
| 67 | spec = importlib.util.spec_from_file_location(full_name, path) |
| 68 | assert spec is not None |
| 69 | mod = importlib.util.module_from_spec(spec) |
| 70 | |
| 71 | # We assume this is not None and has an exec_module() method. |
| 72 | # See https://docs.python.org/3/reference/import.html?highlight=exec_module#loading |
| 73 | loader = cast(Any, spec.loader) |
| 74 | loader.exec_module(mod) |
| 75 | return mod |
| 76 | |
| 77 | |
| 78 | def generate_c_parser_source(grammar: Grammar) -> str: |
nothing calls this directly
no test coverage detected
searching dependent graphs…