acton.proto package

Submodules

acton.proto.io module

Functions for reading/writing to protobufs.

acton.proto.io.get_ndarray(data: list, shape: tuple, dtype: str) → <MagicMock id='139719834441320'>[source]

Converts a list of values into an array.

Parameters:
  • data – Raw array data.
  • shape – Shape of the resulting array.
  • dtype – Data type of the resulting array.
Returns:

Array with the given data, shape, and dtype.

Return type:

numpy.ndarray

acton.proto.io.read_metadata(file: typing.Union[str, typing.BinaryIO]) → bytes[source]

Reads metadata from a protobufs file.

Parameters:file – Path to binary file, or file itself.
Returns:Metadata.
Return type:bytes
acton.proto.io.read_proto()[source]

Reads a protobuf from a .proto file.

Parameters:
  • path – Path to the .proto file.
  • Proto – Protocol message class (from the generated protobuf module).
Returns:

The parsed protobuf.

Return type:

GeneratedProtocolMessageType

acton.proto.io.read_protos(file: typing.Union[str, typing.BinaryIO], Proto: <MagicMock id='139719834474424'>) → <MagicMock name='mock()' id='139719834810912'>[source]

Reads many protobufs from a file.

Parameters:
  • file – Path to binary file, or file itself.
  • Proto – Protocol message class (from the generated protobuf module).
Yields:

GeneratedProtocolMessageType – A parsed protobuf.

acton.proto.io.write_proto()[source]

Serialises a protobuf to a file.

Parameters:
  • path – Path to binary file. Will be overwritten.
  • proto – Protobuf to write to file.
acton.proto.io.write_protos(path: str, metadata: bytes = b'')[source]

Serialises many protobufs to a file.

Parameters:
  • path – Path to binary file. Will be overwritten.
  • metadata – Optional bytestring to prepend to the file.

Notes

Coroutine. Accepts protobufs, or None to terminate and close file.

acton.proto.predictors_pb2 module

acton.proto.wrappers module

Module contents