Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
10 changes: 8 additions & 2 deletions src/frequenz/client/dispatch/recurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -208,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,
Expand Down
Loading