INNER CODE UNIT · Python

__getattr__

test-zeus-ai/testzeus-hercules · testzeus_hercules/core/__init__.py:41

def __getattr__(name: str) -> Any:
    if name in _SUBMODULE_EXPORTS:
        module = import_module(_SUBMODULE_EXPORTS[name])
        globals()[name] = module
        return module

    if name in _ATTRIBUTE_EXPORTS:
        module_name, attribute_name = _ATTRIBUTE_EXPORTS[name]
        value = getattr(import_module(module_name), attribute_name)
        globals()[name] = value
        return value

    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…