Skip to content

Commit

Permalink
Better deprecation warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegrabowski committed Jan 9, 2025
1 parent 8e9e7b4 commit ce09972
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pymc/variational/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def run_profiling(self, n=1000, score=None, **kwargs):
score = self._maybe_score(score)
if "fn_kwargs" in kwargs:
warnings.warn(

Check warning on line 86 in pymc/variational/inference.py

View check run for this annotation

Codecov / codecov/patch

pymc/variational/inference.py#L86

Added line #L86 was not covered by tests
DeprecationWarning, "fn_kwargs is deprecated, please use compile_kwargs instead"
"fn_kwargs is deprecated, please use compile_kwargs instead", DeprecationWarning
)
compile_kwargs = kwargs.pop("fn_kwargs")

Check warning on line 89 in pymc/variational/inference.py

View check run for this annotation

Codecov / codecov/patch

pymc/variational/inference.py#L89

Added line #L89 was not covered by tests
else:
Expand Down
12 changes: 10 additions & 2 deletions pymc/variational/opvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ def step_function(
`pytensor.function`
"""
if fn_kwargs is not None:
warnings.warn("`fn_kwargs` is deprecated and will be removed in future versions")
warnings.warn(

Check warning on line 382 in pymc/variational/opvi.py

View check run for this annotation

Codecov / codecov/patch

pymc/variational/opvi.py#L382

Added line #L382 was not covered by tests
"`fn_kwargs` is deprecated and will be removed in future versions. Use "
"`compile_kwargs` instead.",
DeprecationWarning,
)
compile_kwargs = fn_kwargs

Check warning on line 387 in pymc/variational/opvi.py

View check run for this annotation

Codecov / codecov/patch

pymc/variational/opvi.py#L387

Added line #L387 was not covered by tests

if compile_kwargs is None:
Expand Down Expand Up @@ -428,7 +432,11 @@ def score_function(
pytensor.function
"""
if fn_kwargs is not None:
warnings.warn("`fn_kwargs` is deprecated and will be removed in future versions")
warnings.warn(

Check warning on line 435 in pymc/variational/opvi.py

View check run for this annotation

Codecov / codecov/patch

pymc/variational/opvi.py#L434-L435

Added lines #L434 - L435 were not covered by tests
"`fn_kwargs` is deprecated and will be removed in future versions. Use "
"`compile_kwargs` instead",
DeprecationWarning,
)
compile_kwargs = fn_kwargs

Check warning on line 440 in pymc/variational/opvi.py

View check run for this annotation

Codecov / codecov/patch

pymc/variational/opvi.py#L440

Added line #L440 was not covered by tests

if compile_kwargs is None:
Expand Down

0 comments on commit ce09972

Please sign in to comment.