Skip to content

compas_pb ¤

Functions:¤

pb_dump ¤

pb_dump(data: Data | dict[str, Data] | list[Data], filepath: str) -> None

Write a collection of COMPAS object to a binary file.

Parameters:

  • data (Data | dict | list) –

    Any protobuffer serializable object. This includes any (combination of) COMPAS object(s).

  • filepath (path string or file-like object) –

    A writeable file-like object or the path to a file.

Returns:

  • None

pb_dump_bts ¤

pb_dump_bts(data: Data | dict | list) -> bytes

Write a collection of COMPAS object to a btye string.

Parameters:

  • data (Data | dict | list) –

    Any protobuffer serializable object. This includes any (combination of) COMPAS object(s).

Returns:

  • None

pb_dump_json ¤

pb_dump_json(data: Data | dict | list) -> str

Write a collection of COMPAS object to a JSON string.

Parameters:

  • data (Data | dict | list) –

    Any protobuffer serializable object. This includes any (combination of) COMPAS object(s).

Returns:

  • string

    The JSON string representation of the data.

pb_load ¤

pb_load(filepath: str) -> Data | dict | list

Read a collection of COMPAS object from a binary file.

Parameters:

  • filepath (path string or file-like object) –

    A readable file-like object or the path to a file.

Returns:

  • Data | dict | list

    The (COMPAS) object(s) contained in the file.

pb_load_bts ¤

pb_load_bts(data: bytes) -> Data | dict | list

Read a collection of COMPAS object from a binary file.

Parameters:

  • filepath (path string or file-like object) –

    A readable file-like object or the path to a file.

Returns:

  • Data | dict | list

    The (COMPAS) object(s) contained in the file.

pb_load_json ¤

pb_load_json(data: str) -> Data | dict | list

Read a collection of COMPAS object from a JSON string.

Parameters:

  • data (str) –

    A JSON string representation of the data.

Returns:

  • Data | dict | list

    The (COMPAS) object(s) contained in the JSON string.