MAINT: tidy tic/tac/toc deprecation follow-ups (stacked on #833) - #958
Open
quantecon-services wants to merge 4 commits into
Open
MAINT: tidy tic/tac/toc deprecation follow-ups (stacked on #833)#958quantecon-services wants to merge 4 commits into
quantecon-services wants to merge 4 commits into
Conversation
Emit a DeprecationWarning from the public `tic`, `tac`, `toc` and `loop_timer` functions, pointing users to the modern `Timer` context manager and `timeit` function added in #783/#794. Removal is targeted for v0.12.0. - `__Timer__.loop_timer` now calls its own methods (`self.tic`/`tac`/ `toc`) instead of the public wrappers, so a single `loop_timer` call emits exactly one warning rather than one per run. - The warning uses `stacklevel=3` so it is attributed to the user's call site rather than the wrapper. - Added `.. deprecated:: 0.12.0` directives to the module and the affected docstrings. - Added tests asserting each function warns, that `loop_timer` warns only once, and that the warning points at the caller. Note: the original issue mentioned removal in 0.9.*, but the library is already at v0.11.2, so this targets v0.12.0 instead.
- State the v1.0 removal target in the module docstring so it matches
the warning text and the `.. deprecated:: 0.12.0` directives.
- Use `@pytest.mark.filterwarnings("ignore::DeprecationWarning")` on the
behavioural tests that exercise the deprecated timers, replacing the
nested `warnings.catch_warnings()` blocks.
- Drop a stray `# noqa:` comment that carried prose instead of a code.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A58YqvGkFvFkgtxg7PAsBt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #833 — please merge that PR first. Once it lands, the diff here reduces to the single commit
MAINT: tidy tic/tac/toc deprecation follow-ups; until then GitHub shows #833's commits as part of this PR because its head branch lives on a fork.Small review follow-ups to the tic/tac/toc/loop_timer deprecation (#786, Step 1):
.. deprecated:: 0.12.0directives (rendered docs read "deprecated since 0.12.0, removed in v1.0").@pytest.mark.filterwarnings("ignore::DeprecationWarning")on the four behavioural tests that exercise the deprecated timers, replacing the nestedwarnings.catch_warnings()blocks. TheTestDeprecationtests fortac/tockeep their localcatch_warnings()since they need to silence only the precedingtic()while asserting on the next call.# noqa:comment that carried prose rather than a code.No behaviour change.
pytest quantecon/util/tests/test_timing.py -W error::DeprecationWarningpasses (33 tests).🤖 Generated with Claude Code
https://claude.ai/code/session_01A58YqvGkFvFkgtxg7PAsBt
Generated by Claude Code