Skip to content

Commit e4fd64a

Browse files
committed
🔧 update optype version
1 parent d2a0e69 commit e4fd64a

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

‎pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
dependencies = [
2929
"typing-extensions>=4.14.1",
3030
"optype>=0.9.3; python_version < '3.11'",
31-
"optype>=0.10.0; python_version >= '3.11'",
31+
"optype>=0.12.0; python_version >= '3.11'",
3232
"tomli>=1.2.0 ; python_full_version < '3.11'",
3333
]
3434

‎src/array_api_typing/_array.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
_array_docstrings = tomllib.load(f)["docstrings"]
2626

2727
NS_co = TypeVar("NS_co", covariant=True, default=ModuleType)
28-
InputT = TypeVar("InputT")
28+
T_contra = TypeVar("T_contra", contravariant=True)
2929

3030

3131
class HasArrayNamespace(Protocol[NS_co]):
@@ -56,35 +56,36 @@ class Array(
5656
HasArrayNamespace[NS_co],
5757
op.CanPosSelf,
5858
op.CanNegSelf,
59-
op.CanAddSelf[InputT],
60-
op.CanIAddSelf[InputT],
61-
op.CanRAddSelf[InputT],
62-
op.CanSubSelf[InputT],
63-
op.CanISubSelf[InputT],
64-
op.CanRSubSelf[InputT],
65-
op.CanMulSelf[InputT],
66-
op.CanIMulSelf[InputT],
67-
op.CanRMulSelf[InputT],
68-
op.CanTrueDivSelf[InputT],
69-
op.CanRTrueDivSelf[InputT],
70-
op.CanFloorDivSelf[InputT],
71-
op.CanIFloorDivSelf[InputT],
72-
op.CanRFloorDivSelf[InputT],
73-
op.CanModSelf[InputT],
74-
op.CanIModSelf[InputT],
75-
op.CanRModSelf[InputT],
76-
op.CanPowSelf[InputT],
77-
op.CanIPowSelf[InputT],
78-
op.CanRPowSelf[InputT],
79-
Protocol[InputT, NS_co],
59+
op.CanAddSame[T_contra],
60+
op.CanIAddSelf[T_contra],
61+
op.CanRAddSelf[T_contra],
62+
op.CanSubSame[T_contra],
63+
op.CanISubSelf[T_contra],
64+
op.CanRSubSelf[T_contra],
65+
op.CanMulSame[T_contra],
66+
op.CanIMulSelf[T_contra],
67+
op.CanRMulSelf[T_contra],
68+
op.CanTruedivSame[T_contra],
69+
op.CanITruedivSelf[T_contra],
70+
op.CanRTruedivSelf[T_contra],
71+
op.CanFloordivSame[T_contra],
72+
op.CanIFloordivSelf[T_contra],
73+
op.CanRFloordivSelf[T_contra],
74+
op.CanModSame[T_contra],
75+
op.CanIModSelf[T_contra],
76+
op.CanRModSelf[T_contra],
77+
op.CanPowSame[T_contra],
78+
op.CanIPowSelf[T_contra],
79+
op.CanRPowSelf[T_contra],
80+
Protocol[T_contra, NS_co],
8081
):
8182
"""Array API specification for array object attributes and methods."""
8283

8384

8485
BoolArray: TypeAlias = Array[bool, NS_co]
8586
"""Array API specification for boolean array object attributes and methods.
8687
87-
Specifically, this type alias fills the `InputT` type variable with `bool`,
88+
Specifically, this type alias fills the `T_contra` type variable with `bool`,
8889
allowing for `bool` objects to be added, subtracted, multiplied, etc. to the
8990
array object.
9091
@@ -93,7 +94,7 @@ class Array(
9394
NumericArray: TypeAlias = Array[float | int, NS_co]
9495
"""Array API specification for numeric array object attributes and methods.
9596
96-
Specifically, this type alias fills the `InputT` type variable with `float |
97+
Specifically, this type alias fills the `T_contra` type variable with `float |
9798
int`, allowing for `float | int` objects to be added, subtracted, multiplied,
9899
etc. to the array object.
99100

‎uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)