wfexs_backend.utils.io_wrappers#

Module Contents#

Classes#

AbstractProxyIOWrapper

This class is used to compute the digestion of the read bytes of a stream on the fly

DigestIOWrapper

This class is used to compute the digestion of the read bytes of a stream on the fly

MIMETypeIOWrapper

This class is used to compute the MIME type of a stream on the fly

LimitedStreamIOWrapper

This class is used to provide chunked uploads from a stream

MultipartFile

MultipartEncoderIOWrapper

This implementation is slightly inspired on https://stackoverflow.com/a/77323411

API#

class wfexs_backend.utils.io_wrappers.AbstractProxyIOWrapper(stream: IO[bytes] | io.RawIOBase)#

Bases: io.RawIOBase

This class is used to compute the digestion of the read bytes of a stream on the fly

Initialization

Initialize self. See help(type(self)) for accurate signature.

_fake_readinto(buf: typing_extensions.Buffer) int | None#
close() None#
property closed: bool#
readable() bool#
tell() int#
writable() bool#
class wfexs_backend.utils.io_wrappers.DigestIOWrapper(stream: IO[bytes] | io.RawIOBase, algo: str = 'sha256')#

Bases: wfexs_backend.utils.io_wrappers.AbstractProxyIOWrapper

This class is used to compute the digestion of the read bytes of a stream on the fly

Initialization

Initialize self. See help(type(self)) for accurate signature.

readinto(buf: typing_extensions.Buffer) int#
digest() bytes#
hexdigest() str#
class wfexs_backend.utils.io_wrappers.MIMETypeIOWrapper(stream: IO[bytes] | io.RawIOBase)#

Bases: wfexs_backend.utils.io_wrappers.AbstractProxyIOWrapper

This class is used to compute the MIME type of a stream on the fly

Initialization

Initialize self. See help(type(self)) for accurate signature.

readinto(buf: typing_extensions.Buffer) int | None#
_compute_mime() None#
mime() str#
class wfexs_backend.utils.io_wrappers.LimitedStreamIOWrapper(stream: IO[bytes] | io.RawIOBase, maxreadsize: int)#

Bases: wfexs_backend.utils.io_wrappers.AbstractProxyIOWrapper

This class is used to provide chunked uploads from a stream

Initialization

Initialize self. See help(type(self)) for accurate signature.

readinto(buf: typing_extensions.Buffer) int#
class wfexs_backend.utils.io_wrappers.MultipartFile#

Bases: typing.NamedTuple

filename: str = None#
mime: str = None#
stream: SupportsRead[bytes] = None#
size: int | None = None#
class wfexs_backend.utils.io_wrappers.MultipartEncoderIOWrapper(fields: Sequence[Tuple[str, Sequence[str | MultipartFile]]], boundary: str | None = None)#

Bases: io.RawIOBase

This implementation is slightly inspired on https://stackoverflow.com/a/77323411

Initialization

Initialize self. See help(type(self)) for accurate signature.

property content_type: str#
_set_fields(fields: Sequence[Tuple[str, Sequence[str | MultipartFile]]]) None#
_current_field_header() bytes#
property footer: bytes#
readinto(buf: typing_extensions.Buffer) int#