From 5ce4994872e423bb10d1c7737182b36029592992 Mon Sep 17 00:00:00 2001 From: YTLim-1206 Date: Tue, 17 Nov 2026 21:24:59 +0800 Subject: [PATCH 1/5] Add return type hint to _add_equivalent_ids --- news/news/938.chore.13 | 1 + src/icalendar/timezone/tzid.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 news/news/938.chore.13 diff --git a/news/news/938.chore.13 b/news/news/938.chore.13 new file mode 100644 index 000000000..282f70f0a --- /dev/null +++ b/news/news/938.chore.13 @@ -0,0 +1 @@ +Added a return type hint to _add_equivalent_ids. I used GPT-6 to identify the untyped function and verify the correct hint against its usage. @YTLim-1206 \ No newline at end of file diff --git a/src/icalendar/timezone/tzid.py b/src/icalendar/timezone/tzid.py index 304291ffd..46f329dac 100644 --- a/src/icalendar/timezone/tzid.py +++ b/src/icalendar/timezone/tzid.py @@ -101,7 +101,7 @@ def tzid_from_dt(dt: datetime | time) -> str | None: _EQUIVALENT_IDS: dict[str, set[str]] = defaultdict(set) -def _add_equivalent_ids(value: tuple | dict | set): +def _add_equivalent_ids(value: tuple | dict | set) -> None: """This adds equivalent ids/ As soon as one timezone implementation used claims their equivalence, From 4f8ccbb30987f02f60a0e194c46a015b81156683 Mon Sep 17 00:00:00 2001 From: YTLim-1206 Date: Tue, 17 Nov 2026 21:51:42 +0800 Subject: [PATCH 2/5] Add return type hint to set_value, del_value --- news/938.chore.13 | 1 + src/icalendar/param.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 news/938.chore.13 diff --git a/news/938.chore.13 b/news/938.chore.13 new file mode 100644 index 000000000..8bd3272d6 --- /dev/null +++ b/news/938.chore.13 @@ -0,0 +1 @@ +Added return type hints to _add_equivalent_ids, _set_value, and _del_value. I used GPT-6 to identify the untyped functions and verify the correct hints against their usage. @YTLim-1206 \ No newline at end of file diff --git a/src/icalendar/param.py b/src/icalendar/param.py index bca86330f..1d9e1f90c 100644 --- a/src/icalendar/param.py +++ b/src/icalendar/param.py @@ -612,12 +612,12 @@ def _get_value(self: VPROPERTY) -> str: return self.default_value if value is None else value -def _set_value(self: VPROPERTY, value: str | None): +def _set_value(self: VPROPERTY, value: str | None) -> None: """Set the VALUE parameter.""" self.params.value = value -def _del_value(self: VPROPERTY): +def _del_value(self: VPROPERTY) -> None: """Delete the VALUE parameter.""" del self.params.value From 0a6065055c28870fbf082f41295f898d39015208 Mon Sep 17 00:00:00 2001 From: YTLim-1206 Date: Tue, 17 Nov 2026 22:38:29 +0800 Subject: [PATCH 3/5] Add type hint to pickle_tzicalvtz and unpickle_rruleset_with_cache --- news/938.chore.13 | 2 +- src/icalendar/timezone/zoneinfo.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/news/938.chore.13 b/news/938.chore.13 index 8bd3272d6..0603dcd97 100644 --- a/news/938.chore.13 +++ b/news/938.chore.13 @@ -1 +1 @@ -Added return type hints to _add_equivalent_ids, _set_value, and _del_value. I used GPT-6 to identify the untyped functions and verify the correct hints against their usage. @YTLim-1206 \ No newline at end of file +Added return type hints to _add_equivalent_ids, _set_value, _del_value, pickle_tzicalvtz, pickle_rrule_with_cache, and pickle_rruleset_with_cache. I used GPT-6 to help identify untyped functions, trace their data types through the codebase, and verify the correct hints against their usage. @YTLim-1206 \ No newline at end of file diff --git a/src/icalendar/timezone/zoneinfo.py b/src/icalendar/timezone/zoneinfo.py index 3cc969ccd..e1334ceb5 100644 --- a/src/icalendar/timezone/zoneinfo.py +++ b/src/icalendar/timezone/zoneinfo.py @@ -13,7 +13,7 @@ from dateutil.rrule import rrule, rruleset from dateutil.tz import tzical -from dateutil.tz.tz import _tzicalvtz +from dateutil.tz.tz import _tzicalvtz, _tzicalvtzcomp from icalendar.tools import is_date, to_datetime @@ -123,7 +123,7 @@ def uses_zoneinfo(self) -> bool: return True -def pickle_tzicalvtz(tzicalvtz: _tzicalvtz): +def pickle_tzicalvtz(tzicalvtz: _tzicalvtz) -> tuple[type[_tzicalvtz], tuple[str, list[_tzicalvtzcomp]]]: """Because we use dateutil.tzical, we need to make it pickle-able.""" return _tzicalvtz, (tzicalvtz._tzid, tzicalvtz._comps) # noqa: SLF001 @@ -164,7 +164,7 @@ def pickle_rruleset_with_cache(rs: rruleset): ) -def unpickle_rruleset_with_cache(rrule, rdate, exrule, exdate, cache): +def unpickle_rruleset_with_cache(rrule: list[rrule], rdate: list[datetime], exrule: list[rrule], exdate: list[datetime], cache: bool) -> rruleset: """unpickling the rruleset.""" rs = rruleset(cache) for o in rrule: From fcdc987c558ae60a6ac0a90a5f470b50fd1013e6 Mon Sep 17 00:00:00 2001 From: YTLim-1206 Date: Tue, 17 Nov 2026 22:48:15 +0800 Subject: [PATCH 4/5] change log --- news/938.chore.13 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/938.chore.13 b/news/938.chore.13 index 0603dcd97..5bbfae207 100644 --- a/news/938.chore.13 +++ b/news/938.chore.13 @@ -1 +1 @@ -Added return type hints to _add_equivalent_ids, _set_value, _del_value, pickle_tzicalvtz, pickle_rrule_with_cache, and pickle_rruleset_with_cache. I used GPT-6 to help identify untyped functions, trace their data types through the codebase, and verify the correct hints against their usage. @YTLim-1206 \ No newline at end of file +Added return type hints to _add_equivalent_ids, _set_value, _del_value, pickle_tzicalvtz, and unpickle_rruleset_with_cache. I used GPT-6 to help identify untyped functions, trace their data types through the codebase, and verify the correct hints against their usage. @YTLim-1206 \ No newline at end of file From fb3dd93b32fd2381d50f9a11b51a1fee04bb0aff Mon Sep 17 00:00:00 2001 From: YTLim-1206 Date: Tue, 17 Nov 2026 23:22:42 +0800 Subject: [PATCH 5/5] Fix ruff formatting and log dir error --- news/news/938.chore.13 | 1 - src/icalendar/timezone/zoneinfo.py | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) delete mode 100644 news/news/938.chore.13 diff --git a/news/news/938.chore.13 b/news/news/938.chore.13 deleted file mode 100644 index 282f70f0a..000000000 --- a/news/news/938.chore.13 +++ /dev/null @@ -1 +0,0 @@ -Added a return type hint to _add_equivalent_ids. I used GPT-6 to identify the untyped function and verify the correct hint against its usage. @YTLim-1206 \ No newline at end of file diff --git a/src/icalendar/timezone/zoneinfo.py b/src/icalendar/timezone/zoneinfo.py index e1334ceb5..5daa04c8b 100644 --- a/src/icalendar/timezone/zoneinfo.py +++ b/src/icalendar/timezone/zoneinfo.py @@ -123,7 +123,9 @@ def uses_zoneinfo(self) -> bool: return True -def pickle_tzicalvtz(tzicalvtz: _tzicalvtz) -> tuple[type[_tzicalvtz], tuple[str, list[_tzicalvtzcomp]]]: +def pickle_tzicalvtz( + tzicalvtz: _tzicalvtz, +) -> tuple[type[_tzicalvtz], tuple[str, list[_tzicalvtzcomp]]]: """Because we use dateutil.tzical, we need to make it pickle-able.""" return _tzicalvtz, (tzicalvtz._tzid, tzicalvtz._comps) # noqa: SLF001 @@ -164,7 +166,13 @@ def pickle_rruleset_with_cache(rs: rruleset): ) -def unpickle_rruleset_with_cache(rrule: list[rrule], rdate: list[datetime], exrule: list[rrule], exdate: list[datetime], cache: bool) -> rruleset: +def unpickle_rruleset_with_cache( + rrule: list[rrule], + rdate: list[datetime], + exrule: list[rrule], + exdate: list[datetime], + cache: bool, +) -> rruleset: """unpickling the rruleset.""" rs = rruleset(cache) for o in rrule: