WhateverIO
StringIO that takes bytes or str.
Constructor
Signature
def WhateverIO(
v: bytes | str | None = None,
*a: Any,
**kw: Any
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| v | `bytes | str |
| *a | Any | Variable length argument list passed to the parent class. |
| **kw | Any | Arbitrary keyword arguments passed to the parent class. |
Signature
def WhateverIO(
v: bytes | str | None = None,
*a: Any,
**kw: Any
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| v | `bytes | str |
| *a | Any | Variable positional arguments passed to the underlying StringIO initializer. |
| **kw | Any | Variable 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
| Name | Type | Description |
|---|---|---|
| data | `bytes | str` |
Returns
| Type | Description |
|---|---|
int | The number of characters written to the buffer. |