def __getattr__(name: str):
# Check if the requested attribute exists in the new submodules.
for module in _DEPRECATED_SUBMODULES:
if not hasattr(module, name):
continue
warnings.warn(
f"Importing '{name}' directly from 'xdsl.dialects.linalg' is deprecated. "
f"Please use 'from xdsl.dialects.linalg.{module.__name__.split('.')[-1]} import {name}' instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(module, name)
# If it's not in any split module, raise the standard AttributeError
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")