Skip to content
Open
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
16 changes: 8 additions & 8 deletions src/nitypes/bintime/_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,14 @@ def __le__(self, value: DateTime | _OtherDateTime, /) -> bool:
else:
return NotImplemented

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if isinstance(value, self.__class__):
return self._offset == value._offset
elif isinstance(value, ht.datetime):
return self._to_hightime_datetime() == value
elif isinstance(value, dt.datetime):
return self == self.__class__(value)
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if isinstance(other, self.__class__):
return self._offset == other._offset
elif isinstance(other, ht.datetime):
return self._to_hightime_datetime() == other
elif isinstance(other, dt.datetime):
return self == self.__class__(other)
else:
return NotImplemented

Expand Down
16 changes: 8 additions & 8 deletions src/nitypes/bintime/_timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,14 +499,14 @@ def __le__(self, value: TimeDelta | _OtherTimeDelta, /) -> bool:
else:
return NotImplemented

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if isinstance(value, self.__class__):
return self._ticks == value._ticks
elif isinstance(value, ht.timedelta):
return self._to_hightime_timedelta() == value
elif isinstance(value, dt.timedelta):
return self == self.__class__(value)
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if isinstance(other, self.__class__):
return self._ticks == other._ticks
elif isinstance(other, ht.timedelta):
return self._to_hightime_timedelta() == other
elif isinstance(other, dt.timedelta):
return self == self.__class__(other)
else:
return NotImplemented

Expand Down
8 changes: 4 additions & 4 deletions src/nitypes/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ def insert(self, index: int, value: TScalar) -> None:
raise self._create_value_mismatch_exception(value)
self._values.insert(index, value)

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return self._values == value._values and self.units == value.units
return self._values == other._values and self.units == other.units

def __reduce__(self) -> tuple[Any, ...]:
"""Return object state for pickling."""
Expand Down
8 changes: 4 additions & 4 deletions src/nitypes/waveform/_digital/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def name(self) -> str:
def name(self, value: str) -> None:
self._owner._set_line_name(self._column_index, value)

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
# Do not compare the index or name.
return np.array_equal(self.data, value.data)
return np.array_equal(self.data, other.data)

def __reduce__(self) -> tuple[Any, ...]:
"""Return object state for pickling."""
Expand Down
14 changes: 7 additions & 7 deletions src/nitypes/waveform/_digital/_waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,15 +1362,15 @@ def _reverse_index(self, index: int) -> int:
assert 0 <= index < self.signal_count
return self.signal_count - 1 - index

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return (
self.dtype == value.dtype
and np.array_equal(self.data, value.data)
and self._extended_properties == value._extended_properties
and self._timing == value._timing
self.dtype == other.dtype
and np.array_equal(self.data, other.data)
and self._extended_properties == other._extended_properties
and self._timing == other._timing
)

def __reduce__(self) -> tuple[Any, ...]:
Expand Down
16 changes: 8 additions & 8 deletions src/nitypes/waveform/_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,16 +734,16 @@ def _load_array(
self._start_index = start_index
self._sample_count = sample_count

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return (
self.dtype == value.dtype
and np.array_equal(self.raw_data, value.raw_data)
and self._extended_properties == value._extended_properties
and self._timing == value._timing
and self._scale_mode == value._scale_mode
self.dtype == other.dtype
and np.array_equal(self.raw_data, other.raw_data)
and self._extended_properties == other._extended_properties
and self._timing == other._timing
and self._scale_mode == other._scale_mode
)

def __reduce__(self) -> tuple[Any, ...]:
Expand Down
8 changes: 4 additions & 4 deletions src/nitypes/waveform/_scaling/_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def _transform_data(self, data: npt.NDArray[_ScalarType]) -> npt.NDArray[_Scalar
# npt.NDArray[np.float32] with a float promotes dtype to Any or np.float64
return data * self._gain + self._offset # type: ignore[operator,no-any-return]

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return self._gain == value._gain and self._offset == value._offset
return self._gain == other._gain and self._offset == other._offset

def __repr__(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/nitypes/waveform/_scaling/_none.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class NoneScaleMode(ScaleMode):
def _transform_data(self, data: npt.NDArray[_ScalarType]) -> npt.NDArray[_ScalarType]:
return data

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return True

Expand Down
16 changes: 8 additions & 8 deletions src/nitypes/waveform/_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,16 +742,16 @@ def _load_array(
self._start_index = start_index
self._sample_count = sample_count

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return (
self.dtype == value.dtype
and np.array_equal(self.data, value.data)
and self.start_frequency == value.start_frequency
and self.frequency_increment == value.frequency_increment
and self._extended_properties == value._extended_properties
self.dtype == other.dtype
and np.array_equal(self.data, other.data)
and self.start_frequency == other.start_frequency
and self.frequency_increment == other.frequency_increment
and self._extended_properties == other._extended_properties
)

def __reduce__(self) -> tuple[Any, ...]:
Expand Down
16 changes: 8 additions & 8 deletions src/nitypes/waveform/_timing/_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ def _convert(
),
)

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return (
self._timestamp == value._timestamp
and self._time_offset == value._time_offset
and self._sample_interval == value._sample_interval
and self._sample_interval_mode == value._sample_interval_mode
and self._timestamps == value._timestamps
self._timestamp == other._timestamp
and self._time_offset == other._time_offset
and self._sample_interval == other._sample_interval
and self._sample_interval_mode == other._sample_interval_mode
and self._timestamps == other._timestamps
)

def __reduce__(self) -> tuple[Any, ...]:
Expand Down
14 changes: 7 additions & 7 deletions src/nitypes/xy_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,15 @@ def extended_properties(self) -> ExtendedPropertyDictionary:
"""
return self._extended_properties

def __eq__(self, value: object, /) -> bool:
"""Return self==value."""
if not isinstance(value, self.__class__):
def __eq__(self, other: object, /) -> bool:
"""Return self == other."""
if not isinstance(other, self.__class__):
return NotImplemented
return (
np.array_equal(self.x_data, value.x_data)
and np.array_equal(self.y_data, value.y_data)
and self.x_units == value.x_units
and self.y_units == value.y_units
np.array_equal(self.x_data, other.x_data)
and np.array_equal(self.y_data, other.y_data)
and self.x_units == other.x_units
and self.y_units == other.y_units
)

def __reduce__(self) -> tuple[Any, ...]:
Expand Down