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