Skip to content

Commit

Permalink
Fix ImmutableList comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed Dec 21, 2023
1 parent 7060f19 commit 6003f09
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions snakebids/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,32 +474,24 @@ def __getitem__(self, index: int | slice) -> _T_co | Self:
return self._data[index]

def __lt__(self, value: tuple[_T_co, ...] | Self, /) -> bool:
if isinstance(value, tuple):
return self._data < value
if isinstance(value, ImmutableList):
return self._data < value._data
return False
return self._data < value

def __le__(self, value: tuple[_T_co, ...] | Self, /) -> bool:
if isinstance(value, tuple):
return self._data <= value
if isinstance(value, ImmutableList):
return self._data <= value._data
return False
return self._data <= value

def __gt__(self, value: tuple[_T_co, ...] | Self, /) -> bool:
if isinstance(value, tuple):
return self._data > value
if isinstance(value, ImmutableList):
return self._data > value._data
return False
return self._data > value

def __ge__(self, value: tuple[_T_co, ...] | Self, /) -> bool:
if isinstance(value, tuple):
return self._data >= value
if isinstance(value, ImmutableList):
return self._data >= value._data
return False
return self._data >= value

@override
def __eq__(self, value: object, /) -> bool:
Expand Down

0 comments on commit 6003f09

Please sign in to comment.