_asarray.pyi
1 from collections.abc import Iterable 2 from typing import TypeVar, Union, overload, Literal 3 4 from numpy import ndarray 5 from numpy._typing import DTypeLike, _SupportsArrayFunc 6 7 _ArrayType = TypeVar("_ArrayType", bound=ndarray) 8 9 _Requirements = Literal[ 10 "C", "C_CONTIGUOUS", "CONTIGUOUS", 11 "F", "F_CONTIGUOUS", "FORTRAN", 12 "A", "ALIGNED", 13 "W", "WRITEABLE", 14 "O", "OWNDATA" 15 ] 16 _E = Literal["E", "ENSUREARRAY"] 17 _RequirementsWithE = Union[_Requirements, _E] 18 19 @overload 20 def require( 21 a: _ArrayType, 22 dtype: None = ..., 23 requirements: None | _Requirements | Iterable[_Requirements] = ..., 24 *, 25 like: _SupportsArrayFunc = ... 26 ) -> _ArrayType: ... 27 @overload 28 def require( 29 a: object, 30 dtype: DTypeLike = ..., 31 requirements: _E | Iterable[_RequirementsWithE] = ..., 32 *, 33 like: _SupportsArrayFunc = ... 34 ) -> ndarray: ... 35 @overload 36 def require( 37 a: object, 38 dtype: DTypeLike = ..., 39 requirements: None | _Requirements | Iterable[_Requirements] = ..., 40 *, 41 like: _SupportsArrayFunc = ... 42 ) -> ndarray: ...