|
| 1 | +# defined in scipy/io/matlab/_mio5_utils.pyx |
| 2 | + |
| 3 | +from collections.abc import Iterable |
| 4 | +from types import CapsuleType |
| 5 | +from typing import Any, ClassVar, Final, Literal, Never, TypeAlias |
| 6 | + |
| 7 | +import numpy as np |
| 8 | +import optype.numpy as onp |
| 9 | +import optype.numpy.compat as npc |
| 10 | + |
| 11 | +from ._miobase import MatVarReader |
| 12 | +from ._streams import GenericStream, _FileLike |
| 13 | + |
| 14 | +_bint: TypeAlias = Literal[0, 1] | bool # noqa: PYI042 |
| 15 | + |
| 16 | +### |
| 17 | + |
| 18 | +# NOTE: These apprear to be broken, and will always raise `TypeError: no default __reduce__ due to non-trivial __cinit__` |
| 19 | +def __reduce_cython__(self: Never) -> Never: ... # undocumented |
| 20 | +def __setstate_cython__(self: Never, __pyx_state: Never) -> None: ... # undocumented # pyright: ignore[reportGeneralTypeIssues] |
| 21 | + |
| 22 | +swapped_code: Final[Literal[">", "<"]] = ... # undocumented # ">" sys.byteorder == "little" else "<" |
| 23 | + |
| 24 | +def byteswap_u4(u4: np.uint32) -> np.uint32: ... # undocumented |
| 25 | + |
| 26 | +class VarHeader5: # undocumented |
| 27 | + # cdef readonly object name |
| 28 | + name: Final[object] |
| 29 | + # cdef readonly int mclass |
| 30 | + mclass: Final[int] |
| 31 | + # cdef readonly object dims |
| 32 | + dims: Final[Iterable[int | npc.integer]] |
| 33 | + # cdef readonly int is_logical |
| 34 | + is_logical: Final[_bint] |
| 35 | + # cdef public int is_global |
| 36 | + is_global: _bint |
| 37 | + # cdef readonly size_t nzmax |
| 38 | + nzmax: Final[int] |
| 39 | + |
| 40 | + def __reduce_cython__(self) -> tuple[Any, ...]: ... |
| 41 | + def __setstate_cython__(self, /, state: tuple[object, ...]) -> None: ... |
| 42 | + |
| 43 | + # |
| 44 | + def set_dims(self, /, dims: object) -> None: ... |
| 45 | + |
| 46 | +class VarReader5: # undocumented |
| 47 | + __pyx_vtable__: ClassVar[CapsuleType] = ... |
| 48 | + |
| 49 | + # cdef public int is_swapped, little_endian |
| 50 | + is_swapped: _bint |
| 51 | + little_endian: _bint |
| 52 | + |
| 53 | + def __init__(self, /, preader: MatVarReader) -> None: ... |
| 54 | + def set_stream(self, /, fobj: GenericStream | _FileLike) -> None: ... |
| 55 | + def read_tag(self, /) -> tuple[int, int, str | None]: ... |
| 56 | + def read_numeric(self, /, copy: _bint = True, nnz: int = -1) -> onp.Array1D[Any]: ... |
| 57 | + def read_full_tag(self, /) -> tuple[np.uint32, np.uint32]: ... |
| 58 | + def read_header(self, /, check_stream_limit: _bint) -> VarHeader5: ... |
| 59 | + def array_from_header(self, /, header: VarHeader5, process: _bint = 1) -> Any: ... # squeezed ndarray or sparse csc_array |
| 60 | + def shape_from_header(self, /, header: VarHeader5) -> tuple[int, ...]: ... |
| 61 | + def read_real_complex(self, /, header: VarHeader5) -> onp.ArrayND[np.float64 | np.complex128]: ... |
| 62 | + def read_char(self, /, header: VarHeader5) -> onp.ArrayND[np.str_]: ... |
| 63 | + def read_cells(self, /, header: VarHeader5) -> onp.ArrayND[np.object_]: ... |
| 64 | + def read_fieldnames(self, /) -> list[str]: ... |
| 65 | + def read_struct(self, /, header: VarHeader5) -> onp.ArrayND[np.object_]: ... |
| 66 | + def read_opaque(self, /, hdr: VarHeader5) -> onp.Array1D[np.void]: ... |
0 commit comments