Skip to content

Commit

Permalink
Merge branch 'main' into issue-716-alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann authored Oct 26, 2024
2 parents 42d330f + 569c40b commit 0a23c55
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Minor changes:
- Document the Debian package. See `Issue 701 <https://github.com/collective/icalendar/issues/701>`_.
- Document ``vDatetime.from_ical``
- Allow passing a ``datetime.date`` to ``TZP.localize_utc`` and ``TZP.localize`` methods.
- Document component classes with description from :rfc:`5545`.

Breaking changes:

Expand Down
48 changes: 47 additions & 1 deletion src/icalendar/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,12 @@ def _del_duration(self: Component):


class Event(Component):
"""
A "VEVENT" calendar component is a grouping of component
properties that represents a scheduled amount of time on a
calendar. For example, it can be an activity, such as a one-hour
long department meeting from 8:00 AM to 9:00 AM, tomorrow.
"""

name = 'VEVENT'

Expand Down Expand Up @@ -809,6 +815,13 @@ def end(self, end: date | datetime | None):


class Todo(Component):
"""
A "VTODO" calendar component is a grouping of component
properties that represents an action item or assignment. For
example, it can be used to represent an item of work assigned to
an individual, such as "Prepare for the upcoming conference
seminar on Internet Calendaring".
"""

name = 'VTODO'

Expand Down Expand Up @@ -986,6 +999,12 @@ def duration(self) -> timedelta:
return timedelta(0)

class FreeBusy(Component):
"""
A "VFREEBUSY" calendar component is a grouping of component
properties that represents either a request for free or busy time
information, a reply to a request for free or busy time
information, or a published set of busy time information.
"""

name = 'VFREEBUSY'

Expand All @@ -998,6 +1017,11 @@ class FreeBusy(Component):


class Timezone(Component):
"""
A "VTIMEZONE" calendar component is a grouping of component
properties that defines a time zone. It is used to describe the
way in which a time zone changes its offset from UTC over time.
"""
name = 'VTIMEZONE'
canonical_order = ('TZID',)
required = ('TZID',) # it also requires one of components DAYLIGHT and STANDARD
Expand Down Expand Up @@ -1158,20 +1182,38 @@ def get_transitions(self) -> Tuple[List[datetime], List[Tuple[timedelta, timedel


class TimezoneStandard(Component):
"""
The "STANDARD" sub-component of "VTIMEZONE" defines the standard
time offset from UTC for a time zone. It represents a time zone's
standard time, typically used during winter months in locations
that observe Daylight Saving Time.
"""
name = 'STANDARD'
required = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM')
singletons = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM',)
multiple = ('COMMENT', 'RDATE', 'TZNAME', 'RRULE', 'EXDATE')


class TimezoneDaylight(Component):
"""
The "DAYLIGHT" sub-component of "VTIMEZONE" defines the daylight
saving time offset from UTC for a time zone. It represents a time
zone's daylight saving time, typically used during summer months
in locations that observe Daylight Saving Time.
"""
name = 'DAYLIGHT'
required = TimezoneStandard.required
singletons = TimezoneStandard.singletons
multiple = TimezoneStandard.multiple


class Alarm(Component):
"""
A "VALARM" calendar component is a grouping of component
properties that defines an alarm or reminder for an event or a
to-do. For example, it may be used to define a reminder for a
pending event or an overdue to-do.
"""

name = 'VALARM'
# some properties MAY/MUST/MUST NOT appear depending on ACTION value
Expand Down Expand Up @@ -1246,7 +1288,11 @@ def REPEAT(self, value: int) -> None:


class Calendar(Component):
"""This is the base object for an iCalendar file.
"""
The "VCALENDAR" object is a collection of calendar information.
This information can include a variety of components, such as
"VEVENT", "VTODO", "VJOURNAL", "VFREEBUSY", "VTIMEZONE", or any
other type of calendar component.
"""
name = 'VCALENDAR'
canonical_order = ('VERSION', 'PRODID', 'CALSCALE', 'METHOD',)
Expand Down

0 comments on commit 0a23c55

Please sign in to comment.