summaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/numpy/_core/_asarray.pyi
blob: a4bee00489fb01c769f698dda81904f3d4dcc245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from collections.abc import Iterable
from typing import Any, Literal, TypeAlias, TypeVar, overload

from numpy._typing import DTypeLike, NDArray, _SupportsArrayFunc

_ArrayT = TypeVar("_ArrayT", bound=NDArray[Any])

_Requirements: TypeAlias = Literal[
    "C", "C_CONTIGUOUS", "CONTIGUOUS",
    "F", "F_CONTIGUOUS", "FORTRAN",
    "A", "ALIGNED",
    "W", "WRITEABLE",
    "O", "OWNDATA"
]
_E: TypeAlias = Literal["E", "ENSUREARRAY"]
_RequirementsWithE: TypeAlias = _Requirements | _E

@overload
def require(
    a: _ArrayT,
    dtype: None = ...,
    requirements: _Requirements | Iterable[_Requirements] | None = ...,
    *,
    like: _SupportsArrayFunc = ...
) -> _ArrayT: ...
@overload
def require(
    a: object,
    dtype: DTypeLike = ...,
    requirements: _E | Iterable[_RequirementsWithE] = ...,
    *,
    like: _SupportsArrayFunc = ...
) -> NDArray[Any]: ...
@overload
def require(
    a: object,
    dtype: DTypeLike = ...,
    requirements: _Requirements | Iterable[_Requirements] | None = ...,
    *,
    like: _SupportsArrayFunc = ...
) -> NDArray[Any]: ...