Skip to content

Commit f971cb2

Browse files
committed
Fix: Change list method parameters from Iterator to Iterable for better API usability
- Changed target_components, dispatch_ids, and filter_queries parameters from Iterator to Iterable in the list method - This allows users to pass any iterable (list, tuple, generator, etc.) instead of requiring specific iterator types - Improves API flexibility and usability Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 12330a5 commit f971cb2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919

2020
## Bug Fixes
2121

22+
* Changed `target_components`, `dispatch_ids`, and `filter_queries` parameters from `Iterator` to `Iterable` in `list` method for better API usability

src/frequenz/client/dispatch/_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import warnings
88
from datetime import datetime, timedelta
9-
from typing import Any, AsyncIterator, Awaitable, Iterator, Literal, cast
9+
from typing import Any, AsyncIterator, Awaitable, Iterable, Iterator, Literal, cast
1010

1111
# pylint: disable-next=no-name-in-module
1212
from frequenz.api.common.v1alpha8.pagination.pagination_params_pb2 import (
@@ -138,15 +138,15 @@ async def list(
138138
self,
139139
microgrid_id: MicrogridId,
140140
*,
141-
target_components: Iterator[TargetComponents] = iter(()),
141+
target_components: Iterable[TargetComponents] = (),
142142
start_from: datetime | None = None,
143143
start_to: datetime | None = None,
144144
end_from: datetime | None = None,
145145
end_to: datetime | None = None,
146146
active: bool | None = None,
147147
dry_run: bool | None = None,
148-
dispatch_ids: Iterator[DispatchId] = iter(()),
149-
filter_queries: Iterator[str] = iter(()),
148+
dispatch_ids: Iterable[DispatchId] = (),
149+
filter_queries: Iterable[str] = (),
150150
page_size: int | None = None,
151151
) -> AsyncIterator[Iterator[Dispatch]]:
152152
"""List dispatches.

0 commit comments

Comments
 (0)