Download code/macrolens/methods.py from DeepAuto-AI/MacroLens: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/datasets/DeepAuto-AI/MacroLens/resolve/main/code/macrolens/methods.py
- Command line
-
hf download hf://datasets/DeepAuto-AI/MacroLens/code/macrolens/methods.py
-
curl -L -o methods.py https://huggingface.co/datasets/DeepAuto-AI/MacroLens/resolve/main/code/macrolens/methods.py
1.42 kB
| """Public method namespace for the MacroLens unified API. | |
| ``import macrolens as ml; ml.methods.<ClassName>(task=...)`` resolves to | |
| the registered concrete method class via the registry-driven | |
| ``methods/__init__.py`` package. This module is a re-export shim — every | |
| attribute lookup is delegated to the underlying ``methods`` package's own | |
| ``__getattr__``, which performs the class-name → registered class lookup. | |
| This file is intentionally lightweight; we avoid eagerly importing every | |
| family module here (the underlying ``methods/__init__.py`` has already done | |
| the eager import on first import of the package, so all classes are | |
| discoverable through the registry). | |
| """ | |
| from __future__ import annotations | |
| from typing import Any | |
| from .. import methods as _methods | |
| # Re-export the registry helpers at module scope so callers can do | |
| # ``ml.methods.list_methods(...)`` / ``ml.methods.ALL_METHODS`` without | |
| # walking through the underscore module. | |
| ALL_METHODS = _methods.ALL_METHODS | |
| list_methods = _methods.list_methods | |
| get = _methods.get | |
| register = _methods.register | |
| def __getattr__(name: str) -> Any: | |
| """Delegate attribute access to ``methods/__init__.py:__getattr__``. | |
| Resolves ``ml.methods.Persistence``, ``ml.methods.LightGBMRegressor``, | |
| etc., via the underlying registry-driven lookup. | |
| """ | |
| return getattr(_methods, name) | |
| __all__ = ["ALL_METHODS", "list_methods", "get", "register"] | |