Skip to content

Commit 3590b62

Browse files
committed
fix: resolve missing complex type in applicable function signatures
1 parent 0498721 commit 3590b62

File tree

2 files changed

+32
-35
lines changed

2 files changed

+32
-35
lines changed

src/array_api_stubs/_2022_12/array_object.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ def __abs__(self: array, /) -> array:
146146
Added complex data type support.
147147
"""
148148

149-
def __add__(self: array, other: Union[int, float, array], /) -> array:
149+
def __add__(self: array, other: Union[int, float, complex, array], /) -> array:
150150
"""
151151
Calculates the sum for each element of an array instance with the respective element of the array ``other``.
152152
153153
Parameters
154154
----------
155155
self: array
156156
array instance (augend array). Should have a numeric data type.
157-
other: Union[int, float, array]
157+
other: Union[int, float, complex, array]
158158
addend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
159159
160160
Returns
@@ -374,15 +374,15 @@ def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
374374
ROCM = 10
375375
"""
376376

377-
def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
377+
def __eq__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
378378
r"""
379379
Computes the truth value of ``self_i == other_i`` for each element of an array instance with the respective element of the array ``other``.
380380
381381
Parameters
382382
----------
383383
self: array
384384
array instance. May have any data type.
385-
other: Union[int, float, bool, array]
385+
other: Union[int, float, complex, bool, array]
386386
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
387387
388388
Returns
@@ -746,7 +746,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
746746
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`.
747747
"""
748748

749-
def __mul__(self: array, other: Union[int, float, array], /) -> array:
749+
def __mul__(self: array, other: Union[int, float, complex, array], /) -> array:
750750
r"""
751751
Calculates the product for each element of an array instance with the respective element of the array ``other``.
752752
@@ -757,7 +757,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
757757
----------
758758
self: array
759759
array instance. Should have a numeric data type.
760-
other: Union[int, float, array]
760+
other: Union[int, float, complex, array]
761761
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
762762
763763
Returns
@@ -775,15 +775,15 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
775775
Added complex data type support.
776776
"""
777777

778-
def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
778+
def __ne__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
779779
"""
780780
Computes the truth value of ``self_i != other_i`` for each element of an array instance with the respective element of the array ``other``.
781781
782782
Parameters
783783
----------
784784
self: array
785785
array instance. May have any data type.
786-
other: Union[int, float, bool, array]
786+
other: Union[int, float, complex, bool, array]
787787
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
788788
789789
Returns
@@ -852,9 +852,6 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array:
852852
853853
.. note::
854854
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_or`.
855-
856-
.. versionchanged:: 2022.12
857-
Added complex data type support.
858855
"""
859856

860857
def __pos__(self: array, /) -> array:
@@ -876,7 +873,7 @@ def __pos__(self: array, /) -> array:
876873
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`.
877874
"""
878875

879-
def __pow__(self: array, other: Union[int, float, array], /) -> array:
876+
def __pow__(self: array, other: Union[int, float, complex, array], /) -> array:
880877
r"""
881878
Calculates an implementation-dependent approximation of exponentiation by raising each element (the base) of an array instance to the power of ``other_i`` (the exponent), where ``other_i`` is the corresponding element of the array ``other``.
882879
@@ -889,7 +886,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
889886
----------
890887
self: array
891888
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
892-
other: Union[int, float, array]
889+
other: Union[int, float, complex, array]
893890
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
894891
895892
Returns
@@ -933,7 +930,7 @@ def __setitem__(
933930
key: Union[
934931
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array
935932
],
936-
value: Union[int, float, bool, array],
933+
value: Union[int, float, complex, bool, array],
937934
/,
938935
) -> None:
939936
"""
@@ -947,7 +944,7 @@ def __setitem__(
947944
array instance.
948945
key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array]
949946
index key.
950-
value: Union[int, float, bool, array]
947+
value: Union[int, float, complex, bool, array]
951948
value(s) to set. Must be compatible with ``self[key]`` (see :ref:`broadcasting`).
952949
953950
@@ -960,7 +957,7 @@ def __setitem__(
960957
When ``value`` is an ``array`` of a different data type than ``self``, how values are cast to the data type of ``self`` is implementation defined.
961958
"""
962959

963-
def __sub__(self: array, other: Union[int, float, array], /) -> array:
960+
def __sub__(self: array, other: Union[int, float, complex, array], /) -> array:
964961
"""
965962
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
966963
@@ -970,7 +967,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
970967
----------
971968
self: array
972969
array instance (minuend array). Should have a numeric data type.
973-
other: Union[int, float, array]
970+
other: Union[int, float, complex, array]
974971
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
975972
976973
Returns
@@ -988,7 +985,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
988985
Added complex data type support.
989986
"""
990987

991-
def __truediv__(self: array, other: Union[int, float, array], /) -> array:
988+
def __truediv__(self: array, other: Union[int, float, complex, array], /) -> array:
992989
r"""
993990
Evaluates ``self_i / other_i`` for each element of an array instance with the respective element of the array ``other``.
994991
@@ -1001,7 +998,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
1001998
----------
1002999
self: array
10031000
array instance. Should have a numeric data type.
1004-
other: Union[int, float, array]
1001+
other: Union[int, float, complex, array]
10051002
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
10061003
10071004
Returns

src/array_api_stubs/_2023_12/array_object.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ def __abs__(self: array, /) -> array:
148148
Added complex data type support.
149149
"""
150150

151-
def __add__(self: array, other: Union[int, float, array], /) -> array:
151+
def __add__(self: array, other: Union[int, float, complex, array], /) -> array:
152152
"""
153153
Calculates the sum for each element of an array instance with the respective element of the array ``other``.
154154
155155
Parameters
156156
----------
157157
self: array
158158
array instance (augend array). Should have a numeric data type.
159-
other: Union[int, float, array]
159+
other: Union[int, float, complex, array]
160160
addend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
161161
162162
Returns
@@ -494,15 +494,15 @@ def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
494494
ONE_API = 14
495495
"""
496496

497-
def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
497+
def __eq__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
498498
r"""
499499
Computes the truth value of ``self_i == other_i`` for each element of an array instance with the respective element of the array ``other``.
500500
501501
Parameters
502502
----------
503503
self: array
504504
array instance. May have any data type.
505-
other: Union[int, float, bool, array]
505+
other: Union[int, float, complex, bool, array]
506506
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
507507
508508
Returns
@@ -893,7 +893,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
893893
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`.
894894
"""
895895

896-
def __mul__(self: array, other: Union[int, float, array], /) -> array:
896+
def __mul__(self: array, other: Union[int, float, complex, array], /) -> array:
897897
r"""
898898
Calculates the product for each element of an array instance with the respective element of the array ``other``.
899899
@@ -904,7 +904,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
904904
----------
905905
self: array
906906
array instance. Should have a numeric data type.
907-
other: Union[int, float, array]
907+
other: Union[int, float, complex, array]
908908
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
909909
910910
Returns
@@ -922,15 +922,15 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
922922
Added complex data type support.
923923
"""
924924

925-
def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
925+
def __ne__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
926926
"""
927927
Computes the truth value of ``self_i != other_i`` for each element of an array instance with the respective element of the array ``other``.
928928
929929
Parameters
930930
----------
931931
self: array
932932
array instance. May have any data type.
933-
other: Union[int, float, bool, array]
933+
other: Union[int, float, complex, bool, array]
934934
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
935935
936936
Returns
@@ -1024,7 +1024,7 @@ def __pos__(self: array, /) -> array:
10241024
Added complex data type support.
10251025
"""
10261026

1027-
def __pow__(self: array, other: Union[int, float, array], /) -> array:
1027+
def __pow__(self: array, other: Union[int, float, complex, array], /) -> array:
10281028
r"""
10291029
Calculates an implementation-dependent approximation of exponentiation by raising each element (the base) of an array instance to the power of ``other_i`` (the exponent), where ``other_i`` is the corresponding element of the array ``other``.
10301030
@@ -1037,7 +1037,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
10371037
----------
10381038
self: array
10391039
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
1040-
other: Union[int, float, array]
1040+
other: Union[int, float, complex, array]
10411041
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
10421042
10431043
Returns
@@ -1081,7 +1081,7 @@ def __setitem__(
10811081
key: Union[
10821082
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array
10831083
],
1084-
value: Union[int, float, bool, array],
1084+
value: Union[int, float, complex, bool, array],
10851085
/,
10861086
) -> None:
10871087
"""
@@ -1095,7 +1095,7 @@ def __setitem__(
10951095
array instance.
10961096
key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array]
10971097
index key.
1098-
value: Union[int, float, bool, array]
1098+
value: Union[int, float, complex, bool, array]
10991099
value(s) to set. Must be compatible with ``self[key]`` (see :ref:`broadcasting`).
11001100
11011101
@@ -1108,7 +1108,7 @@ def __setitem__(
11081108
When ``value`` is an ``array`` of a different data type than ``self``, how values are cast to the data type of ``self`` is implementation defined.
11091109
"""
11101110

1111-
def __sub__(self: array, other: Union[int, float, array], /) -> array:
1111+
def __sub__(self: array, other: Union[int, float, complex, array], /) -> array:
11121112
"""
11131113
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
11141114
@@ -1118,7 +1118,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
11181118
----------
11191119
self: array
11201120
array instance (minuend array). Should have a numeric data type.
1121-
other: Union[int, float, array]
1121+
other: Union[int, float, complex, array]
11221122
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
11231123
11241124
Returns
@@ -1136,7 +1136,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
11361136
Added complex data type support.
11371137
"""
11381138

1139-
def __truediv__(self: array, other: Union[int, float, array], /) -> array:
1139+
def __truediv__(self: array, other: Union[int, float, complex, array], /) -> array:
11401140
r"""
11411141
Evaluates ``self_i / other_i`` for each element of an array instance with the respective element of the array ``other``.
11421142
@@ -1149,7 +1149,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
11491149
----------
11501150
self: array
11511151
array instance. Should have a numeric data type.
1152-
other: Union[int, float, array]
1152+
other: Union[int, float, complex, array]
11531153
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
11541154
11551155
Returns

0 commit comments

Comments
 (0)