提交 fc2dc234 authored 作者: Maxim Kochurov's avatar Maxim Kochurov 提交者: Maxim Kochurov

remove deprecated modules from pytensor.graph

上级 4eded292
import warnings
warnings.warn(
"The module `pytensor.graph.kanren` is deprecated; use `pytensor.graph.rewriting.kanren` instead.",
DeprecationWarning,
stacklevel=2,
)
from pytensor.graph.rewriting.kanren import * # noqa: F401 E402 F403
import warnings
warnings.warn(
"The module `pytensor.graph.opt` is deprecated; use `pytensor.graph.rewriting.basic` instead.",
DeprecationWarning,
stacklevel=2,
)
from pytensor.graph.rewriting.basic import * # noqa: F401 E402 F403
from pytensor.graph.rewriting.basic import DEPRECATED_NAMES # noqa: F401 E402 F403
def __getattr__(name):
"""Intercept module-level attribute access of deprecated symbols.
Adapted from https://stackoverflow.com/a/55139609/3006474.
"""
global DEPRECATED_NAMES
from warnings import warn
for old_name, msg, old_object in DEPRECATED_NAMES:
if name == old_name:
warn(msg, DeprecationWarning, stacklevel=2)
return old_object
raise AttributeError(f"module {__name__} has no attribute {name}")
import warnings
warnings.warn(
"The module `pytensor.graph.opt_utils` is deprecated; use `pytensor.graph.rewriting.utils` instead.",
DeprecationWarning,
stacklevel=2,
)
from pytensor.graph.rewriting.utils import * # noqa: F401 E402 F403
from pytensor.graph.rewriting.utils import DEPRECATED_NAMES # noqa: F401 E402 F403
def __getattr__(name):
"""Intercept module-level attribute access of deprecated symbols.
Adapted from https://stackoverflow.com/a/55139609/3006474.
"""
global DEPRECATED_NAMES
from warnings import warn
for old_name, msg, old_object in DEPRECATED_NAMES:
if name == old_name:
warn(msg, DeprecationWarning, stacklevel=2)
return old_object
raise AttributeError(f"module {__name__} has no attribute {name}")
import warnings
warnings.warn(
"The module `pytensor.graph.optdb` is deprecated; use `pytensor.graph.rewriting.db` instead.",
DeprecationWarning,
stacklevel=2,
)
from pytensor.graph.rewriting.db import * # noqa: F401 E402 F403
from pytensor.graph.rewriting.db import DEPRECATED_NAMES # noqa: F401 E402 F403
def __getattr__(name):
"""Intercept module-level attribute access of deprecated symbols.
Adapted from https://stackoverflow.com/a/55139609/3006474.
"""
global DEPRECATED_NAMES
from warnings import warn
for old_name, msg, old_object in DEPRECATED_NAMES:
if name == old_name:
warn(msg, DeprecationWarning, stacklevel=2)
return old_object
raise AttributeError(f"module {__name__} has no attribute {name}")
import warnings
warnings.warn(
"The module `pytensor.graph.toolbox` is deprecated "
"and has been renamed to `pytensor.graph.features`",
DeprecationWarning,
stacklevel=2,
)
import warnings
warnings.warn(
"The module `pytensor.graph.unify` is deprecated; use `pytensor.graph.rewriting.unify` instead.",
DeprecationWarning,
stacklevel=2,
)
from pytensor.graph.rewriting.unify import * # noqa: F401 E402 F403
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论