Skip to content

types¤

Custom type annotations.

Buffer module-attribute ¤

Buffer = Buffer

Object exposing the buffer protocol.

PathLike module-attribute ¤

PathLike = Union[str, bytes, PathLike[str], PathLike[bytes]]

ReadLike module-attribute ¤

ReadLike = Union[FileLikeRead[str], FileLikeRead[bytes]]

A file-like object for reading str or bytes.

ShapeLike module-attribute ¤

ShapeLike = Union[SupportsIndex, Sequence[SupportsIndex]]

Anything that can be coerced to a shape tuple for an ndarray.

ToIndex module-attribute ¤

ToIndex = Union[SupportsIndex, slice, EllipsisType, None]

Anything that can be used as the key for numpy.ndarray.__setitem__.

ToIndices module-attribute ¤

ToIndices = Union[ToIndex, tuple[ToIndex, ...]]

Anything that can be used as the key for numpy.ndarray.__setitem__.

WriteLike module-attribute ¤

WriteLike = Union[FileLikeWrite[str], FileLikeWrite[bytes]]

A file-like object for writing str or bytes.

FileLikeRead ¤

Bases: Iterator[T_co], Protocol[T_co]

A file-like object for reading.

name property ¤

name

File name.

close ¤

close()

Close the stream.

Source code in src/msl/io/types.py
56
57
58
def close(self) -> None:
    """Close the stream."""
    ...

read ¤

read(size=-1)

Read from the stream.

Source code in src/msl/io/types.py
60
61
62
def read(self, size: int | None = -1, /) -> T_co:
    """Read from the stream."""
    ...

readline ¤

readline()

Read a line from the stream.

Source code in src/msl/io/types.py
64
65
66
def readline(self) -> T_co:
    """Read a line from the stream."""
    ...

seek ¤

seek(offset, whence=0)

Change the stream position to the given byte offset.

Source code in src/msl/io/types.py
68
69
70
def seek(self, offset: int, whence: int = 0, /) -> int:
    """Change the stream position to the given byte offset."""
    ...

tell ¤

tell()

Returns the current stream position.

Source code in src/msl/io/types.py
72
73
74
def tell(self) -> int:
    """Returns the current stream position."""
    ...

FileLikeWrite ¤

Bases: Protocol[T_contra]

A file-like object for writing.

name property ¤

name

File name.

close ¤

close()

Close the stream.

Source code in src/msl/io/types.py
89
90
91
def close(self) -> None:
    """Close the stream."""
    ...

write ¤

write(b)

Write to the stream.

Source code in src/msl/io/types.py
93
94
95
def write(self, b: T_contra, /) -> int:
    """Write to the stream."""
    ...

MediaDownloadProgress ¤

Bases: Protocol

Status of a resumable GDrive download.

resumable_progress instance-attribute ¤

resumable_progress

int — Number of bytes received so far.

total_size instance-attribute ¤

total_size

int — Total number of bytes in complete download.

progress ¤

progress()

Percent of download completed.

Returns:

Type Description
float

Download percentage.

Source code in src/msl/io/types.py
119
120
121
122
123
124
125
def progress(self) -> float:
    """Percent of download completed.

    Returns:
        Download percentage.
    """
    ...

SupportsRead ¤

Bases: Protocol[T_co]

A file-like object that has a read method.

read ¤

read(size=-1)

Read from the stream.

Source code in src/msl/io/types.py
105
106
107
def read(self, size: int | None = -1, /) -> T_co:
    """Read from the stream."""
    ...