diff --git a/src/icalendar/attr.py b/src/icalendar/attr.py index 545f66c48..2b15d6b07 100644 --- a/src/icalendar/attr.py +++ b/src/icalendar/attr.py @@ -989,7 +989,7 @@ def property_get_duration(self: Component) -> timedelta | None: return result -def property_set_duration(self: Component, value: timedelta | None): +def property_set_duration(self: Component, value: timedelta | None) -> None: """Setter for property DURATION.""" if value is None: self.pop("duration", None) @@ -1001,7 +1001,7 @@ def property_set_duration(self: Component, value: timedelta | None): self.pop("DUE") -def property_del_duration(self: Component): +def property_del_duration(self: Component) -> None: """Delete property DURATION.""" self.pop("DURATION") @@ -1498,7 +1498,7 @@ def fset(self: Component, value: str | StrEnum | None) -> None: ) -def timezone_datetime_property(name: str, docs: str): +def timezone_datetime_property(name: str, docs: str) -> property: """Create a property to access the values with a proper timezone.""" return single_utc_property(name, docs) @@ -1583,12 +1583,12 @@ def rfc_7953_end_property(self) -> timedelta | None: @rfc_7953_end_property.setter -def rfc_7953_end_property(self, value: datetime): +def rfc_7953_end_property(self, value: datetime) -> None: self.DTEND = value @rfc_7953_end_property.deleter -def rfc_7953_end_property(self): +def rfc_7953_end_property(self) -> None: del self.DTEND @@ -2376,7 +2376,7 @@ def _del_concepts(self: Component): concepts_property = property(_get_concepts, _set_concepts, _del_concepts) -def multi_string_property(name: str, doc: str): +def multi_string_property(name: str, doc: str) -> property: """A property for an iCalendar Property that can occur multiple times.""" def fget(self: Component) -> list[str]: diff --git a/src/icalendar/cli.py b/src/icalendar/cli.py index 255757004..e3d444a7c 100755 --- a/src/icalendar/cli.py +++ b/src/icalendar/cli.py @@ -86,7 +86,7 @@ def view(event: Event) -> str: {description}""" -def main(): +def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( diff --git a/src/icalendar/fuzzing/ical_fuzzer.py b/src/icalendar/fuzzing/ical_fuzzer.py index a2d776099..63ceb6773 100755 --- a/src/icalendar/fuzzing/ical_fuzzer.py +++ b/src/icalendar/fuzzing/ical_fuzzer.py @@ -50,7 +50,7 @@ def TestOneInput(data): print("--- end calendar ---") -def main(): +def main() -> None: atheris.Setup(sys.argv, TestOneInput) atheris.Fuzz() diff --git a/src/icalendar/parser/parameter.py b/src/icalendar/parser/parameter.py index 08a135231..e3517d4da 100644 --- a/src/icalendar/parser/parameter.py +++ b/src/icalendar/parser/parameter.py @@ -189,7 +189,7 @@ def q_join(lst: Sequence[str], sep: str = ",", always_quote: bool = False) -> st return sep.join(dquote(itm, always_quote=always_quote) for itm in lst) -def single_string_parameter(func: Callable | None = None, upper=False): +def single_string_parameter(func: Callable | None = None, upper=False) -> Callable | property: """Create a parameter getter/setter for a single string parameter. Parameters: diff --git a/src/icalendar/parser/property.py b/src/icalendar/parser/property.py index 6efca840a..91f12bb80 100644 --- a/src/icalendar/parser/property.py +++ b/src/icalendar/parser/property.py @@ -25,7 +25,7 @@ def unescape_list_or_string(val: str | list[str]) -> str | list[str]: _unescape_backslash_regex = re.compile(r"\\([\\,;:nN])") -def unescape_backslash(val: str): +def unescape_backslash(val: str) -> str: r"""Unescape backslash sequences in iCalendar text. Unlike :py:meth:`unescape_string`, this only handles actual backslash escapes diff --git a/src/icalendar/timezone/__init__.py b/src/icalendar/timezone/__init__.py index 0c94cbd49..f8168232d 100644 --- a/src/icalendar/timezone/__init__.py +++ b/src/icalendar/timezone/__init__.py @@ -6,12 +6,12 @@ tzp = TZP() -def use_pytz(): +def use_pytz() -> None: """Use pytz as the implementation that looks up and creates timezones.""" tzp.use_pytz() -def use_zoneinfo(): +def use_zoneinfo() -> None: """Use zoneinfo as the implementation that looks up and creates timezones.""" tzp.use_zoneinfo() diff --git a/src/icalendar/timezone/zoneinfo.py b/src/icalendar/timezone/zoneinfo.py index 24733a4cc..72f8cb820 100644 --- a/src/icalendar/timezone/zoneinfo.py +++ b/src/icalendar/timezone/zoneinfo.py @@ -120,7 +120,7 @@ def uses_zoneinfo(self) -> bool: return True -def pickle_tzicalvtz(tzicalvtz: _tzicalvtz): +def pickle_tzicalvtz(tzicalvtz: _tzicalvtz) -> tuple[type[_tzicalvtz], tuple]: """Because we use dateutil.tzical, we need to make it pickle-able.""" return _tzicalvtz, (tzicalvtz._tzid, tzicalvtz._comps) # noqa: SLF001 @@ -128,7 +128,7 @@ def pickle_tzicalvtz(tzicalvtz: _tzicalvtz): copyreg.pickle(_tzicalvtz, pickle_tzicalvtz) -def pickle_rrule_with_cache(self: rrule): +def pickle_rrule_with_cache(self: rrule) -> tuple[functools.partial, tuple]: """Make sure we can also pickle rrules that cache. This is mainly copied from rrule.replace. @@ -150,7 +150,7 @@ def pickle_rrule_with_cache(self: rrule): copyreg.pickle(rrule, pickle_rrule_with_cache) -def pickle_rruleset_with_cache(rs: rruleset): +def pickle_rruleset_with_cache(rs: rruleset) -> tuple[type[unpickle_rruleset_with_cache], tuple]: """Pickle an rruleset.""" return unpickle_rruleset_with_cache, ( rs._rrule, # noqa: SLF001 @@ -161,7 +161,7 @@ def pickle_rruleset_with_cache(rs: rruleset): ) -def unpickle_rruleset_with_cache(rrule, rdate, exrule, exdate, cache): +def unpickle_rruleset_with_cache(rrule, rdate, exrule, exdate, cache) -> rruleset: """unpickling the rruleset.""" rs = rruleset(cache) for o in rrule: