From 8263e85ddde59e4eb8f8030847f99056c187c6af Mon Sep 17 00:00:00 2001 From: arjunrawal1 Date: Mon, 4 May 2026 13:14:42 -0400 Subject: [PATCH 1/2] Add type hints to vFrequency Refs #938 Assisted-by: OpenAI Codex --- src/icalendar/prop/recur/frequency.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/icalendar/prop/recur/frequency.py b/src/icalendar/prop/recur/frequency.py index 91b13b5c5..d72e7239c 100644 --- a/src/icalendar/prop/recur/frequency.py +++ b/src/icalendar/prop/recur/frequency.py @@ -29,11 +29,11 @@ class vFrequency(str): def __new__( cls, - value, - encoding=DEFAULT_ENCODING, + value: Any, + encoding: str = DEFAULT_ENCODING, /, params: dict[str, Any] | None = None, - ): + ) -> Self: value = to_unicode(value, encoding=encoding) self = super().__new__(cls, value) if self not in vFrequency.frequencies: @@ -41,11 +41,11 @@ def __new__( self.params = Parameters(params) return self - def to_ical(self): + def to_ical(self) -> bytes: return self.encode(DEFAULT_ENCODING).upper() @classmethod - def from_ical(cls, ical): + def from_ical(cls, ical: Any) -> Self: try: return cls(ical.upper()) except Exception as e: From d2aa8ef5beb879b4333ac6fdb61a9e4bfe3843b4 Mon Sep 17 00:00:00 2001 From: arjunrawal1 Date: Mon, 4 May 2026 13:16:28 -0400 Subject: [PATCH 2/2] Add changelog entry for vFrequency type hints Refs #938 Assisted-by: OpenAI Codex --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8b5040c01..4500c858e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,7 +10,7 @@ Change log Minor changes ~~~~~~~~~~~~~ -- ... +- Add type hints to :class:`~icalendar.prop.recur.frequency.vFrequency`. :issue:`938` Breaking changes ~~~~~~~~~~~~~~~~