You've already forked hotpocket
This commit is contained in:
15
services/packages/common/hotpocket_common/loader.py
Normal file
15
services/packages/common/hotpocket_common/loader.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import typing
|
||||
|
||||
|
||||
def load_module_attribute(import_path: str) -> typing.Any:
|
||||
module_path, attribute = import_path.split(':')
|
||||
|
||||
module = importlib.import_module(module_path)
|
||||
if attribute is not None:
|
||||
return getattr(module, attribute)
|
||||
|
||||
return module
|
||||
Reference in New Issue
Block a user