Skip to content

Internal Type Definitions

Since std libraries are not implemented in python, only pyi files are provided to use.

However, this library is implemented with pure Python, and there's no need to write single type definitions, which means we cannot use the typeshed package.

For internal use and for static type checking, part of the typeshed package is copied and partly changed. It is guaranteed that the monad-std package will not use any of the code except for type hints.

typedef.cmp

Comparation-related types and protocols.

monad_std.typedef.cmp.SupportsDunderLT

Bases: Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsDunderLT(t.Protocol[_T_contra]):
    def __lt__(self, __other: _T_contra) -> bool: ...

monad_std.typedef.cmp.SupportsDunderGT

Bases: Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsDunderGT(t.Protocol[_T_contra]):
    def __gt__(self, __other: _T_contra) -> bool: ...

monad_std.typedef.cmp.SupportsDunderLE

Bases: Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsDunderLE(t.Protocol[_T_contra]):
    def __le__(self, __other: _T_contra) -> bool: ...

monad_std.typedef.cmp.SupportsDunderGE

Bases: Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsDunderGE(t.Protocol[_T_contra]):
    def __ge__(self, __other: _T_contra) -> bool: ...

monad_std.typedef.cmp.SupportsDunderEq

Bases: Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsDunderEq(t.Protocol[_T_contra]):
    # This is just a protocol, so we don't need to satisfy the upper bound of `__eq__`.
    def __eq__(self, other: _T_contra) -> bool: ...  # type: ignore[override]

monad_std.typedef.cmp.SupportsAllComparisons

Bases: SupportsDunderLT[_T_contra], SupportsDunderGT[_T_contra], SupportsDunderLE[_T_contra], SupportsDunderGE[_T_contra], Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsAllComparisons(
    SupportsDunderLT[_T_contra],
    SupportsDunderGT[_T_contra],
    SupportsDunderLE[_T_contra],
    SupportsDunderGE[_T_contra],
    t.Protocol[_T_contra]
):
    ...

monad_std.typedef.cmp.SupportsRichComparison

Bases: SupportsDunderLT[_T_contra], SupportsDunderGT[_T_contra], Protocol[_T_contra]

Source code in monad_std/typedef/cmp.py
class SupportsRichComparison(
    SupportsDunderLT[_T_contra],
    SupportsDunderGT[_T_contra],
    t.Protocol[_T_contra]
):
    ...

typedef.ops

Operation-related types and protocols.

monad_std.typedef.ops.SupportsAdd

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsAdd(t.Protocol[_T]):
    def __add__(self, __x: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsRAdd

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsRAdd(t.Protocol[_T]):
    def __radd__(self, __x: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsSub

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsSub(t.Protocol[_T]):
    def __sub__(self, __x: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsRSub

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsRSub(t.Protocol[_T]):
    def __rsub__(self, __x: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsMul

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsMul(t.Protocol[_T]):
    def __mul__(self, __x: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsRMul

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsRMul(t.Protocol[_T]):
    def __rmul__(self, __x: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsDivMod

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsDivMod(t.Protocol[_T]):
    def __divmod__(self, __other: te.Self) -> te.Self: ...

monad_std.typedef.ops.SupportsRDivMod

Bases: Protocol[_T]

Source code in monad_std/typedef/ops.py
class SupportsRDivMod(t.Protocol[_T]):
    def __rdivmod__(self, __other: te.Self) -> te.Self: ...