Skip to content

Commit

Permalink
Regenerate _typed_ops after adding "unhashable"
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Nov 9, 2023
1 parent d5d9e95 commit 2bc7ef6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions xarray/core/_typed_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def __eq__(self, other: DsCompatible) -> Self: # type:ignore[override]
def __ne__(self, other: DsCompatible) -> Self: # type:ignore[override]
return self._binary_op(other, nputils.array_ne)

# When __eq__ is defined but __hash__ is not, then an object is unhashable,
# and it should be declared as follows:
__hash__: None # type:ignore[assignment]

def __radd__(self, other: DsCompatible) -> Self:
return self._binary_op(other, operator.add, reflexive=True)

Expand Down Expand Up @@ -291,6 +295,10 @@ def __eq__(self, other: DaCompatible) -> Self: # type:ignore[override]
def __ne__(self, other: DaCompatible) -> Self: # type:ignore[override]
return self._binary_op(other, nputils.array_ne)

# When __eq__ is defined but __hash__ is not, then an object is unhashable,
# and it should be declared as follows:
__hash__: None # type:ignore[assignment]

def __radd__(self, other: DaCompatible) -> Self:
return self._binary_op(other, operator.add, reflexive=True)

Expand Down Expand Up @@ -851,6 +859,10 @@ def __eq__(self, other: GroupByCompatible) -> Dataset: # type:ignore[override]
def __ne__(self, other: GroupByCompatible) -> Dataset: # type:ignore[override]
return self._binary_op(other, nputils.array_ne)

# When __eq__ is defined but __hash__ is not, then an object is unhashable,
# and it should be declared as follows:
__hash__: None # type:ignore[assignment]

def __radd__(self, other: GroupByCompatible) -> Dataset:
return self._binary_op(other, operator.add, reflexive=True)

Expand Down Expand Up @@ -973,6 +985,10 @@ def __eq__(self, other: T_Xarray) -> T_Xarray: # type:ignore[override]
def __ne__(self, other: T_Xarray) -> T_Xarray: # type:ignore[override]
return self._binary_op(other, nputils.array_ne)

# When __eq__ is defined but __hash__ is not, then an object is unhashable,
# and it should be declared as follows:
__hash__: None # type:ignore[assignment]

def __radd__(self, other: T_Xarray) -> T_Xarray:
return self._binary_op(other, operator.add, reflexive=True)

Expand Down

0 comments on commit 2bc7ef6

Please sign in to comment.