Skip to content

Add docstrings to Duration properties and in_*/total_* methods - #1025

Open
JazzyJJ0601 wants to merge 1 commit into
python-pendulum:masterfrom
JazzyJJ0601:docs/duration-docstrings
Open

JazzyJJ0601 wants to merge 1 commit into
python-pendulum:masterfrom
JazzyJJ0601:docs/duration-docstrings

Conversation

@JazzyJJ0601

Copy link
Copy Markdown

Most of Duration's public properties and methods had no docstring, and a few are easy to misread: weeks only counts the days part (not years/months), seconds is only the time part (not whole days), and the total_* methods count a year as 365 days and a month as 30. This adds a short docstring to each, in the same style as in_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) has weeks == 1, remaining_days == 3, seconds == 18187, remaining_seconds == 7 and in_weeks() == 62. pytest tests/duration passes.

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.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant