ds_resource_plugin_py_lib.common.serde.binary¶
File: binary.py
Region: ds_resource_plugin_py_lib/common/serde
Description¶
Helpers for serializing and deserializing binary payloads via DataFrames.
Attributes¶
Functions¶
|
Return kwargs with binary-specific keys removed. |
|
Wrap raw binary input in a single-row DataFrame. |
|
Extract binary payload from a DataFrame row and column. |
Module Contents¶
- ds_resource_plugin_py_lib.common.serde.binary._BINARY_KWARGS¶
- ds_resource_plugin_py_lib.common.serde.binary._DEFAULT_COLUMN = 'binary'¶
- ds_resource_plugin_py_lib.common.serde.binary._DEFAULT_ROW = 0¶
- ds_resource_plugin_py_lib.common.serde.binary.binary_kwargs(kwargs: dict[str, Any]) dict[str, Any][source]¶
Return kwargs with binary-specific keys removed.
- ds_resource_plugin_py_lib.common.serde.binary.deserialize_binary(value: Any, *, column: str = _DEFAULT_COLUMN, encoding: str | None = None) pandas.DataFrame[source]¶
Wrap raw binary input in a single-row DataFrame.
- Parameters:
value – Binary payload as
bytes,bytearray,BytesIO, orstr.column – Column name for the binary value.
encoding – When set, encode
strinput with this encoding.
- Returns:
A one-row DataFrame containing the binary payload.
- Raises:
DeserializationError – If the input is not binary.
- ds_resource_plugin_py_lib.common.serde.binary.serialize_binary(obj: pandas.DataFrame, *, column: str = _DEFAULT_COLUMN, row: int = _DEFAULT_ROW, encoding: str | None = None) bytes[source]¶
Extract binary payload from a DataFrame row and column.
- Parameters:
obj – Source DataFrame.
column – Column containing the binary value.
row – Row index to read from.
encoding – When set, encode
strcell values with this encoding.
- Returns:
The binary payload as
bytes.- Raises:
SerializationError – If the column, row, or cell value is invalid.