[MNT] Fix string formatting and stacklevel for v2 model warnings.#2216
Open
Gitanaskhan26 wants to merge 2 commits intosktime:mainfrom
Open
[MNT] Fix string formatting and stacklevel for v2 model warnings.#2216Gitanaskhan26 wants to merge 2 commits intosktime:mainfrom
Gitanaskhan26 wants to merge 2 commits intosktime:mainfrom
Conversation
…del base classes Fix garbled warning messages caused by missing trailing spaces in Python implicit string concatenation across v2 model base classes. Changes: - Fix missing spaces between concatenated string literals in warning messages (e.g. 'implementationof' -> 'implementation of') - Fix typo 'unannouced' -> 'unannounced' in TimeXer v2 - Add stacklevel=2 to all warn() calls so warnings point to user call site instead of internal library code Files modified: - pytorch_forecasting/models/base/_tslib_base_model_v2.py - pytorch_forecasting/models/base/_base_model_v2.py - pytorch_forecasting/models/timexer/_timexer_v2.py - pytorch_forecasting/models/timexer/_timexer.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2216 +/- ##
=======================================
Coverage ? 86.62%
=======================================
Files ? 165
Lines ? 9736
Branches ? 0
=======================================
Hits ? 8434
Misses ? 1302
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Reference Issues/PRs
None (Standalone cleanup for warning messages noticed while browsing the v2 code).
What does this implement/fix? Explain your changes.
While reading through the v2 model base classes, I noticed a few warning messages were getting squished together due to missing trailing spaces in Python's implicit multi-line string concatenation.
This PR cleans those up so they render correctly for the end-user. Specifically, I:
"implementationof"->"implementation of","betatesting"->"beta testing","somepatches"->"some patches")."unannouced"->"unannounced") in_timexer.py.stacklevel=2to thewarnings.warn()calls in these files. This ensures the warning correctly points to the user's actual script rather than the internal library code, which makes debugging much easier for them.What should a reviewer concentrate their feedback on?
Very lightweight review! Just a quick sanity check on the string spacing and the
stacklevel=2additions across the modified files.Did you add any tests for the change?
No new tests were added since this is strictly a string formatting and warning stacklevel fix. However, existing tests for DLinear v2 and TimeXer v2 continue to pass cleanly locally.
Any other comments?
All pre-commit hooks have been run, and
ruffis perfectly happy with the line lengths on the modified warnings.PR checklist
pre-commit install. To run hooks independent of commit, executepre-commit run --all-files