Skip to content

Commit 5a9002f

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 <mathias.baumann@frequenz.com>
1 parent 12330a5 commit 5a9002f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
## New Features
1212

13+
* Changed `target_components`, `dispatch_ids`, and `filter_queries` parameters from `Iterator` to `Iterable` in `list` method for better API usability
1314
* Added support for `dispatch_ids` and `queries` filters in the `list` method
1415
- `dispatch_ids` parameter allows filtering by specific dispatch IDs
1516
- `filter_queries` parameter supports text-based filtering on dispatch `id` and `type` fields
@@ -18,4 +19,3 @@
1819
* Date-only inputs in CLI timestamps now default to midnight UTC instead of using the current time.
1920

2021
## Bug Fixes
21-

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)