amaranth/amaranth/hdl/dsl.py
Catherine 572a60d838 hdl: add missing compatibility shims.
These were originally planned to be committed as a part of 5dd1223c,
but were lost during rebasing.
2024-01-31 02:05:17 +00:00

23 lines
825 B
Python

# TODO(amaranth-0.6): remove module
from .. import hdl as __hdl
from . import _dsl as __origin
__all__ = ["SyntaxError", "SyntaxWarning", "Module"]
def __getattr__(name):
import warnings
if name in __hdl.__dict__:
if not (name.startswith("__") and name.endswith("__")):
warnings.warn(f"instead of `{__name__}.{name}`, use `{__hdl.__name__}.{name}`",
DeprecationWarning, stacklevel=2)
return getattr(__origin, name)
elif name in __origin.__dict__:
warnings.warn(f"name `{__name__}.{name}` is a private implementation detail and "
f"should not be imported",
DeprecationWarning, stacklevel=2)
return getattr(__origin, name)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")