Add docstrings to Duration properties and in_*/total_* methods - #1025
Open
JazzyJJ0601 wants to merge 1 commit into
Open
JazzyJJ0601 wants to merge 1 commit into
JazzyJJ0601 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Most of
Duration's public properties and methods had no docstring, and a few are easy to misread:weeksonly counts the days part (not years/months),secondsis only the time part (not whole days), and thetotal_*methods count a year as 365 days and a month as 30. This adds a short docstring to each, in the same style asin_words().Docstrings only; no code changes. Checked against real values, e.g.
pendulum.duration(years=1, months=2, days=10, hours=5, minutes=3, seconds=7)hasweeks == 1,remaining_days == 3,seconds == 18187,remaining_seconds == 7andin_weeks() == 62.pytest tests/durationpasses.AI disclosure: I found the gap with an audit tool I'm building, drafted the text with an AI assistant (Claude), and checked every docstring against the code and against real values by hand.
(Audit tool: Legacy Doc-AI.)