From 0f36327fd05f8ea42deb0f0ed19643d7ce845b70 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Aug 2025 10:33:56 +0000 Subject: [PATCH 1/3] Bump types-python-dateutil from 2.9.0.20250516 to 2.9.0.20250708 Bumps [types-python-dateutil](https://github.com/typeshed-internal/stub_uploader) from 2.9.0.20250516 to 2.9.0.20250708. - [Commits](https://github.com/typeshed-internal/stub_uploader/commits) --- updated-dependencies: - dependency-name: types-python-dateutil dependency-version: 2.9.0.20250708 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7b1c7e7f..cf135e50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ dev-mypy = [ "frequenz-client-dispatch[cli,dev-mkdocs,dev-noxfile,dev-pytest]", "grpc-stubs == 1.53.0.6", "types-protobuf == 6.30.2.20250703", - "types-python-dateutil == 2.9.0.20250516", + "types-python-dateutil == 2.9.0.20250708", ] dev-noxfile = ["nox == 2025.5.1", "frequenz-repo-config[lib] == 0.13.5"] dev-pylint = [ From fa34e2a2426a8a9c5b1755172c66e15a6b921087 Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Mon, 25 Aug 2025 15:48:56 +0200 Subject: [PATCH 2/3] Add exception for UNSPECIFIED frequency in RecurrenceRule Signed-off-by: Mathias L. Baumann --- src/frequenz/client/dispatch/recurrence.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frequenz/client/dispatch/recurrence.py b/src/frequenz/client/dispatch/recurrence.py index fef1993d..48a3d300 100644 --- a/src/frequenz/client/dispatch/recurrence.py +++ b/src/frequenz/client/dispatch/recurrence.py @@ -197,8 +197,11 @@ def _as_rrule(self, start_time: datetime) -> rrule.rrule: The rrule object. Raises: - ValueError: If the interval is 0. + ValueError: If the interval is 0 or the frequency is UNSPECIFIED. """ + if self.frequency == Frequency.UNSPECIFIED: + raise ValueError("Frequency must be specified") + if self.interval == 0: raise ValueError("Interval must be greater than 0") From f6489a7b06b4e20eb3d64f9ab218a6b2b8ce78e7 Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Mon, 25 Aug 2025 15:49:09 +0200 Subject: [PATCH 3/3] Ignore mypy error about rrule frequency type Mypy expects a Literal for the `freq` argument of `rrule.rrule`, but it can't infer that the values from the `_RRULE_FREQ_MAP` dictionary are of the correct type. We add a `# type: ignore[arg-type]` comment to suppress the error. Signed-off-by: Mathias L. Baumann --- src/frequenz/client/dispatch/recurrence.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frequenz/client/dispatch/recurrence.py b/src/frequenz/client/dispatch/recurrence.py index 48a3d300..2c62bd22 100644 --- a/src/frequenz/client/dispatch/recurrence.py +++ b/src/frequenz/client/dispatch/recurrence.py @@ -211,7 +211,10 @@ def _as_rrule(self, start_time: datetime) -> rrule.rrule: until = end.until rrule_obj = rrule.rrule( - freq=_RRULE_FREQ_MAP[self.frequency], + # Mypy expects a Literal for the `freq` argument, but it can't infer + # that the values from the `_RRULE_FREQ_MAP` dictionary are of the + # correct type. + freq=_RRULE_FREQ_MAP[self.frequency], # type: ignore[arg-type] dtstart=start_time, count=count, until=until,