MCPcopy
hub / github.com/huggingface/transformers / import_from_path

Function import_from_path

benchmark/benchmarks_entrypoint.py:367–375  ·  view source on GitHub ↗
(module_name, file_path)

Source from the content-addressed store, hash-verified

365
366
367def import_from_path(module_name, file_path):
368 try:
369 spec = importlib.util.spec_from_file_location(module_name, file_path)
370 module = importlib.util.module_from_spec(spec)
371 sys.modules[module_name] = module
372 spec.loader.exec_module(module)
373 return module
374 except Exception as e:
375 raise ImportModuleException(f"failed to load python module: {e}")
376
377
378def create_database_connection():

Callers 1

Calls 2

exec_moduleMethod · 0.80

Tested by

no test coverage detected