Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/icalendar/attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def view(event: Event) -> str:
{description}"""


def main():
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)

parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/fuzzing/ical_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def TestOneInput(data):
print("--- end calendar ---")


def main():
def main() -> None:
atheris.Setup(sys.argv, TestOneInput)
atheris.Fuzz()

Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/parser/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/parser/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/icalendar/timezone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
8 changes: 4 additions & 4 deletions src/icalendar/timezone/zoneinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ 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


copyreg.pickle(_tzicalvtz, pickle_tzicalvtz)


def pickle_rrule_with_cache(self: rrule):
def pickle_rrule_with_cache(self: rrule) -> tuple[functools.partial, tuple]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more usefull type than functools.partial and tuple.

"""Make sure we can also pickle rrules that cache.

This is mainly copied from rrule.replace.
Expand All @@ -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]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more usefull type than tuple.

"""Pickle an rruleset."""
return unpickle_rruleset_with_cache, (
rs._rrule, # noqa: SLF001
Expand All @@ -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:
Expand Down
Loading