Skip to main content

WhateverIO

StringIO that takes bytes or str.

Constructor​

Signature​

def WhateverIO(
v: bytes | str | None = None,
*a: Any,
**kw: Any
) - > None

Parameters​

NameTypeDescription
v`bytesstr
*aAnyVariable length argument list passed to the parent class.
**kwAnyArbitrary keyword arguments passed to the parent class.

Signature​

def WhateverIO(
v: bytes | str | None = None,
*a: Any,
**kw: Any
) - > None

Parameters​

NameTypeDescription
v`bytesstr
*aAnyVariable positional arguments passed to the underlying StringIO initializer.
**kwAnyVariable keyword arguments passed to the underlying StringIO initializer.

Methods​


write()​

@classmethod
def write(
data: bytes | str
) - > int

Writes the provided data to the buffer, automatically decoding bytes to strings if necessary to ensure compatibility with the underlying StringIO implementation.

Parameters​

NameTypeDescription
data`bytesstr`

Returns​

TypeDescription
intThe number of characters written to the buffer.