Helper to import Python file provided in training commands / commands using the config. This makes custom registered functions available.
(code_path: Optional[Union[Path, str]])
| 184 | |
| 185 | |
| 186 | def import_code(code_path: Optional[Union[Path, str]]) -> None: |
| 187 | """Helper to import Python file provided in training commands / commands |
| 188 | using the config. This makes custom registered functions available. |
| 189 | """ |
| 190 | if code_path is not None: |
| 191 | if not Path(code_path).exists(): |
| 192 | msg.fail("Path to Python code not found", code_path, exits=1) |
| 193 | try: |
| 194 | import_file("python_code", code_path) |
| 195 | except Exception as e: |
| 196 | msg.fail(f"Couldn't load Python code: {code_path}", e, exits=1) |
| 197 | |
| 198 | |
| 199 | def get_git_version( |
no test coverage detected
searching dependent graphs…