From 6181f3b10a452319b5a1d8e370bc275c033d0909 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Thu, 20 Jun 2024 14:26:47 +0100 Subject: [PATCH 01/11] Update documentation to use main branch --- CHANGES.rst | 2 ++ docs/maintenance.rst | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 4dcf56bd..34aa2bbf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,8 @@ Changelog Minor changes: - Test that all code works with both ``pytz`` and ``zoneinfo``. +- Rename ``master`` branch to ``main``, see `Issue + `_ Breaking changes: diff --git a/docs/maintenance.rst b/docs/maintenance.rst index 7b8f33c7..d0dc941f 100644 --- a/docs/maintenance.rst +++ b/docs/maintenance.rst @@ -70,9 +70,9 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app .. code-block:: bash - git checkout master + git checkout main git pull - git checkout -b release master + git checkout -b release main git add CHANGES.rst src/icalendar/__init__.py docs/install.rst git commit -m"version 5.0.0" @@ -90,7 +90,7 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app .. code-block:: bash - git checkout master + git checkout main git pull git branch -d release git push -d origin release @@ -99,7 +99,7 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app .. code-block:: bash - git checkout master + git checkout main git pull git tag v5.0.0 git push upstream v5.0.0 # could be origin or whatever reference @@ -137,13 +137,13 @@ However, only people with ``PyPI environment access for GitHub Actions`` can app .. code-block:: bash - git checkout master + git checkout main git pull git add CHANGES.rst git commit -m"Add new CHANGELOG section for future release See https://icalendar.readthedocs.io/en/latest/maintenance.html#new-releases" - git push upstream master # could be origin or whatever reference + git push upstream main # could be origin or whatever reference Links ----- From 0daeceff028e078724acaf14c6a1b9a4113a4dd2 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Thu, 20 Jun 2024 14:27:30 +0100 Subject: [PATCH 02/11] Update README to use main branch --- README.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 8ce4dae2..45987c9e 100644 --- a/README.rst +++ b/README.rst @@ -24,9 +24,9 @@ files. :target: https://pypi.org/project/icalendar/#files :alt: Downloads from PyPI -.. image:: https://img.shields.io/github/actions/workflow/status/collective/icalendar/tests.yml?branch=master&label=master&logo=github - :target: https://github.com/collective/icalendar/actions/workflows/tests.yml?query=branch%3Amaster - :alt: GitHub Actions build status for master +.. image:: https://img.shields.io/github/actions/workflow/status/collective/icalendar/tests.yml?branch=main&label=main&logo=github + :target: https://github.com/collective/icalendar/actions/workflows/tests.yml?query=branch%3Amain + :alt: GitHub Actions build status for main .. image:: https://img.shields.io/github/actions/workflow/status/collective/icalendar/tests.yml?branch=4.x&label=4.x&logo=github :target: https://github.com/collective/icalendar/actions/workflows/tests.yml?query=branch%3A4.x++ @@ -175,8 +175,8 @@ you can receive all the latest updates, and switch back to version 5.x behavior: >>> dt.tzinfo -Version 6 is on `branch master `_ with compatibility to Python versions ``3.7+`` and ``PyPy3``. -We expect the ``master`` branch with versions ``6+`` to receive the latest updates and features. +Version 6 is on `branch main `_ with compatibility to Python versions ``3.7+`` and ``PyPy3``. +We expect the ``main`` branch with versions ``6+`` to receive the latest updates and features. Version 5 ~~~~~~~~~ From c29074d3d2ee830565de6faefd35a08b5c515a50 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Fri, 21 Jun 2024 17:55:31 +0100 Subject: [PATCH 03/11] rename branch link to main --- docs/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.rst b/docs/usage.rst index 4194577c..a4d396c0 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -372,5 +372,5 @@ Print out the calendar:: More documentation ================== -Have a look at the `tests `__ of this package to get more examples. +Have a look at the `tests `__ of this package to get more examples. All modules and classes docstrings, which document how they work. From 871af59add431cf13bcff6c74601bb12fc004c27 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Fri, 21 Jun 2024 18:27:24 +0100 Subject: [PATCH 04/11] Remove unused and untested code --- src/icalendar/__init__.py | 5 ---- src/icalendar/prop.py | 59 --------------------------------------- 2 files changed, 64 deletions(-) diff --git a/src/icalendar/__init__.py b/src/icalendar/__init__.py index 8b7203d6..138cf7a6 100644 --- a/src/icalendar/__init__.py +++ b/src/icalendar/__init__.py @@ -34,11 +34,6 @@ vUTCOffset, TypesFactory, ) -# useful tzinfo subclasses -from icalendar.prop import ( - FixedOffset, - LocalTimezone, -) # Parameters and helper methods for splitting and joining string with escaped # chars. from icalendar.parser import ( diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index 2ae5590d..61473219 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -40,12 +40,6 @@ from datetime import time from datetime import timedelta from datetime import tzinfo - -try: - from dateutil.tz import tzutc -except ImportError: - tzutc = None - from icalendar.caselessdict import CaselessDict from icalendar.parser import Parameters from icalendar.parser import escape_char @@ -70,19 +64,6 @@ WEEKDAY_RULE = re.compile(r'(?P[+-]?)(?P[\d]{0,2})' r'(?P[\w]{2})$') -#################################################### -# handy tzinfo classes you can use. -# - -ZERO = timedelta(0) -HOUR = timedelta(hours=1) -STDOFFSET = timedelta(seconds=-_time.timezone) -if _time.daylight: - DSTOFFSET = timedelta(seconds=-_time.altzone) -else: - DSTOFFSET = STDOFFSET -DSTDIFF = DSTOFFSET - STDOFFSET - def tzid_from_dt(dt: datetime) -> Optional[str]: """Retrieve the timezone id from the datetime object.""" @@ -98,46 +79,6 @@ def tzid_from_dt(dt: datetime) -> Optional[str]: return tzid -class FixedOffset(tzinfo): - """Fixed offset in minutes east from UTC. - """ - - def __init__(self, offset, name): - self.__offset = timedelta(minutes=offset) - self.__name = name - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return self.__name - - def dst(self, dt): - return ZERO - - -class LocalTimezone(tzinfo): - """Timezone of the machine where the code is running. - """ - - def utcoffset(self, dt): - return DSTOFFSET if self._isdst(dt) else STDOFFSET - - def dst(self, dt): - return DSTDIFF if self._isdst(dt) else ZERO - - def tzname(self, dt): - return _time.tzname[self._isdst(dt)] - - def _isdst(self, dt): - tt = (dt.year, dt.month, dt.day, - dt.hour, dt.minute, dt.second, - dt.weekday(), 0, -1) - stamp = _time.mktime(tt) - tt = _time.localtime(stamp) - return tt.tm_isdst > 0 - - class vBinary: """Binary property values are base 64 encoded. """ From 417c6fb88380715682334279b162ce2916fb414a Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Fri, 21 Jun 2024 18:30:12 +0100 Subject: [PATCH 05/11] Log changes --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 92b2fc87..2d2fa66d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -33,6 +33,8 @@ Breaking changes: - Replaced ``pkg_resources.get_distribution`` with ``importlib.metadata`` in ``docs/conf.py`` to allow building docs on Python 3.12. +- Remove untested and broken ``LocalTimezone`` and ``FixedOffset`` tzinfo + sub-classes, see `Issue 67 `_ New features: From fb81a2e6d1e56e681618133274f349af363857f1 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Fri, 21 Jun 2024 18:38:04 +0100 Subject: [PATCH 06/11] Rename all references of RFC 2445 to RFC 5545 --- docs/about.rst | 5 ++--- docs/usage.rst | 4 ++-- src/icalendar/cal.py | 6 +++--- src/icalendar/parser.py | 4 ++-- src/icalendar/prop.py | 4 ++-- src/icalendar/tests/prop/test_unit.py | 2 +- src/icalendar/tests/test_parsing.py | 2 +- src/icalendar/tests/test_unit_cal.py | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/about.rst b/docs/about.rst index 7a1b082e..ec249de0 100644 --- a/docs/about.rst +++ b/docs/about.rst @@ -7,8 +7,7 @@ iCalendar package for Python. The inspiration has come from the email package in the standard lib, which he thinks is pretty simple, yet efficient and powerful. -The icalendar package is an RFC 5545-compatible parser/generator for iCalendar files. +The ``icalendar`` package is an `RFC 5545 ` +compatible parser/generator for iCalendar files. .. _`Max M`: http://www.mxm.dk -.. _`RFC 2445`: https://tools.ietf.org/html/rfc2445 -.. _`RFC 5545`: https://tools.ietf.org/html/rfc5545 diff --git a/docs/usage.rst b/docs/usage.rst index 4194577c..08621c4a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -2,7 +2,7 @@ iCalendar package ================= This package is used for parsing and generating iCalendar files following the -standard in RFC 2445. +standard in RFC 5545. It should be fully compliant, but it is possible to generate and parse invalid files if you really want to. @@ -129,7 +129,7 @@ added. Here is an example:: END:VCALENDAR Note: this version doesn't check for compliance, so you should look in -the RFC 2445 spec for legal properties for each component, or look in +the RFC 5545 spec for legal properties for each component, or look in the icalendar/calendar.py file, where it is at least defined for each component. diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py index 02a1fa6d..8708328d 100644 --- a/src/icalendar/cal.py +++ b/src/icalendar/cal.py @@ -1,5 +1,5 @@ """Calendar is a dictionary like Python object that can render itself as VCAL -files according to rfc2445. +files according to RFC 5545. These are the defined components. """ @@ -37,7 +37,7 @@ def get_example(component_directory: str, example_name: str) -> bytes: # The component factory class ComponentFactory(CaselessDict): - """All components defined in rfc 2445 are registered in this factory class. + """All components defined in RFC 5545 are registered in this factory class. To get a component you can use it like this. """ @@ -69,7 +69,7 @@ def __init__(self, *args, **kwargs): class Component(CaselessDict): """Component is the base object for calendar, Event and the other - components defined in RFC 2445. Normally you will not use this class + components defined in RFC 5545. Normally you will not use this class directly, but rather one of the subclasses. """ diff --git a/src/icalendar/parser.py b/src/icalendar/parser.py index ddfcf2d3..10d95ad6 100644 --- a/src/icalendar/parser.py +++ b/src/icalendar/parser.py @@ -1,4 +1,4 @@ -"""This module parses and generates contentlines as defined in RFC 2445 +"""This module parses and generates contentlines as defined in RFC 5545 (iCalendar), but will probably work for other MIME types with similar syntax. Eg. RFC 2426 (vCard) @@ -174,7 +174,7 @@ class Parameters(CaselessDict): """ def params(self): - """In rfc2445 keys are called parameters, so this is to be consitent + """In RFC 5545 keys are called parameters, so this is to be consitent with the naming conventions. """ return self.keys() diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index 2ae5590d..e411f452 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -20,7 +20,7 @@ iCalendar properties have values. The values are strongly typed. This module defines these types, calling val.to_ical() on them will render them as defined -in rfc2445. +in rfc5545. If you pass any of these classes a Python primitive, you will have an object that can render itself as iCalendar formatted date. @@ -928,7 +928,7 @@ def from_ical(cls, ical): class TypesFactory(CaselessDict): - """All Value types defined in rfc 2445 are registered in this factory + """All Value types defined in RFC 5545 are registered in this factory class. The value and parameter names don't overlap. So one factory is enough for diff --git a/src/icalendar/tests/prop/test_unit.py b/src/icalendar/tests/prop/test_unit.py index 9228e6fd..5c302077 100644 --- a/src/icalendar/tests/prop/test_unit.py +++ b/src/icalendar/tests/prop/test_unit.py @@ -223,7 +223,7 @@ def test_prop_vText(self): b'Text with escaped\\n chars') # If you pass a unicode object, it will be utf-8 encoded. As this is - # the (only) standard that RFC 2445 support. + # the (only) standard that RFC 5545 support. t = vText('international chars \xe4\xf6\xfc') self.assertEqual(t.to_ical(), b'international chars \xc3\xa4\xc3\xb6\xc3\xbc') diff --git a/src/icalendar/tests/test_parsing.py b/src/icalendar/tests/test_parsing.py index 940f2457..6aa0fa78 100644 --- a/src/icalendar/tests/test_parsing.py +++ b/src/icalendar/tests/test_parsing.py @@ -134,7 +134,7 @@ def test_no_tzid_when_utc(utc, date, expected_output): https://github.com/collective/icalendar/issues/58 https://github.com/collective/icalendar/issues/335 ''' - # According to RFC 2445: "The TZID property parameter MUST NOT be + # According to RFC 5545: "The TZID property parameter MUST NOT be # applied to DATE-TIME or TIME properties whose time values are # specified in UTC. date = date.replace(tzinfo=utc) diff --git a/src/icalendar/tests/test_unit_cal.py b/src/icalendar/tests/test_unit_cal.py index 007d38b0..933052c7 100644 --- a/src/icalendar/tests/test_unit_cal.py +++ b/src/icalendar/tests/test_unit_cal.py @@ -80,7 +80,7 @@ def test_default_list_example(c): def test_render_component(calendar_component): - """The component can render itself in the RFC 2445 format.""" + """The component can render itself in the RFC 5545 format.""" calendar_component.add('attendee', 'Max M') assert calendar_component.to_ical() == b'BEGIN:VCALENDAR\r\nATTENDEE:Max M\r\nEND:VCALENDAR\r\n' From 06735f79b38d08875ce4ac9ccdf25da8de8da81d Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Fri, 21 Jun 2024 18:58:50 +0100 Subject: [PATCH 07/11] log changes --- CHANGES.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 92b2fc87..e2bace27 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -40,7 +40,8 @@ New features: Bug fixes: -- ... +- Rename RFC 2445 to RFC 5545, see `Issue 278 + `_ 5.0.13 (2024-06-20) ------------------- From 752928cea762a1e89b645428127ca33760b9a69f Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Sat, 22 Jun 2024 17:45:02 +0100 Subject: [PATCH 08/11] rename master to main to make the history of the project easier to understand --- CHANGES.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 34aa2bbf..b49458f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -325,7 +325,7 @@ New features: - No longer test on Python 3.4, 3.5 and PyPy2, because we cannot get it to work. Technically it should still work, it is just no longer tested. Do not expect much development on branch 4.x anymore. - The master branch will be for the remaining Python versions that we support. + The main branch will be for the remaining Python versions that we support. [maurits] Bug fixes: @@ -965,7 +965,7 @@ Fixes: [garbas] - hook out github repository to https://readthedocs.org service so sphinx - documentation is generated on each commit (for master). Documentation can be + documentation is generated on each commit (for main). Documentation can be visible on: https://icalendar.readthedocs.io/en/latest/ [garbas] From f761311997bae9938a3d3d9fa458ae40db5d7b60 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Sat, 22 Jun 2024 18:33:37 +0100 Subject: [PATCH 09/11] Move Python versions into badge --- CHANGES.rst | 1 + README.rst | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 98cc95b0..2f4d292d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,7 @@ Minor changes: - Test that all code works with both ``pytz`` and ``zoneinfo``. - Added missing public classes and functions to API documentation. +- Add version badge Breaking changes: diff --git a/README.rst b/README.rst index 008c2313..5b64a7f6 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,6 @@ files. :Code: https://github.com/collective/icalendar :Mailing list: https://github.com/collective/icalendar/issues :Dependencies: `python-dateutil`_ and `pytz`_. -:Compatible with: Python 2.7 and 3.4+ :License: `BSD`_ ---- @@ -20,6 +19,10 @@ files. :target: https://pypi.org/project/icalendar/ :alt: Python Package Version on PyPI +.. image:: https://img.shields.io/pypi/pyversions/icalendar + :target: https://pypi.org/project/icalendar/ + :alt: PyPI - Python Version + .. image:: https://img.shields.io/pypi/dm/icalendar.svg :target: https://pypi.org/project/icalendar/#files :alt: Downloads from PyPI From 82c669ce8467f3ed049ac44b6c9980f093d7c98d Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Sat, 22 Jun 2024 18:44:26 +0100 Subject: [PATCH 10/11] Remove is_broken property --- CHANGES.rst | 3 +++ src/icalendar/cal.py | 4 ---- src/icalendar/tests/test_components_break_on_bad_ics.py | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 98cc95b0..969f991d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -35,6 +35,9 @@ Breaking changes: - Replaced ``pkg_resources.get_distribution`` with ``importlib.metadata`` in ``docs/conf.py`` to allow building docs on Python 3.12. +- Remove ``is_broken`` property. Use ``errors`` instead to check if a + component had suppressed parsing errors. + See `Issue 424 `_. New features: diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py index 02a1fa6d..9e6e10d5 100644 --- a/src/icalendar/cal.py +++ b/src/icalendar/cal.py @@ -118,10 +118,6 @@ def is_empty(self): """ return True if not (list(self.values()) + self.subcomponents) else False # noqa - @property - def is_broken(self): - return bool(self.errors) - ############################# # handling of property values diff --git a/src/icalendar/tests/test_components_break_on_bad_ics.py b/src/icalendar/tests/test_components_break_on_bad_ics.py index 6ac92aec..a46cfe9a 100644 --- a/src/icalendar/tests/test_components_break_on_bad_ics.py +++ b/src/icalendar/tests/test_components_break_on_bad_ics.py @@ -9,7 +9,6 @@ def test_ignore_exceptions_on_broken_events_issue_104(events): https://github.com/collective/icalendar/issues/104 ''' - assert events.issue_104_mark_events_broken.is_broken # TODO: REMOVE FOR NEXT MAJOR RELEASE assert events.issue_104_mark_events_broken.errors == [(None, "Content line could not be parsed into parts: 'X': Invalid content line")] def test_dont_ignore_exceptions_on_broken_calendars_issue_104(calendars): @@ -23,7 +22,6 @@ def test_rdate_dosent_become_none_on_invalid_input_issue_464(events): '''Issue #464 - [BUG] RDATE can become None if value is invalid https://github.com/collective/icalendar/issues/464 ''' - assert events.issue_464_invalid_rdate.is_broken assert ('RDATE', 'Expected period format, got: 199709T180000Z/PT5H30M') in events.issue_464_invalid_rdate.errors assert not b'RDATE:None' in events.issue_464_invalid_rdate.to_ical() @@ -38,4 +36,3 @@ def test_error_message_doesnt_get_too_big(calendars, calendar_name): calendars[calendar_name] # Ignore part before first : for the test. assert len(str(exception).split(': ', 1)[1]) <= 100 - From ed3508d06f8764b14617deef63c2253c66a1cba6 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Sat, 22 Jun 2024 19:08:47 +0100 Subject: [PATCH 11/11] Remove ... --- CHANGES.rst | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 98cc95b0..2c922de9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -57,10 +57,6 @@ Minor changes: - Document how to serve the built documentation to view with the browser - Improve test coverage -Breaking changes: - -- ... - New features: - Create GitHub releases for each tag. @@ -87,18 +83,8 @@ Minor changes: - Update GitHub Actions steps versions - Keep GitHub Actions up to date with GitHub's Dependabot - -Breaking changes: - -- ... - -New features: - -- ... - Bug fixes: -- ... - Fixed index error in cal.py when attempting to pop from an empty stack - Fixed type error in prop.py when attempting to join strings into a byte-string - Caught Wrong Date Format in ical_fuzzer to resolve fuzzing coverage blocker