Skip to content

Commit

Permalink
🐛 fix(arrayish): enable add -> radd (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
nstarman authored Feb 7, 2025
1 parent 1d15e61 commit 973ddd7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/quaxed/experimental/_arrayish/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ class LaxAddMixin(Generic[T, R]):
"""

def __add__(self, other: T) -> R:
return qlax.add(self, other)
try:
return qlax.add(self, other)
except Exception: # noqa: BLE001
return NotImplemented


class NumpyAddMixin(Generic[T, R]):
Expand All @@ -126,7 +129,10 @@ class NumpyAddMixin(Generic[T, R]):
"""

def __add__(self, other: T) -> R:
return qnp.add(self, other)
try:
return qnp.add(self, other)
except Exception: # noqa: BLE001
return NotImplemented


# -------------------------------------
Expand All @@ -152,7 +158,10 @@ class LaxRAddMixin(Generic[T, R]):
"""

def __radd__(self, other: T) -> R:
return qlax.add(other, self)
try:
return qlax.add(other, self)
except Exception: # noqa: BLE001
return NotImplemented


class NumpyRAddMixin(Generic[T, R]):
Expand All @@ -174,7 +183,10 @@ class NumpyRAddMixin(Generic[T, R]):
"""

def __radd__(self, other: T) -> R:
return qnp.add(other, self)
try:
return qnp.add(other, self)
except Exception: # noqa: BLE001
return NotImplemented


# -------------------------------------
Expand Down
1 change: 0 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 973ddd7

Please sign in to comment.