Skip to content

docs: convert timezone.py docstrings to Google style - #1387

Open
Godzilaa wants to merge 2 commits into
collective:mainfrom
Godzilaa:fix/google-style-docstrings-timezone
Open

docs: convert timezone.py docstrings to Google style#1387
Godzilaa wants to merge 2 commits into
collective:mainfrom
Godzilaa:fix/google-style-docstrings-timezone

Conversation

@Godzilaa

Copy link
Copy Markdown

Convert old :param/:raises Sphinx-style docstrings in timezone.py
to Google-style docstrings matching the project style guide.

Functions updated:

  • _extract_offsets
  • _make_unique_tzname
  • to_tz
  • from_tzinfo
  • from_tzid

Contributes to #1072

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 icalendar | 🛠️ Build #32693848 | 📁 Comparing a55c5ac against latest (66fb3e1)

  🔍 Preview build  

3 files changed
± 404.html
± reference/api/icalendar.cal.timezone.html
± _modules/icalendar/cal/timezone.html

@stevepiercy

Copy link
Copy Markdown
Member

@Godzilaa would you please add a change log entry per https://icalendar.readthedocs.io/en/stable/contribute/index.html#change-log-entry-format, and update your branch with main?

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I found a few issues with the original docstrings during my review, as well as a few minor suggestions and corrections. Would you please take care to address them? Thank you!

"""
:param tzname: Candidate tzname
:param tznames: Other tznames
"""Make a tzname unique by appending ``_1``, ``_2``, etc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't actually increment a count, but merely appends a string to the name. Take a look at the calling function to see what gets passed in here.

Suggested change
"""Make a tzname unique by appending ``_1``, ``_2``, etc.
"""Make a tzname unique by appending ``_1``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not addressed. Unresolving.

Comment thread src/icalendar/cal/timezone.py Outdated
Comment on lines +131 to +133
timezone definitions with tzp. If ``False``, a new timezone
will be created. If ``True``, the existing timezone will be used
if it exists, otherwise a new timezone will be created.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make a link to the class, and remove redundant mention of "exist". Also check line length, in case CI fails.

Suggested change
timezone definitions with tzp. If ``False``, a new timezone
will be created. If ``True``, the existing timezone will be used
if it exists, otherwise a new timezone will be created.
timezone definitions with :class:`~icalendar.timezone.tzp.TZP`. If ``False``, a new timezone
will be created. If ``True``, the existing timezone will be used,
otherwise a new timezone will be created.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not addressed. Unresolving.

Comment on lines +256 to +258
first_date: A datetime that is earlier than anything that
happens in the calendar.
last_date: A datetime that is later than anything that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original docstring was wrong. dates are passed in, not datetimes.

Suggested change
first_date: A datetime that is earlier than anything that
happens in the calendar.
last_date: A datetime that is later than anything that
first_date: A date that is earlier than anything that
happens in the calendar.
last_date: A date that is later than anything that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not addressed. Unresolving.

Comment thread src/icalendar/cal/timezone.py Outdated
tzp: The timezone provider.
first_date: A datetime that is earlier than anything
that happens in the calendar.
last_date: A datetime that is later than anything

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
last_date: A datetime that is later than anything
first_date: A date that is earlier than anything
that happens in the calendar.
last_date: A date that is later than anything

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not addressed. Unresolving.

Comment thread src/icalendar/cal/timezone.py Outdated
Convert old :param/:raises Sphinx-style docstrings in timezone.py
to Google-style docstrings matching the project style guide.

Functions updated:
- _extract_offsets
- _make_unique_tzname
- to_tz
- from_tzinfo
- from_tzid

Contributes to collective#1072

Used AI model: opencode/deepseek-v4-flash-free
Used for: converting Sphinx-style docstrings to Google-style,
fixing duplicate parameter in from_tzid, adding changelog entry,
and fixing line length formatting.
@Godzilaa
Godzilaa force-pushed the fix/google-style-docstrings-timezone branch from 20ceb7d to 4385d4c Compare May 21, 2026 11:14
@Godzilaa

Copy link
Copy Markdown
Author

I've rebased the branch on latest main, added a changelog entry (news/1072.documentation), fixed the duplicate first_date parameter in from_tzid, and ensured all ruff checks pass. All 14,751 tests succeed.

@stevepiercy

Copy link
Copy Markdown
Member

@Godzilaa you resolved four suggestions without a comment. I unresolved them. Would you please address them? Thank you!

@stevepiercy

Copy link
Copy Markdown
Member

@Godzilaa there are now merge conflicts that need to be resolve, too. Would you please take care? Thank you!

@stevepiercy

Copy link
Copy Markdown
Member

@Godzilaa thanks for starting the work. Would you please continue the work and resolve the issues I've raised? Please let us know if you need any further help with this. Thank you!

@niccokunzmann

Copy link
Copy Markdown
Member

@Godzilaa this PR has had no change for some time. Let me know if you'd like to give it the finishing touch! Otherwise I will close it in a week.
Thanks for all the work so far!

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.

3 participants