aea.protocols.generator.base
This module contains the protocol generator.
ProtocolGenerator Objects
This class generates a protocol_verification package from a ProtocolTemplate object.
__
init__
| __init__(path_to_protocol_specification: str, output_path: str = ".", dotted_path_to_protocol_package: Optional[str] = None) -> None
Instantiate a protocol generator.
Arguments:
path_to_protocol_specification
: path to protocol specification fileoutput_path
: the path to the location in which the protocol module is to be generated.dotted_path_to_protocol_package
: the path to the protocol package
:raises FileNotFoundError if any prerequisite application is not installed :raises yaml.YAMLError if yaml parser encounters an error condition :raises ProtocolSpecificationParseError if specification fails generator's validation
generate_
protobuf_
only_
mode
| generate_protobuf_only_mode(language: str = PROTOCOL_LANGUAGE_PYTHON, run_protolint: bool = True) -> Optional[str]
Run the generator in "protobuf only" mode:
a) validate the protocol specification. b) create the protocol buffer schema file. c) create the protocol buffer implementation file via 'protoc'.
Arguments:
language
: the target language in which to generate the package.run_protolint
: whether to run protolint or not.
Returns:
None
generate_
full_
mode
Run the generator in "full" mode:
Runs the generator in protobuf only mode: a) validate the protocol specification. b) create the protocol buffer schema file. c) create the protocol buffer implementation file via 'protoc'. Additionally: d) generates python modules. e) applies black formatting f) applies isort formatting
Arguments:
language
: the language for which to create protobuf files
Returns:
optional warning message
generate
Run the generator either in "full" or "protobuf only" mode.
Arguments:
protobuf_only
: mode of running the generator.language
: the target language in which to generate the protocol package.
Returns:
optional warning message.
public_
id_
to_
package_
name
Make package name string from public_id provided.