Skip to content

Commit

Permalink
Deprecate unused function walk_model
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Nov 14, 2023
1 parent b4160a9 commit 322b3d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pymc/pytensorf.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def walk_model(
expand_fn
A function that returns the next variable(s) to be traversed.
"""
warnings.warn("walk_model will be removed in a future relase of PyMC", FutureWarning)

if stop_at_vars is None:
stop_at_vars = set()

Expand Down
9 changes: 6 additions & 3 deletions tests/test_pytensorf.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,21 +281,24 @@ def test_walk_model():

test_graph = pt.exp(e + 1)

res = list(walk_model((test_graph,)))
with pytest.warns(FutureWarning):
res = list(walk_model((test_graph,)))
assert a in res
assert b in res
assert c in res
assert d in res
assert e in res

res = list(walk_model((test_graph,), stop_at_vars={c}))
with pytest.warns(FutureWarning):
res = list(walk_model((test_graph,), stop_at_vars={c}))
assert a not in res
assert b not in res
assert c in res
assert d in res
assert e in res

res = list(walk_model((test_graph,), stop_at_vars={b}))
with pytest.warns(FutureWarning):
res = list(walk_model((test_graph,), stop_at_vars={b}))
assert a not in res
assert b in res
assert c in res
Expand Down

0 comments on commit 322b3d3

Please sign in to comment.