agentsociety.environment.utils.protobuf

Module Contents

Functions

parse

将Protobuf返回值转换为dict或者原始值 Convert Protobuf return value to dict or original value

async_parse

将Protobuf await返回值转换为dict或者原始值 Convert Protobuf await return value to dict or original value

pb2dict

Convert a protobuf message to a Python dictionary.

dict2pb

Convert a Python dictionary to a protobuf message.

Data

API

agentsociety.environment.utils.protobuf.__all__

[‘parse’, ‘async_parse’, ‘pb2dict’, ‘dict2pb’]

agentsociety.environment.utils.protobuf.T

‘TypeVar(…)’

agentsociety.environment.utils.protobuf.parse(res: agentsociety.environment.utils.protobuf.T, dict_return: bool) Union[dict[str, Any], agentsociety.environment.utils.protobuf.T]

将Protobuf返回值转换为dict或者原始值 Convert Protobuf return value to dict or original value

async agentsociety.environment.utils.protobuf.async_parse(res: collections.abc.Awaitable[agentsociety.environment.utils.protobuf.T], dict_return: bool) Union[dict[str, Any], agentsociety.environment.utils.protobuf.T]

将Protobuf await返回值转换为dict或者原始值 Convert Protobuf await return value to dict or original value

agentsociety.environment.utils.protobuf.pb2dict(pb: google.protobuf.message.Message)

Convert a protobuf message to a Python dictionary.

Args:

  • pb: The protobuf message to be converted.

Returns:

  • The Python dict.

agentsociety.environment.utils.protobuf.dict2pb(d: dict, pb: agentsociety.environment.utils.protobuf.T) agentsociety.environment.utils.protobuf.T

Convert a Python dictionary to a protobuf message.

Args:

  • d: The Python dict to be converted.

  • pb: The protobuf message to be filled.

Returns:

  • The protobuf message.