-
-
Notifications
You must be signed in to change notification settings - Fork 283
docs: replace RFC copy-paste docstrings with Pythonic docstrings #1385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -156,32 +156,29 @@ class Alarm(Component): | |||||
|
|
||||||
| ACKNOWLEDGED = single_utc_property( | ||||||
| "ACKNOWLEDGED", | ||||||
| """This is defined in RFC 9074: | ||||||
|
|
||||||
| Purpose: This property specifies the UTC date and time at which the | ||||||
| corresponding alarm was last sent or acknowledged. | ||||||
|
|
||||||
| This property is used to specify when an alarm was last sent or acknowledged. | ||||||
| This allows clients to determine when a pending alarm has been acknowledged | ||||||
| by a calendar user so that any alerts can be dismissed across multiple devices. | ||||||
| It also allows clients to track repeating alarms or alarms on recurring events or | ||||||
| to-dos to ensure that the right number of missed alarms can be tracked. | ||||||
|
|
||||||
| Clients SHOULD set this property to the current date-time value in UTC | ||||||
| when a calendar user acknowledges a pending alarm. Certain kinds of alarms, | ||||||
| such as email-based alerts, might not provide feedback as to when the calendar user | ||||||
| sees them. For those kinds of alarms, the client SHOULD set this property | ||||||
| when the alarm is triggered and the action is successfully carried out. | ||||||
|
|
||||||
| When an alarm is triggered on a client, clients can check to see if an "ACKNOWLEDGED" | ||||||
| property is present. If it is, and the value of that property is greater than or | ||||||
| equal to the computed trigger time for the alarm, then the client SHOULD NOT trigger | ||||||
| the alarm. Similarly, if an alarm has been triggered and | ||||||
| an "alert" has been presented to a calendar user, clients can monitor | ||||||
| the iCalendar data to determine whether an "ACKNOWLEDGED" property is added or | ||||||
| changed in the alarm component. If the value of any "ACKNOWLEDGED" property | ||||||
| in the alarm changes and is greater than or equal to the trigger time of the alarm, | ||||||
| then clients SHOULD dismiss or cancel any "alert" presented to the calendar user. | ||||||
| """The UTC datetime at which this alarm was last sent or acknowledged. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I looked at the rendered docs, I found that there was a snippet prepended to this docstring. Would you please revise the following: Specifically, and possibly wrapped after using - f"""The {name} property. datetime in UTC
+ f"""The {name} property with all values converted to a :class:`~datetime.datetime` in UTC.
- All values will be converted to a datetime in UTC.
+ The two blank lines will ensure proper concatenation with a new paragraph to begin the description of the docstring.
Suggested change
|
||||||
|
|
||||||
| Defined in :rfc:`9074`. Setting this property allows calendar clients to | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved into previous paragraph.
Suggested change
|
||||||
| dismiss or suppress an alarm across multiple devices. Once set to a value | ||||||
| greater than or equal to the alarm's computed trigger time, conforming clients | ||||||
| will not re-fire the alarm. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Returns ``None`` when no acknowledgment has been recorded. | ||||||
|
|
||||||
| Example: | ||||||
| Mark an alarm as acknowledged at the current time. | ||||||
|
|
||||||
| .. code-block:: pycon | ||||||
|
|
||||||
| >>> from datetime import timezone, datetime | ||||||
| >>> from icalendar import Alarm | ||||||
| >>> alarm = Alarm() | ||||||
| >>> alarm.ACKNOWLEDGED = datetime(2024, 1, 15, 10, 0, 0, tzinfo=timezone.utc) | ||||||
| >>> alarm.ACKNOWLEDGED # doctest: +ELLIPSIS | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inline comments don't render. Is the comment necessary?
Suggested change
|
||||||
| datetime.datetime(2024, 1, 15, 10, 0, tzinfo=...) | ||||||
|
|
||||||
| See also: | ||||||
| :attr:`TRIGGER` — the time at which the alarm fires. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| """, | ||||||
| ) | ||||||
|
|
||||||
|
|
@@ -190,17 +187,33 @@ class Alarm(Component): | |||||
| "dt", | ||||||
| (datetime, timedelta), | ||||||
| timedelta | datetime | None, | ||||||
| """Purpose: This property specifies when an alarm will trigger. | ||||||
| """The time at which this alarm fires, per :rfc:`5545#section-3.8.6.3`. | ||||||
|
|
||||||
| Value Type: The default value type is DURATION. The value type can | ||||||
| be set to a DATE-TIME value type, in which case the value MUST | ||||||
| specify a UTC-formatted DATE-TIME value. | ||||||
| The value is either a :class:`~datetime.timedelta` (relative trigger) or a | ||||||
| UTC :class:`~datetime.datetime` (absolute trigger). | ||||||
|
|
||||||
| Either a positive or negative duration may be specified for the | ||||||
| "TRIGGER" property. An alarm with a positive duration is | ||||||
| triggered after the associated start or end of the event or to-do. | ||||||
| An alarm with a negative duration is triggered before the | ||||||
| associated start or end of the event or to-do.""", | ||||||
| A negative :class:`~datetime.timedelta` fires *before* the related | ||||||
| component boundary (start or end); a positive one fires *after* it. | ||||||
| Use :attr:`TRIGGER_RELATED` to choose whether the offset is measured from | ||||||
| the start or the end of the parent event or to-do. | ||||||
| An absolute trigger fires at an exact UTC point in time regardless of the | ||||||
| parent component's dates. | ||||||
|
|
||||||
| Example: | ||||||
| Set an alarm to fire 15 minutes before the start of an event. | ||||||
|
|
||||||
| .. code-block:: pycon | ||||||
|
|
||||||
| >>> from datetime import timedelta | ||||||
| >>> from icalendar import Alarm | ||||||
| >>> alarm = Alarm() | ||||||
| >>> alarm.TRIGGER = timedelta(minutes=-15) | ||||||
| >>> alarm.TRIGGER # doctest: +ELLIPSIS | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| datetime.timedelta(...) | ||||||
|
|
||||||
| See also: | ||||||
| :attr:`TRIGGER_RELATED`, :attr:`DURATION`, :attr:`REPEAT` | ||||||
| """, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This docstring is almost perfect. However, the property has documentation that gets prepended and appended, as defined in https://github.com/stevepiercy/icalendar/blob/8c26d2b22ce33c37bd2bfce7997ca240641236ab/src/icalendar/attr.py#L958-L966. Let's clean that up, too. p_doc = f"""The {prop} property.
{doc}
You can also delete the value with ``del`` or by setting it to ``None``.
Parameters:
{", ".join(t.__name__ for t in value_type)}
Raises:
InvalidCalendar: if the attribute has invalid values.
Returns:
A :class:`~datetime.datetime` or :class:`~datetime.timedelta` if the value is valid. ``None`` if the value is absent.
""" |
||||||
| ) | ||||||
|
|
||||||
| @property | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to
/news/1244.documentation?