MCPcopy
hub / github.com/XPixelGroup/DiffBIR / get_obj_from_str

Function get_obj_from_str

diffbir/utils/common.py:15–20  ·  view source on GitHub ↗
(string: str, reload: bool = False)

Source from the content-addressed store, hash-verified

13
14
15def get_obj_from_str(string: str, reload: bool = False) -> Any:
16 module, cls = string.rsplit(".", 1)
17 if reload:
18 module_imp = importlib.import_module(module)
19 importlib.reload(module_imp)
20 return getattr(importlib.import_module(module, package=None), cls)
21
22
23def instantiate_from_config(config: Mapping[str, Any]) -> Any:

Callers 1

instantiate_from_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected