Skip to content

Commit 899d99e

Browse files
committed
remove outdated deprecations from pytensor/graph/rewriting/utils.py
1 parent c97c527 commit 899d99e

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

pytensor/graph/rewriting/utils.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import copy
2-
import warnings
32
from typing import TYPE_CHECKING, Generator, Optional, Sequence, Union, cast
43

54
import pytensor
@@ -23,7 +22,6 @@ def rewrite_graph(
2322
include: Sequence[str] = ("canonicalize",),
2423
custom_rewrite: Optional["GraphRewriter"] = None,
2524
clone: bool = False,
26-
custom_opt: Optional["GraphRewriter"] = None,
2725
**kwargs,
2826
) -> Union[Variable, Sequence[Variable], FunctionGraph]:
2927
"""Easily apply rewrites to a graph.
@@ -62,14 +60,6 @@ def rewrite_graph(
6260
query_rewrites = optdb.query(RewriteDatabaseQuery(include=include, **kwargs))
6361
_ = query_rewrites.rewrite(fgraph)
6462

65-
if custom_opt is not None:
66-
warnings.warn(
67-
"`custom_opt` is deprecated; use `custom_rewrite` instead.",
68-
DeprecationWarning,
69-
stacklevel=2,
70-
)
71-
custom_rewrite = custom_opt
72-
7363
if custom_rewrite:
7464
custom_rewrite.rewrite(fgraph)
7565

@@ -248,28 +238,3 @@ def get_clients_at_depth(
248238
else:
249239
assert var.owner is not None
250240
yield var.owner
251-
252-
253-
DEPRECATED_NAMES = [
254-
(
255-
"optimize_graph",
256-
"`optimize_graph` is deprecated: use `rewrite_graph` instead.",
257-
rewrite_graph,
258-
),
259-
]
260-
261-
262-
def __getattr__(name):
263-
"""Intercept module-level attribute access of deprecated symbols.
264-
265-
Adapted from https://stackoverflow.com/a/55139609/3006474.
266-
267-
"""
268-
from warnings import warn
269-
270-
for old_name, msg, old_object in DEPRECATED_NAMES:
271-
if name == old_name:
272-
warn(msg, DeprecationWarning, stacklevel=2)
273-
return old_object
274-
275-
raise AttributeError(f"module {__name__} has no attribute {name}")

0 commit comments

Comments
 (0)