diff --git a/news/938.chore.13 b/news/938.chore.13 new file mode 100644 index 000000000..5bbfae207 --- /dev/null +++ b/news/938.chore.13 @@ -0,0 +1 @@ +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 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 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, diff --git a/src/icalendar/timezone/zoneinfo.py b/src/icalendar/timezone/zoneinfo.py index 3cc969ccd..5daa04c8b 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,9 @@ 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 +166,13 @@ 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: