MCPcopy
hub / github.com/explosion/spaCy / import_code

Function import_code

spacy/cli/_util.py:186–196  ·  view source on GitHub ↗

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]])

Source from the content-addressed store, hash-verified

184
185
186def 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
199def get_git_version(

Callers 12

train_cliFunction · 0.85
pretrain_cliFunction · 0.85
apply_cliFunction · 0.85
assemble_cliFunction · 0.85
init_fill_config_cliFunction · 0.85
init_pipeline_cliFunction · 0.85
init_labels_cliFunction · 0.85
debug_config_cliFunction · 0.85
debug_data_cliFunction · 0.85
find_threshold_cliFunction · 0.85
evaluate_cliFunction · 0.85
benchmark_speed_cliFunction · 0.85

Calls 1

import_fileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…