Skip to content

Commit

Permalink
Remove len magic from moving window
Browse files Browse the repository at this point in the history
Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
  • Loading branch information
cwasicki committed Sep 14, 2023
1 parent 992632a commit 7dc661f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- Provide access to `capacity` (maximum number of elements) in `MovingWindow`.
- Methods to retrieve oldest and newest timestamp of valid samples are added to both.
- `MovingWindow` exposes underlying buffers `window` method.
- `len(window)` and `len(buffer)` should be replaced with `window.count_valid()` and `buffer.count_valid()`, respectively.
- `OrderedRingBuffer.window`:
- By default returns a copy.
- Can also return a view if the window contains `None` values and if `force_copy` is set to `True`.
Expand Down
9 changes: 0 additions & 9 deletions src/frequenz/sdk/timeseries/_moving_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,6 @@ def count_valid(self) -> int:
"""
return self._buffer.count_valid()

def __len__(self) -> int:
"""
Return the size of the `MovingWindow`s underlying buffer.
Returns:
The size of the `MovingWindow`.
"""
return self.count_valid()

@overload
def __getitem__(self, key: SupportsIndex) -> float:
"""See the main __getitem__ method.
Expand Down

0 comments on commit 7dc661f

Please sign in to comment.