blob: b12363606c41692e19b60f33098605e147adc7f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import importlib
import inspect
def load_model_class(identifier: str, prefix: str = "models."):
module_path, class_name = identifier.split('@')
# Import the module
module = importlib.import_module(prefix + module_path)
cls = getattr(module, class_name)
return cls
def get_model_source_path(identifier: str, prefix: str = "models."):
module_path, class_name = identifier.split('@')
module = importlib.import_module(prefix + module_path)
return inspect.getsourcefile(module)
|