| """Methods package — registry-driven re-exports. |
| |
| Each family module's ``@register``-decorated classes self-register at import |
| time. Importing this package eagerly imports every family module so |
| ``ALL_METHODS`` is fully populated and ``ml.methods.<ClassName>`` resolves |
| without a per-call lazy fallback. |
| """ |
|
|
| from __future__ import annotations |
|
|
| from ._registry import ALL_METHODS, get, list_methods, register |
|
|
| |
| |
| |
| from . import ( |
| classical, |
| llm, |
| llm_finetune, |
| llm_ts_reason, |
| naive, |
| sequence, |
| tsfm, |
| ) |
|
|
|
|
| def __getattr__(name: str): |
| """Resolve ``methods.<ClassName>`` lookups via the registry. |
| |
| The registry stores classes by their lowercase ``name`` attr; the public |
| re-export uses the class's actual Python name (e.g. ``Persistence``, |
| ``LightGBMRegressor``). Search every registered class for a Python-name |
| match, then fall back to the lowercase registry id. |
| """ |
| for cls in ALL_METHODS.values(): |
| if cls.__name__ == name: |
| return cls |
| if name in ALL_METHODS: |
| return ALL_METHODS[name] |
| raise AttributeError(f"module 'methods' has no attribute {name!r}") |
|
|
|
|
| __all__ = ["ALL_METHODS", "get", "list_methods", "register"] |
|
|