Skip to content

Commit 7dc661f

Browse files
committed
Remove len magic from moving window
Signed-off-by: cwasicki <[email protected]>
1 parent 992632a commit 7dc661f

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- Provide access to `capacity` (maximum number of elements) in `MovingWindow`.
4646
- Methods to retrieve oldest and newest timestamp of valid samples are added to both.
4747
- `MovingWindow` exposes underlying buffers `window` method.
48+
- `len(window)` and `len(buffer)` should be replaced with `window.count_valid()` and `buffer.count_valid()`, respectively.
4849
- `OrderedRingBuffer.window`:
4950
- By default returns a copy.
5051
- Can also return a view if the window contains `None` values and if `force_copy` is set to `True`.

src/frequenz/sdk/timeseries/_moving_window.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,6 @@ def count_valid(self) -> int:
315315
"""
316316
return self._buffer.count_valid()
317317

318-
def __len__(self) -> int:
319-
"""
320-
Return the size of the `MovingWindow`s underlying buffer.
321-
322-
Returns:
323-
The size of the `MovingWindow`.
324-
"""
325-
return self.count_valid()
326-
327318
@overload
328319
def __getitem__(self, key: SupportsIndex) -> float:
329320
"""See the main __getitem__ method.

0 commit comments

Comments
 (0)