aea.configurations.loader

Implementation of the parser for configuration file.

make_jsonschema_base_uri

make_jsonschema_base_uri(base_uri_path: Path) -> str

Make the JSONSchema base URI, cross-platform.

Arguments:

  • base_uri_path: the path to the base directory.

Returns:

the string in URI form.

BaseConfigLoader Objects

class BaseConfigLoader()

Base class for configuration loader classes.

__init__

 | __init__(schema_filename: str)

Initialize the base configuration loader.

Arguments:

  • schema_filename: the path to the schema.

validator

 | @property
 | validator() -> Draft4Validator

Get the json schema validator.

validate

 | validate(json_data: Dict) -> None

Validate a JSON object.

Arguments:

  • json_data: the JSON data.

Returns:

None.

required_fields

 | @property
 | required_fields() -> List[str]

Get the required fields.

Returns:

list of required fields.

ConfigLoader Objects

class ConfigLoader(Generic[T],  BaseConfigLoader)

Parsing, serialization and validation for package configuration files.

__init__

 | __init__(schema_filename: str, configuration_class: Type[T])

Initialize the parser for configuration files.

Arguments:

  • schema_filename: the path to the JSON-schema file in 'aea/configurations/schemas'.
  • configuration_class: the configuration class (e.g. AgentConfig, SkillConfig etc.)

configuration_class

 | @property
 | configuration_class() -> Type[T]

Get the configuration class of the loader.

load_protocol_specification

 | load_protocol_specification(file_pointer: TextIO) -> T

Load an agent configuration file.

Arguments:

  • file_pointer: the file pointer to the configuration file

Returns:

the configuration object. :raises

validate

 | validate(json_data: Dict) -> None

Validate a JSON object against the right JSON schema.

Arguments:

  • json_data: the JSON data.

Returns:

None.

load

 | load(file_pointer: TextIO) -> T

Load a configuration file.

Arguments:

  • file_pointer: the file pointer to the configuration file

Returns:

the configuration object.

dump

 | dump(configuration: T, file_pointer: TextIO) -> None

Dump a configuration.

Arguments:

  • configuration: the configuration to be dumped.
  • file_pointer: the file pointer to the configuration file

Returns:

None

from_configuration_type

 | @classmethod
 | from_configuration_type(cls, configuration_type: Union[PackageType, str]) -> "ConfigLoader"

Get the configuration loader from the type.

load_agent_config_from_json

 | load_agent_config_from_json(configuration_json: List[Dict]) -> AgentConfig

Load agent configuration from configuration json data.

Arguments:

  • configuration_json: list of dicts with aea configuration

Returns:

AgentConfig instance

validate_component_configuration

 | @staticmethod
 | validate_component_configuration(component_id: ComponentId, configuration: Dict) -> None

Validate the component configuration of an agent configuration file.

This check is to detect inconsistencies in the specified fields.

Arguments:

  • component_id: the component id.
  • configuration: the configuration dictionary.

Returns:

None

Raises:

  • ValueError: if the configuration is not valid.

ConfigLoaders Objects

class ConfigLoaders()

Configuration Loader class to load any package type.

from_package_type

 | @classmethod
 | from_package_type(cls, configuration_type: Union[PackageType, str]) -> "ConfigLoader"

Get a config loader from the configuration type.

Arguments:

  • configuration_type: the configuration type

load_component_configuration

load_component_configuration(component_type: ComponentType, directory: Path, skip_consistency_check: bool = False) -> "ComponentConfiguration"

Load configuration and check that it is consistent against the directory.

Arguments:

  • component_type: the component type.
  • directory: the root of the package
  • skip_consistency_check: if True, the consistency check are skipped.

Returns:

the configuration object.