Skip to content

Commit b1ad56e

Browse files
committed
✨: add HasArrayOr protocol
Signed-off-by: Nathaniel Starkman <[email protected]>
1 parent f04da40 commit b1ad56e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/array_api_typing/_array.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,22 @@ def __and__(self, other: Self | int | float, /) -> Self:
220220
...
221221

222222

223+
class HasArrayOr(Protocol):
224+
"""Evaluates ``self_i | other_i`` for each element of an array instance with the respective element of the array other.""" # noqa: E501
225+
226+
def __or__(self, other: Self | int | float, /) -> Self:
227+
"""Calculates the bitwise OR for each element of an array instance with the respective element of the array other.
228+
229+
Args:
230+
other: operand array. Must be compatible with self (see Broadcasting). Should have an integer data type.
231+
232+
Returns:
233+
an array containing the element-wise bitwise ORs. The returned array must have a data type determined by Type Promotion Rules.
234+
235+
""" # noqa: E501
236+
...
237+
238+
223239
class Array(
224240
HasArrayNamespace[NS_co],
225241
HasArrayPos,
@@ -234,6 +250,7 @@ class Array(
234250
HasArrayMatmul,
235251
HasArrayInvert,
236252
HasArrayAnd,
253+
HasArrayOr,
237254
Protocol,
238255
):
239256
"""Array API specification for array object attributes and methods."""

0 commit comments

Comments
 (0)