ducpy.serialize.serialize_binary_files

Functions

create_binary_file_data_dict(→ Dict[str, ...)

Creates a dictionary representing the data for a single binary file.

create_binary_files_dict_from_list(→ Dict[str, ...)

Creates the main binary_files dictionary from a list of file data dictionaries.

get_attribute(obj, attr[, alt_attr])

Safely get an attribute from an object or dictionary.

serialize_binary_files(→ int)

Module Contents

ducpy.serialize.serialize_binary_files.create_binary_file_data_dict(mime_type: str, image_id: str, image_bytes: bytes, timestamp_ms: int) Dict[str, ducpy.classes.BinaryFilesClass.BinaryFiles]

Creates a dictionary representing the data for a single binary file. This dictionary is suitable for use as a value in the main binary_files dictionary passed to serialize_binary_files.

ducpy.serialize.serialize_binary_files.create_binary_files_dict_from_list(files_data: List[Dict[str, ducpy.classes.BinaryFilesClass.BinaryFiles]]) Dict[str, Dict[str, ducpy.classes.BinaryFilesClass.BinaryFiles]]

Creates the main binary_files dictionary from a list of file data dictionaries. Each item in the list should be a dictionary with keys: ‘image_id’, ‘mime_type’, ‘image_bytes’, ‘timestamp_ms’. The ‘image_id’ will be used as the key in the output dictionary and for the ‘id’ field.

ducpy.serialize.serialize_binary_files.get_attribute(obj: Dict | Any, attr: str, alt_attr: str = None)

Safely get an attribute from an object or dictionary.

ducpy.serialize.serialize_binary_files.serialize_binary_files(builder: flatbuffers.Builder, binary_files: Dict[str, Dict | ducpy.classes.BinaryFilesClass.BinaryFiles]) int