Skip to content

Commit fe030e2

Browse files
committed
Comments
1 parent 888cde7 commit fe030e2

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/array_api_typing/_array.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Static typing support for the array API standard."""
22

3-
from typing import Protocol, final
3+
from typing import Protocol
4+
5+
from ._namespace import HasArrayNamespace
46

57

6-
@final
78
class Array(HasArrayNamespace, Protocol):
89
pass

src/array_api_typing/_namespace.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Static typing support for the array API standard."""
22

3-
from typing import Protocol, final
3+
from typing import Protocol
44
from typing_extensions import TypeVar
55

66
from ._array import Array
@@ -41,10 +41,9 @@ def astype(
4141
) -> A: ...
4242

4343

44-
T = TypeVar("T", bound=Namespace, default=Namespace) # PEP 696 default
44+
T = TypeVar("T", bound=ArrayNamespace, default=ArrayNamespace) # PEP 696 default
4545

4646

47-
@final
4847
class HasArrayNamespace(Protocol[T]): # type: ignore[misc] # see python/mypy#17288
4948
"""Protocol for classes that have an `__array_namespace__` method.
5049

src/array_api_typing/_simple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Static typing support for the array API standard."""
22

3+
from __future__ import annotations
4+
35
from typing import Any, Protocol, TypeAlias, TypeVar
46

57
_T_co = TypeVar("_T_co", covariant=True)

0 commit comments

Comments
 (0)