Skip to content

Commit 61dbd8e

Browse files
committed
Use type vars in annotating with_container_arithmetic
1 parent 2979e12 commit 61dbd8e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

arraycontext/container/arithmetic.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
.. autofunction:: with_container_arithmetic
99
1010
.. autoclass:: BcastUntilActxArray
11+
12+
References
13+
----------
14+
15+
.. class:: TypeT
16+
17+
A type variable with an upper bound of :class:`type`.
1118
"""
1219

1320

@@ -62,6 +69,8 @@
6269

6370
T = TypeVar("T")
6471

72+
TypeT = TypeVar("TypeT", bound=type)
73+
6574

6675
@enum.unique
6776
class _OpClass(enum.Enum):
@@ -190,7 +199,7 @@ def with_container_arithmetic(
190199
bcast_numpy_array: bool = False,
191200
_bcast_actx_array_type: bool | None = None,
192201
bcast_container_types: tuple[type, ...] | None = None,
193-
) -> Callable[[type], type]:
202+
) -> Callable[[TypeT], TypeT]:
194203
"""A class decorator that implements built-in operators for array containers
195204
by propagating the operations to the elements of the container.
196205

0 commit comments

Comments
 (0)