Skip to content

Commit 49f2074

Browse files
committed
refactor Array as a Protocol
Signed-off-by: nstarman <[email protected]>
1 parent 6d205d7 commit 49f2074

File tree

3 files changed

+137
-97
lines changed

3 files changed

+137
-97
lines changed

src/array_api_stubs/_draft/_types.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from dataclasses import dataclass
3535
from typing import (
36+
TYPE_CHECKING,
3637
Any,
3738
List,
3839
Literal,
@@ -46,9 +47,14 @@
4647
)
4748
from enum import Enum
4849

49-
array = TypeVar("array")
50+
51+
if TYPE_CHECKING:
52+
from .array_object import Array
53+
from .data_types import DType
54+
55+
array = TypeVar("array", bound="Array")
5056
device = TypeVar("device")
51-
dtype = TypeVar("dtype")
57+
dtype = TypeVar("dtype", bound="DType")
5258
SupportsDLPack = TypeVar("SupportsDLPack")
5359
SupportsBufferProtocol = TypeVar("SupportsBufferProtocol")
5460
PyCapsule = TypeVar("PyCapsule")

0 commit comments

Comments
 (0)