loadLoads twine data from a file object.
def load(file: BinaryIO, chunk_size=512) -> any:
file (BinaryIO): A file opened in ‘rb’ modechunk_size (int, optional): File will be read in
chunks of this size. Defaults to 512.any: The decoded dataloadsLoads twine data from a bytes-like object
def load(data: ByteString) -> any:
data (ByteString): A bytes-like object containing the twine data.any: The decoded datadumpEncodes data and writes the result to a file
def dump(data, file: BinaryIO, chunk_size: int = 512) -> None:
data (any): The data to encodefile (BinaryIO): A file opened in wb modechunk_size (int, optional): Size of each chunk written to the file. Defaults to 512.dumpsEncodes data and returns it either as a bytes object or as a generator.
def dumpb(data, lazy: bool = False) -> Union[bytes, Generator]
data (any): The data to encodelazy (bool, optional): Whether encoded data should be returned as a generator. Defaults to False.Union[bytes, Generator]: A generator, or bytes object containing the encoded dataset_handlersSet the handlers for a data type
def set_handlers(data_type: type, type_code: int, encoder: Callable, decoder: Callable) -> None:
data_type (type): The type of the data, used when encodingtype_code (int): Code used to identify type when decodingencoder (Callable): Function to call when encoding datadecoder (Callable): Function to call when decoding data