14 lines
318 B
Python
14 lines
318 B
Python
import importlib
|
|
from typing import Any
|
|
|
|
__all__ = ("reflect",)
|
|
|
|
|
|
def reflect(value: str) -> Any:
|
|
if ":" in value:
|
|
module_name, item_name = value.split(":")
|
|
else:
|
|
module_name, item_name = "builtins", value
|
|
module = importlib.import_module(module_name)
|
|
return getattr(module, item_name)
|