Skip to content

Accepted values for RECURRENCE_ID property looks strange #1259

Description

@stevepiercy

When reviewing PR #1236, I found a weird docstring format.

https://icalendar--1236.org.readthedocs.build/en/1236/reference/api/icalendar.cal.event.html#icalendar.cal.event.Event.RECURRENCE_ID

Image

Observe that the property has type hints that hyperlink, but the "Accepted values:" section heading is a wall of text. It's also not a standard section heading.

It's generated in this method.

Accepted values: {", ".join(t.__name__ for t in value_type)}.
If the attribute has invalid values, we raise InvalidCalendar.
If the value is absent, we return None.
You can also delete the value with del or by setting it to None.
"""

With the following snippet, it appears somewhat better.

To delete the value, either use ``del`` or set it to ``None``.

Returns:
    If the value is absent, return ``None``.

Raises:
    :exc:`~icalendar.error.InvalidCalendar`
        If the attribute has invalid values.
Image

I think that "Accepted values" is redundant to the type hints, so I'd remove it.

I'd keep the usage text, however, and append it to the description. This could be a problem, though, if there are other heading sections in the original docstring after the description.

@niccokunzmann what do you think?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions