File size: 1,418 Bytes
ff4becd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""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"]