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 .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
# This ensures that the runner has access to the pip cache.
- name: Reset pip cache ownership
if: always()
run: sudo chown -R $USER:$USER /tmp/pip-cache
run: if [[ -e /tmp/pip-cache ]]; then sudo chown -R $USER:$USER /tmp/pip-cache; fi

# This job runs if all the `nox-cross-arch` matrix jobs ran and succeeded.
# As the `nox-all` job, its main purpose is to provide a single point of
Expand Down
11 changes: 9 additions & 2 deletions src/frequenz/sdk/timeseries/_base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ def __ge__(self, other: Any, /) -> bool:

@dataclass(frozen=True)
class Bounds(Generic[_T]):
"""Lower and upper bound values."""
"""Lower and upper bound values.

Depending on the genertic type `_T`, the lower and upper bounds can be `None`, in
which case it means that there is no lower or upper bound, respectively.

When checking if an item is within the bounds, the item must always be not `None`.
"""

lower: _T
"""Lower bound."""
Expand All @@ -178,11 +184,12 @@ def __contains__(self, item: _T) -> bool:
Check if the value is within the range of the container.

Args:
item: The value to check.
item: The value to check. Can't be `None` even if `_T` can be `None`.

Returns:
bool: True if value is within the range, otherwise False.
"""
assert item is not None, "Can't check if `None` is within the bounds."
if self.lower is None and self.upper is None:
return True
if self.lower is None:
Expand Down
Loading