123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- import os
- from collections.abc import Sequence, Iterable
- from typing import (
- Any,
- TypeVar,
- overload,
- Protocol,
- )
- from numpy import (
- format_parser as format_parser,
- record as record,
- recarray as recarray,
- dtype,
- generic,
- void,
- _ByteOrder,
- _SupportsBuffer,
- )
- from numpy._typing import (
- ArrayLike,
- DTypeLike,
- NDArray,
- _ShapeLike,
- _ArrayLikeVoid_co,
- _NestedSequence,
- )
- _SCT = TypeVar("_SCT", bound=generic)
- _RecArray = recarray[Any, dtype[_SCT]]
- class _SupportsReadInto(Protocol):
- def seek(self, offset: int, whence: int, /) -> object: ...
- def tell(self, /) -> int: ...
- def readinto(self, buffer: memoryview, /) -> int: ...
- __all__: list[str]
- @overload
- def fromarrays(
- arrayList: Iterable[ArrayLike],
- dtype: DTypeLike = ...,
- shape: None | _ShapeLike = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- ) -> _RecArray[Any]: ...
- @overload
- def fromarrays(
- arrayList: Iterable[ArrayLike],
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- *,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- ) -> _RecArray[record]: ...
- @overload
- def fromrecords(
- recList: _ArrayLikeVoid_co | tuple[Any, ...] | _NestedSequence[tuple[Any, ...]],
- dtype: DTypeLike = ...,
- shape: None | _ShapeLike = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- ) -> _RecArray[record]: ...
- @overload
- def fromrecords(
- recList: _ArrayLikeVoid_co | tuple[Any, ...] | _NestedSequence[tuple[Any, ...]],
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- *,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- ) -> _RecArray[record]: ...
- @overload
- def fromstring(
- datastring: _SupportsBuffer,
- dtype: DTypeLike,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- ) -> _RecArray[record]: ...
- @overload
- def fromstring(
- datastring: _SupportsBuffer,
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- *,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- ) -> _RecArray[record]: ...
- @overload
- def fromfile(
- fd: str | bytes | os.PathLike[str] | os.PathLike[bytes] | _SupportsReadInto,
- dtype: DTypeLike,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- ) -> _RecArray[Any]: ...
- @overload
- def fromfile(
- fd: str | bytes | os.PathLike[str] | os.PathLike[bytes] | _SupportsReadInto,
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- *,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- ) -> _RecArray[record]: ...
- @overload
- def array(
- obj: _SCT | NDArray[_SCT],
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- copy: bool = ...,
- ) -> _RecArray[_SCT]: ...
- @overload
- def array(
- obj: ArrayLike,
- dtype: DTypeLike,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- copy: bool = ...,
- ) -> _RecArray[Any]: ...
- @overload
- def array(
- obj: ArrayLike,
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- *,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- copy: bool = ...,
- ) -> _RecArray[record]: ...
- @overload
- def array(
- obj: None,
- dtype: DTypeLike,
- shape: _ShapeLike,
- offset: int = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- copy: bool = ...,
- ) -> _RecArray[Any]: ...
- @overload
- def array(
- obj: None,
- dtype: None = ...,
- *,
- shape: _ShapeLike,
- offset: int = ...,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- copy: bool = ...,
- ) -> _RecArray[record]: ...
- @overload
- def array(
- obj: _SupportsReadInto,
- dtype: DTypeLike,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- formats: None = ...,
- names: None = ...,
- titles: None = ...,
- aligned: bool = ...,
- byteorder: None = ...,
- copy: bool = ...,
- ) -> _RecArray[Any]: ...
- @overload
- def array(
- obj: _SupportsReadInto,
- dtype: None = ...,
- shape: None | _ShapeLike = ...,
- offset: int = ...,
- *,
- formats: DTypeLike,
- names: None | str | Sequence[str] = ...,
- titles: None | str | Sequence[str] = ...,
- aligned: bool = ...,
- byteorder: None | _ByteOrder = ...,
- copy: bool = ...,
- ) -> _RecArray[record]: ...
|