Skip to content

optype.io

A collection of protocols and type-aliases that, unlike their analogues in _typeshed, are accessible at runtime, and use a consistent naming scheme.

optype.io protocol implements replaces
CanFSPath[+T: str | bytes =] __fspath__: () -> T os.PathLike[AnyStr: (str, bytes)]
CanRead[+T] read: () -> T
CanReadN[+T] read: (int) -> T _typeshed.SupportsRead[+T]
CanReadline[+T] readline: () -> T _typeshed.SupportsNoArgReadline[+T]
CanReadlineN[+T] readline: (int) -> T _typeshed.SupportsReadline[+T]
CanWrite[-T, +RT = object] write: (T) -> RT _typeshed.SupportsWrite[-T]
CanFlush[+RT = object] flush: () -> RT _typeshed.SupportsFlush
CanFileno fileno: () -> int _typeshed.HasFileno
optype.io type alias expression replaces
ToPath[+T: str | bytes =] T | CanFSPath[T] _typeshed.StrPath
_typeshed.BytesPath
_typeshed.StrOrBytesPath
_typeshed.GenericPath[AnyStr]
ToFileno int | CanFileno _typeshed.FileDescriptorLike