Import module from a certrain file Args: py_file: path to a python file to be imported Return:
(py_file: str)
| 34 | |
| 35 | |
| 36 | def import_modules_from_file(py_file: str): |
| 37 | """ Import module from a certrain file |
| 38 | |
| 39 | Args: |
| 40 | py_file: path to a python file to be imported |
| 41 | |
| 42 | Return: |
| 43 | |
| 44 | """ |
| 45 | dirname, basefile = os.path.split(py_file) |
| 46 | if dirname == '': |
| 47 | dirname = Path.cwd() |
| 48 | module_name = osp.splitext(basefile)[0] |
| 49 | sys.path.insert(0, dirname) |
| 50 | validate_py_syntax(py_file) |
| 51 | mod = import_module(module_name) |
| 52 | sys.path.pop(0) |
| 53 | return module_name, mod |
| 54 | |
| 55 | |
| 56 | def is_method_overridden(method, base_class, derived_class): |
no test coverage detected
searching dependent graphs…