3131 "Info" ,
3232]
3333
34- from dataclasses import dataclass
3534from typing import (
3635 Any ,
3736 List ,
4544 Protocol ,
4645)
4746from enum import Enum
47+ from .data_types import DType
4848
4949array = TypeVar ("array" , bound = "_array" )
5050device = TypeVar ("device" )
51- dtype = TypeVar ("dtype" )
52- Device = TypeVar ("Device" )
53- Dtype = TypeVar ("Dtype" )
51+ dtype = TypeVar ("dtype" , bound = DType )
52+ device_ = TypeVar ("device_" ) # only used in this file
53+ dtype_ = TypeVar ("dtype_" , bound = DType ) # only used in this file
5454SupportsDLPack = TypeVar ("SupportsDLPack" )
5555SupportsBufferProtocol = TypeVar ("SupportsBufferProtocol" )
5656PyCapsule = TypeVar ("PyCapsule" )
@@ -149,12 +149,12 @@ def dtypes(
149149)
150150
151151
152- class _array (Protocol [array , Dtype , Device , PyCapsule ]): # type: ignore
152+ class _array (Protocol [array , dtype_ , device_ , PyCapsule ]): # type: ignore
153153 def __init__ (self : array ) -> None :
154154 """Initialize the attributes for the array object class."""
155155
156156 @property
157- def dtype (self : array ) -> Dtype :
157+ def dtype (self : array ) -> dtype_ :
158158 """
159159 Data type of the array elements.
160160
@@ -165,7 +165,7 @@ def dtype(self: array) -> Dtype:
165165 """
166166
167167 @property
168- def device (self : array ) -> Device :
168+ def device (self : array ) -> device_ :
169169 """
170170 Hardware device the array data resides on.
171171
@@ -1344,7 +1344,7 @@ def __xor__(self: array, other: Union[int, bool, array], /) -> array:
13441344 """
13451345
13461346 def to_device (
1347- self : array , device : Device , / , * , stream : Optional [Union [int , Any ]] = None
1347+ self : array , device : device_ , / , * , stream : Optional [Union [int , Any ]] = None
13481348 ) -> array :
13491349 """
13501350 Copy the array from the device on which it currently resides to the specified ``device``.
0 commit comments