From 129e48a063335ac8ec8e774443cfcd2b8fa56fb6 Mon Sep 17 00:00:00 2001 From: Sneha Shukla <6regxsw7@mail.grokbot.com> Date: Thu, 19 Nov 2026 16:59:36 +0530 Subject: [PATCH] Convert the TypesFactory.to_ical docstring to Google style The previous docstring was a two-line summary without Parameters or Returns sections. The new wording describes how the method looks up a value type and documents that it returns bytes. AI disclosure: I used an AI assistant (Grok Bot) to help find a function whose docstring still needed converting for issue #1072, that was not already covered by an open pull request, draft Google-style Parameters and Returns sections from the implementation, and prepare the changelog entry. Prompts summarized: search src/icalendar for leftover non-Google docstrings outside files in open #1072 PRs; rewrite TypesFactory.to_ical to match the project style guide; add news/1072.documentation.6 with the required AI disclosure. Output: this commit. --- news/1072.documentation.6 | 1 + src/icalendar/prop/factory.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 news/1072.documentation.6 diff --git a/news/1072.documentation.6 b/news/1072.documentation.6 new file mode 100644 index 000000000..c74a8cecb --- /dev/null +++ b/news/1072.documentation.6 @@ -0,0 +1 @@ +Converted the :meth:`~icalendar.prop.factory.TypesFactory.to_ical` docstring to Google style, including Parameters and Returns sections. I used an AI assistant (Grok Bot) to help identify a function whose docstring was not yet in Google style and was not already covered by an open pull request, draft the wording, and prepare this changelog entry. @sneha-shukla-dev diff --git a/src/icalendar/prop/factory.py b/src/icalendar/prop/factory.py index 20b73da44..2bc9835d5 100644 --- a/src/icalendar/prop/factory.py +++ b/src/icalendar/prop/factory.py @@ -318,8 +318,19 @@ def default_value_type(self, name: str) -> str: return self[internal].default_value.lower() def to_ical(self, name, value): - """Encodes a named value from a primitive python type to an icalendar - encoded string. + """Encode a named value from a Python object into iCalendar bytes. + + Looks up the value type for ``name`` with :meth:`for_property` and + returns that type's iCalendar encoding of ``value``. + + Parameters: + name: The iCalendar property or parameter name, for example + ``"SUMMARY"`` or ``"DURATION"``. + value: A Python value accepted by the corresponding value type, + for example a :class:`str` or :class:`~datetime.timedelta`. + + Returns: + The iCalendar-encoded value as :class:`bytes`. """ type_class = self.for_property(name) return type_class(value).to_ical()