diff --git a/Pipfile b/Pipfile index 8567bbff23..f24da81e2f 100644 --- a/Pipfile +++ b/Pipfile @@ -15,9 +15,9 @@ aiohttp = "==3.7.4.post0" asn1crypto = "==1.4.0" bandit = "==1.7.0" bech32 = "==1.2.0" -black = "==19.10b0" +black = "==22.1.0" bs4 = "==0.0.1" -click = "==8.0.4" +click = "==8.0.2" darglint = "==1.8.0" defusedxml = "==0.6.0" docker = "==4.2.0" diff --git a/aea/aea.py b/aea/aea.py index 3a88dc5dee..461f2bd9a4 100644 --- a/aea/aea.py +++ b/aea/aea.py @@ -132,7 +132,8 @@ def __init__( self._connection_exception_policy = connection_exception_policy aea_logger = AgentLoggerAdapter( - logger=get_logger(__name__, identity.name), agent_name=identity.name, + logger=get_logger(__name__, identity.name), + agent_name=identity.name, ) self._resources = resources @@ -408,7 +409,10 @@ def get_message_handlers(self) -> List[Tuple[Callable[[Any], None], Callable]]: :return: List of tuples of callables: handler and coroutine to get a message """ return super().get_message_handlers() + [ - (self.filter.handle_internal_message, self.filter.get_internal_message,), + ( + self.filter.handle_internal_message, + self.filter.get_internal_message, + ), (self.handle_envelope, self.runtime.agent_loop.skill2skill_queue.get), ] diff --git a/aea/aea_builder.py b/aea/aea_builder.py index 22bfc23d6c..17c591ae18 100644 --- a/aea/aea_builder.py +++ b/aea/aea_builder.py @@ -521,7 +521,9 @@ def _load_decision_maker_handler_class( return _class - def _load_error_handler_class(self,) -> Optional[Type[AbstractErrorHandler]]: + def _load_error_handler_class( + self, + ) -> Optional[Type[AbstractErrorHandler]]: """ Load error handler class. @@ -1096,7 +1098,9 @@ def get_build_root_directory(self) -> str: @classmethod def run_build_for_component_configuration( - cls, config: ComponentConfiguration, logger: Optional[logging.Logger] = None, + cls, + config: ComponentConfiguration, + logger: Optional[logging.Logger] = None, ) -> None: """Run a build entrypoint script for component configuration.""" if not config.build_entrypoint: @@ -1242,7 +1246,8 @@ def _build_identity_from_wallet(self, wallet: Wallet) -> Identity: return identity def _process_connection_ids( # pylint: disable=unsubscriptable-object - self, connection_ids: Optional[Collection[PublicId]] = None, + self, + connection_ids: Optional[Collection[PublicId]] = None, ) -> List[PublicId]: """ Process connection ids. @@ -1423,7 +1428,9 @@ def _get_max_reactions(self) -> int: else self.DEFAULT_MAX_REACTIONS ) - def _get_error_handler_class(self,) -> Optional[Type]: + def _get_error_handler_class( + self, + ) -> Optional[Type]: """ Return the error handler class. @@ -1431,7 +1438,9 @@ def _get_error_handler_class(self,) -> Optional[Type]: """ return self._error_handler_class - def _get_error_handler_config(self,) -> Optional[Dict[str, Any]]: + def _get_error_handler_config( + self, + ) -> Optional[Dict[str, Any]]: """ Return the error handler config. @@ -1449,7 +1458,9 @@ def _get_decision_maker_handler_class( """ return self._decision_maker_handler_class - def _get_decision_maker_handler_config(self,) -> Optional[Dict[str, Any]]: + def _get_decision_maker_handler_config( + self, + ) -> Optional[Dict[str, Any]]: """ Return the decision maker handler config. @@ -1683,10 +1694,12 @@ def _check_valid_entrypoint(build_entrypoint: str, directory: str) -> None: build_entrypoint = cast(str, build_entrypoint) script_path = Path(directory) / build_entrypoint enforce( - script_path.exists(), f"File '{build_entrypoint}' does not exists.", + script_path.exists(), + f"File '{build_entrypoint}' does not exists.", ) enforce( - script_path.is_file(), f"'{build_entrypoint}' is not a file.", + script_path.is_file(), + f"'{build_entrypoint}' is not a file.", ) try: ast.parse(script_path.read_text()) @@ -2021,7 +2034,8 @@ def _preliminary_checks_before_build(self) -> None: def make_component_logger( - configuration: ComponentConfiguration, agent_name: str, + configuration: ComponentConfiguration, + agent_name: str, ) -> Optional[logging.Logger]: """ Make the logger for a component. diff --git a/aea/agent_loop.py b/aea/agent_loop.py index ed403169b3..e12396e2d8 100644 --- a/aea/agent_loop.py +++ b/aea/agent_loop.py @@ -235,7 +235,10 @@ def send_to_skill( elif isinstance(message_or_envelope, Message): message = message_or_envelope envelope = Envelope( - to=message.to, sender=message.sender, message=message, context=context, + to=message.to, + sender=message.sender, + message=message, + context=context, ) else: raise ValueError( diff --git a/aea/cli/add.py b/aea/cli/add.py index 65bc2d467d..285409eb72 100644 --- a/aea/cli/add.py +++ b/aea/cli/add.py @@ -214,7 +214,10 @@ def fetch_item_remote( click.echo("Will try with http repository.") return fetch_package( - item_type, public_id=item_public_id, cwd=ctx.cwd, dest=dest_path, + item_type, + public_id=item_public_id, + cwd=ctx.cwd, + dest=dest_path, ) @@ -241,7 +244,10 @@ def find_item_locally_or_distributed( def fetch_item_mixed( - ctx: Context, item_type: str, item_public_id: PublicId, dest_path: str, + ctx: Context, + item_type: str, + item_public_id: PublicId, + dest_path: str, ) -> Path: """ Find item, mixed mode.That is, give priority to local registry, and fall back to remote registry in case of failure. diff --git a/aea/cli/add_key.py b/aea/cli/add_key.py index d76260df97..b28732cf0e 100644 --- a/aea/cli/add_key.py +++ b/aea/cli/add_key.py @@ -48,7 +48,10 @@ required=True, ) @click.argument( - "file", metavar="FILE", type=key_file_argument, required=False, + "file", + metavar="FILE", + type=key_file_argument, + required=False, ) @password_option() @click.option( diff --git a/aea/cli/build.py b/aea/cli/build.py index caf8cbed94..19c0d81201 100644 --- a/aea/cli/build.py +++ b/aea/cli/build.py @@ -48,7 +48,8 @@ def build_aea(skip_consistency_check: bool) -> None: """ try: builder = AEABuilder.from_aea_project( - Path("."), skip_consistency_check=skip_consistency_check, + Path("."), + skip_consistency_check=skip_consistency_check, ) builder.call_all_build_entrypoints() except Exception as e: diff --git a/aea/cli/check_packages.py b/aea/cli/check_packages.py index 3aa148e4bb..652ab159aa 100644 --- a/aea/cli/check_packages.py +++ b/aea/cli/check_packages.py @@ -75,7 +75,11 @@ def __init__( class EmptyPackageDescription(Exception): """Custom exception for empty description field.""" - def __init__(self, configuration_file: Path, *args: Any,) -> None: + def __init__( + self, + configuration_file: Path, + *args: Any, + ) -> None: """ Initialize EmptyPackageDescription exception. diff --git a/aea/cli/create.py b/aea/cli/create.py index 9f00798d41..0fb8507c45 100644 --- a/aea/cli/create.py +++ b/aea/cli/create.py @@ -82,7 +82,10 @@ def create( @clean_after def create_aea( - ctx: Context, agent_name: str, author: Optional[str] = None, empty: bool = False, + ctx: Context, + agent_name: str, + author: Optional[str] = None, + empty: bool = False, ) -> None: """ Create AEA project. diff --git a/aea/cli/delete.py b/aea/cli/delete.py index 9783491f59..ba30bba5a4 100644 --- a/aea/cli/delete.py +++ b/aea/cli/delete.py @@ -32,7 +32,9 @@ @click.command() @click.argument( - "agent_name", type=AgentDirectory(), required=True, + "agent_name", + type=AgentDirectory(), + required=True, ) @click.pass_context def delete(click_context: click.Context, agent_name: str) -> None: diff --git a/aea/cli/fetch.py b/aea/cli/fetch.py index 10daadba09..a0ad5ba4eb 100644 --- a/aea/cli/fetch.py +++ b/aea/cli/fetch.py @@ -63,7 +63,10 @@ @click.command(name="fetch") @registry_flag() @click.option( - "--alias", type=str, required=False, help="Provide a local alias for the agent.", + "--alias", + type=str, + required=False, + help="Provide a local alias for the agent.", ) @click.argument("public-id", type=PublicIdParameter(), required=True) @click.pass_context diff --git a/aea/cli/fingerprint.py b/aea/cli/fingerprint.py index 2e1da459f1..5ca52a1335 100644 --- a/aea/cli/fingerprint.py +++ b/aea/cli/fingerprint.py @@ -47,7 +47,9 @@ @click.group(invoke_without_command=True) @click.pass_context -def fingerprint(click_context: click.core.Context,) -> None: +def fingerprint( + click_context: click.core.Context, +) -> None: """Fingerprint a non-vendor package of the agent.""" if click_context.invoked_subcommand is None: fingerprint_agent(click_context) diff --git a/aea/cli/generate_all_protocols.py b/aea/cli/generate_all_protocols.py index 1286bc5a54..1abc680285 100644 --- a/aea/cli/generate_all_protocols.py +++ b/aea/cli/generate_all_protocols.py @@ -129,7 +129,12 @@ def run_isort_and_black(directory: Path, **kwargs: Any) -> None: raise click.ClickException(str(e)) from e AEAProject.run_cli( - sys.executable, "-m", "black", "-q", str(directory.absolute()), **kwargs, + sys.executable, + "-m", + "black", + "-q", + str(directory.absolute()), + **kwargs, ) AEAProject.run_cli( sys.executable, @@ -183,7 +188,9 @@ def _fingerprint_protocol(name: str) -> None: """Fingerprint the generated (and modified) protocol.""" log(f"Fingerprint the generated (and modified) protocol '{name}'") protocol_config = load_component_configuration( - ComponentType.PROTOCOL, Path(PROTOCOLS, name), skip_consistency_check=True, + ComponentType.PROTOCOL, + Path(PROTOCOLS, name), + skip_consistency_check=True, ) AEAProject.run_aea("fingerprint", "protocol", str(protocol_config.public_id)) @@ -430,7 +437,9 @@ def _process_packages_protocol( default=Path(".").resolve(), ) @click.option( - "--check-clean", is_flag=True, help="Check if git tree is clean..", + "--check-clean", + is_flag=True, + help="Check if git tree is clean..", ) def generate_all_protocols( packages_dir: Path, @@ -454,7 +463,10 @@ def generate_all_protocols( if not no_bump: _bump_protocol_specification_id_if_needed(package_path) _process_packages_protocol( - package_path, no_bump, no_format, root_dir, + package_path, + no_bump, + no_format, + root_dir, ) if check_clean: diff --git a/aea/cli/generate_key.py b/aea/cli/generate_key.py index 8b51ccb4e6..a797ec9708 100644 --- a/aea/cli/generate_key.py +++ b/aea/cli/generate_key.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,13 +46,18 @@ ) @password_option(confirmation_prompt=True) @click.option( - "--add-key", is_flag=True, help="Add key generated.", + "--add-key", + is_flag=True, + help="Add key generated.", ) @click.option( "--connection", is_flag=True, help="For adding a private key for connections." ) @click.option( - "--extra-entropy", type=str, required=False, default="", + "--extra-entropy", + type=str, + required=False, + default="", ) @click.pass_context def generate_key( diff --git a/aea/cli/get_multiaddress.py b/aea/cli/get_multiaddress.py index 2df0a0a58b..a091912c0c 100644 --- a/aea/cli/get_multiaddress.py +++ b/aea/cli/get_multiaddress.py @@ -51,16 +51,32 @@ @password_option() @click.option("-c", "--connection", is_flag=True) @click.option( - "-i", "--connection-id", type=PublicIdParameter(), required=False, default=None, + "-i", + "--connection-id", + type=PublicIdParameter(), + required=False, + default=None, ) @click.option( - "-h", "--host-field", type=str, required=False, default=None, + "-h", + "--host-field", + type=str, + required=False, + default=None, ) @click.option( - "-p", "--port-field", type=str, required=False, default=None, + "-p", + "--port-field", + type=str, + required=False, + default=None, ) @click.option( - "-u", "--uri-field", type=str, required=False, default="public_uri", + "-u", + "--uri-field", + type=str, + required=False, + default="public_uri", ) @click.pass_context @check_aea_project diff --git a/aea/cli/ipfs_hash.py b/aea/cli/ipfs_hash.py index 5798ac80c5..6ff0a37b6a 100644 --- a/aea/cli/ipfs_hash.py +++ b/aea/cli/ipfs_hash.py @@ -138,7 +138,9 @@ def hash_package( raise ValueError("configuration.directory cannot be None.") key = os.path.join( - configuration.author, package_type.to_plural(), configuration.directory.name, + configuration.author, + package_type.to_plural(), + configuration.directory.name, ) package_hash = IPFSHashOnly.hash_directory( str(configuration.directory), wrap=(not no_wrap) @@ -342,7 +344,10 @@ def hash_group() -> None: @click.option("--no-wrap", is_flag=True) @click.option("--check", is_flag=True) def generate_all( - packages_dir: Path, vendor: Optional[str], no_wrap: bool, check: bool, + packages_dir: Path, + vendor: Optional[str], + no_wrap: bool, + check: bool, ) -> None: """Generate IPFS hashes.""" packages_dir = Path(packages_dir).absolute() diff --git a/aea/cli/issue_certificates.py b/aea/cli/issue_certificates.py index 176f7dd0fe..5ef2507f4b 100644 --- a/aea/cli/issue_certificates.py +++ b/aea/cli/issue_certificates.py @@ -57,7 +57,8 @@ def issue_certificates( """Issue certificates for connections that require them.""" ctx = cast(Context, click_context.obj) agent_config_manager = AgentConfigManager.load( - ctx.cwd, substitude_env_vars=apply_environment_variables, + ctx.cwd, + substitude_env_vars=apply_environment_variables, ) issue_certificates_(ctx.cwd, agent_config_manager, password=password) diff --git a/aea/cli/publish.py b/aea/cli/publish.py index 96dc2f66ce..87470f408f 100644 --- a/aea/cli/publish.py +++ b/aea/cli/publish.py @@ -349,7 +349,10 @@ def _save_agent_locally( item_type_plural = AGENTS target_dir = try_get_item_target_path( - registry_path, ctx.agent_config.author, item_type_plural, ctx.agent_config.name, + registry_path, + ctx.agent_config.author, + item_type_plural, + ctx.agent_config.name, ) if not os.path.exists(target_dir): os.makedirs(target_dir, exist_ok=True) diff --git a/aea/cli/push.py b/aea/cli/push.py index 10755b40fb..d843cd987a 100644 --- a/aea/cli/push.py +++ b/aea/cli/push.py @@ -127,7 +127,10 @@ def _save_item_locally(ctx: Context, item_type: str, item_id: PublicId) -> None: except ValueError as e: # pragma: nocover raise click.ClickException(str(e)) target_path = try_get_item_target_path( - registry_path, item_id.author, item_type_plural, item_id.name, + registry_path, + item_id.author, + item_type_plural, + item_id.name, ) copytree(source_path, target_path) click.echo( @@ -136,7 +139,10 @@ def _save_item_locally(ctx: Context, item_type: str, item_id: PublicId) -> None: def push_item_from_path( - context: click.Context, component_type: str, path: Path, registry: str, + context: click.Context, + component_type: str, + path: Path, + registry: str, ) -> None: """Push item from path.""" @@ -171,7 +177,10 @@ def push_item_local( registry_path = cast(str, registry_path) target_path = try_get_item_target_path( - registry_path, item_id.author, item_type_plural, item_id.name, + registry_path, + item_id.author, + item_type_plural, + item_id.name, ) copytree(component_path, target_path) click.echo( diff --git a/aea/cli/registry/fetch.py b/aea/cli/registry/fetch.py index 4b6aaaa5c4..e23a8cbe8b 100644 --- a/aea/cli/registry/fetch.py +++ b/aea/cli/registry/fetch.py @@ -80,7 +80,8 @@ def fetch_agent( if alias or target_dir: shutil.move( - os.path.join(ctx.cwd, name), aea_folder, + os.path.join(ctx.cwd, name), + aea_folder, ) ctx.cwd = aea_folder diff --git a/aea/cli/remove_key.py b/aea/cli/remove_key.py index f314691dc9..9285deeea0 100644 --- a/aea/cli/remove_key.py +++ b/aea/cli/remove_key.py @@ -50,7 +50,9 @@ def remove_key(click_context: click.Context, type_: str, connection: bool) -> No def _remove_private_key( - click_context: click.core.Context, type_: str, connection: bool = False, + click_context: click.core.Context, + type_: str, + connection: bool = False, ) -> None: """ Remove private key to the wallet. diff --git a/aea/cli/run.py b/aea/cli/run.py index ed40a84166..f8a4a6fa71 100644 --- a/aea/cli/run.py +++ b/aea/cli/run.py @@ -194,7 +194,10 @@ def _profiling_context(period: int) -> Generator: Protocol, ] - profiler = Profiling(period=period, types_to_track=TYPES_TO_TRACK,) + profiler = Profiling( + period=period, + types_to_track=TYPES_TO_TRACK, + ) profiler.start() try: yield None diff --git a/aea/cli/scaffold.py b/aea/cli/scaffold.py index 9e2fbdeb69..6be041161e 100644 --- a/aea/cli/scaffold.py +++ b/aea/cli/scaffold.py @@ -71,7 +71,9 @@ @click.pass_context @check_aea_project def scaffold( - click_context: click.core.Context, with_symlinks: bool, to_local_registry: bool, + click_context: click.core.Context, + with_symlinks: bool, + to_local_registry: bool, ) -> None: # pylint: disable=unused-argument """Scaffold a package for the agent.""" ctx = cast(Context, click_context.obj) diff --git a/aea/cli/transfer.py b/aea/cli/transfer.py index 7780eb2e64..7cae644a61 100644 --- a/aea/cli/transfer.py +++ b/aea/cli/transfer.py @@ -49,10 +49,14 @@ required=True, ) @click.argument( - "address", type=str, required=True, + "address", + type=str, + required=True, ) @click.argument( - "amount", type=int, required=True, + "amount", + type=int, + required=True, ) @click.argument("fee", type=int, required=False, default=100) @password_option() diff --git a/aea/cli/utils/click_utils.py b/aea/cli/utils/click_utils.py index 594b7cbba7..a1f16b5d52 100644 --- a/aea/cli/utils/click_utils.py +++ b/aea/cli/utils/click_utils.py @@ -279,7 +279,9 @@ def registry_path_option(f: Callable) -> Callable: )(f) -def component_flag(wrap_public_id: bool = False,) -> Callable: +def component_flag( + wrap_public_id: bool = False, +) -> Callable: """Wraps a command with component types argument""" def wrapper(f: Callable) -> Callable: diff --git a/aea/cli/utils/context.py b/aea/cli/utils/context.py index 781d0ef074..b68a96be9a 100644 --- a/aea/cli/utils/context.py +++ b/aea/cli/utils/context.py @@ -62,7 +62,9 @@ def __init__(self, cwd: str, verbosity: str, registry_path: Optional[str]) -> No self._registry_type = None @property - def registry_type(self,) -> str: + def registry_type( + self, + ) -> str: """Returns registry type to be used for session""" if self._registry_type is None: logger.warning("Registry not set, returning local as registry type") diff --git a/aea/cli/utils/decorators.py b/aea/cli/utils/decorators.py index f22761c5c3..723e2547e9 100644 --- a/aea/cli/utils/decorators.py +++ b/aea/cli/utils/decorators.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -69,7 +69,10 @@ def _validate_config_consistency(ctx: Context, check_aea_version: bool = True) - packages_public_ids_to_types = dict( [ *map(lambda x: (x, PackageType.PROTOCOL), ctx.agent_config.protocols), - *map(lambda x: (x, PackageType.CONNECTION), ctx.agent_config.connections,), + *map( + lambda x: (x, PackageType.CONNECTION), + ctx.agent_config.connections, + ), *map(lambda x: (x, PackageType.SKILL), ctx.agent_config.skills), *map(lambda x: (x, PackageType.CONTRACT), ctx.agent_config.contracts), ] diff --git a/aea/cli/utils/package_utils.py b/aea/cli/utils/package_utils.py index 89cc401dcc..fbe5dd011a 100644 --- a/aea/cli/utils/package_utils.py +++ b/aea/cli/utils/package_utils.py @@ -85,7 +85,9 @@ def verify_private_keys_ctx( - ctx: Context, aea_project_path: Path = ROOT, password: Optional[str] = None, + ctx: Context, + aea_project_path: Path = ROOT, + password: Optional[str] = None, ) -> None: """ Verify private keys with ctx provided. @@ -102,7 +104,9 @@ def verify_private_keys_ctx( password=password, ).dump_config() agent_config = AgentConfigManager.verify_private_keys( - aea_project_path, private_key_helper=private_key_verify, password=password, + aea_project_path, + private_key_helper=private_key_verify, + password=password, ).agent_config if ctx is not None: ctx.agent_config = agent_config diff --git a/aea/components/loader.py b/aea/components/loader.py index 860ddbc902..f3d15fb861 100644 --- a/aea/components/loader.py +++ b/aea/components/loader.py @@ -159,7 +159,9 @@ def get_new_error_message_with_package_found() -> str: e_str = parse_exception(new_exc) raise AEAPackageLoadingError( "Package loading error: An error occurred while loading {} {}:\n{}".format( - str(configuration.component_type), configuration.public_id, e_str, + str(configuration.component_type), + configuration.public_id, + e_str, ) ) diff --git a/aea/configurations/base.py b/aea/configurations/base.py index 7fc503d4f5..15c8fcf510 100644 --- a/aea/configurations/base.py +++ b/aea/configurations/base.py @@ -613,17 +613,29 @@ def __init__( enforce(version != "", "Version or connection_id must be set.") else: enforce( - name in ("", connection_id.name,), + name + in ( + "", + connection_id.name, + ), "Non matching name in ConnectionConfig name and public id.", ) name = connection_id.name enforce( - author in ("", connection_id.author,), + author + in ( + "", + connection_id.author, + ), "Non matching author in ConnectionConfig author and public id.", ) author = connection_id.author enforce( - version in ("", connection_id.version,), + version + in ( + "", + connection_id.version, + ), "Non matching version in ConnectionConfig version and public id.", ) version = connection_id.version @@ -1507,17 +1519,35 @@ def _create_or_update_from_json( # parse connection public ids agent_config.connections = set( - map(PublicId.from_str, obj.get(CONNECTIONS, []),) + map( + PublicId.from_str, + obj.get(CONNECTIONS, []), + ) ) # parse contracts public ids - agent_config.contracts = set(map(PublicId.from_str, obj.get(CONTRACTS, []),)) + agent_config.contracts = set( + map( + PublicId.from_str, + obj.get(CONTRACTS, []), + ) + ) # parse protocol public ids - agent_config.protocols = set(map(PublicId.from_str, obj.get(PROTOCOLS, []),)) + agent_config.protocols = set( + map( + PublicId.from_str, + obj.get(PROTOCOLS, []), + ) + ) # parse skills public ids - agent_config.skills = set(map(PublicId.from_str, obj.get(SKILLS, []),)) + agent_config.skills = set( + map( + PublicId.from_str, + obj.get(SKILLS, []), + ) + ) # parse component configurations component_configurations = {} diff --git a/aea/configurations/data_types.py b/aea/configurations/data_types.py index e56fcc3255..c466c7d701 100644 --- a/aea/configurations/data_types.py +++ b/aea/configurations/data_types.py @@ -244,11 +244,11 @@ class PublicId(JSONSerializable): PACKAGE_NAME_REGEX = SIMPLE_ID_REGEX VERSION_NUMBER_PART_REGEX = r"(0|[1-9]\d*)" - VERSION_REGEX = fr"(any|latest|({VERSION_NUMBER_PART_REGEX})\.({VERSION_NUMBER_PART_REGEX})\.({VERSION_NUMBER_PART_REGEX})(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)" + VERSION_REGEX = rf"(any|latest|({VERSION_NUMBER_PART_REGEX})\.({VERSION_NUMBER_PART_REGEX})\.({VERSION_NUMBER_PART_REGEX})(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)" PUBLIC_ID_URI_REGEX = ( - fr"^({AUTHOR_REGEX})/({PACKAGE_NAME_REGEX})/({VERSION_REGEX})$" + rf"^({AUTHOR_REGEX})/({PACKAGE_NAME_REGEX})/({VERSION_REGEX})$" ) - PUBLIC_ID_REGEX = fr"^({AUTHOR_REGEX})/({PACKAGE_NAME_REGEX})(:{VERSION_REGEX})?(:{IPFS_HASH_REGEX})?$" + PUBLIC_ID_REGEX = rf"^({AUTHOR_REGEX})/({PACKAGE_NAME_REGEX})(:{VERSION_REGEX})?(:{IPFS_HASH_REGEX})?$" ANY_VERSION = "any" LATEST_VERSION = "latest" @@ -293,7 +293,9 @@ def package_version(self) -> PackageVersion: return self._package_version @property - def hash(self,) -> str: + def hash( + self, + ) -> str: """Returns the hash for the package.""" if self._package_hash is None: raise ValueError("Package hash was not provided.") @@ -490,7 +492,9 @@ def __lt__(self, other: Any) -> bool: ) ) - def without_hash(self,) -> "PublicId": + def without_hash( + self, + ) -> "PublicId": """Returns a `PublicId` object with same parameters.""" return PublicId(self.author, self.name, self.version) @@ -611,7 +615,9 @@ def to_uri_path(self) -> str: """ return f"{str(self.package_type)}/{self.author}/{self.name}/{self.version}" - def without_hash(self,) -> "PackageId": + def without_hash( + self, + ) -> "PackageId": """Returns PackageId object without hash""" return PackageId(self.package_type, self.public_id.without_hash()) @@ -622,7 +628,8 @@ def __hash__(self) -> int: def __str__(self) -> str: """Get the string representation.""" return "({package_type}, {public_id})".format( - package_type=self.package_type.value, public_id=self.public_id, + package_type=self.package_type.value, + public_id=self.public_id, ) def __repr__(self) -> str: @@ -704,10 +711,13 @@ def json(self) -> Dict: def from_json(cls, json_data: Dict) -> "ComponentId": """Create component id from json data.""" return cls( - component_type=json_data["type"], public_id=PublicId.from_json(json_data), + component_type=json_data["type"], + public_id=PublicId.from_json(json_data), ) - def without_hash(self,) -> "ComponentId": + def without_hash( + self, + ) -> "ComponentId": """Returns PackageId object without hash""" return ComponentId(self.component_type, self.public_id.without_hash()) diff --git a/aea/configurations/manager.py b/aea/configurations/manager.py index c5bfa9d988..349ad2a5e1 100644 --- a/aea/configurations/manager.py +++ b/aea/configurations/manager.py @@ -140,7 +140,9 @@ def _try_get_component_id_from_prefix( def handle_dotted_path( - value: str, author: str, aea_project_path: Union[str, Path] = ".", + value: str, + author: str, + aea_project_path: Union[str, Path] = ".", ) -> Tuple[List[str], Path, ConfigLoader, Optional[ComponentId]]: """Separate the path between path to resource and json path to attribute. @@ -310,7 +312,9 @@ def __init__( self.env_vars_friendly = env_vars_friendly def load_component_configuration( - self, component_id: ComponentId, skip_consistency_check: bool = True, + self, + component_id: ComponentId, + skip_consistency_check: bool = True, ) -> ComponentConfiguration: """ Load component configuration from the project directory. diff --git a/aea/configurations/utils.py b/aea/configurations/utils.py index 9014f54f83..36fb039823 100644 --- a/aea/configurations/utils.py +++ b/aea/configurations/utils.py @@ -50,7 +50,8 @@ def replace_component_ids( @replace_component_ids.register(AgentConfig) # type: ignore def _( - arg: AgentConfig, replacements: Dict[ComponentType, Dict[PublicId, PublicId]], + arg: AgentConfig, + replacements: Dict[ComponentType, Dict[PublicId, PublicId]], ) -> None: """ Replace references in agent configuration. @@ -112,14 +113,16 @@ def _( @replace_component_ids.register(ProtocolConfig) # type: ignore def _( - _arg: ProtocolConfig, _replacements: Dict[ComponentType, Dict[PublicId, PublicId]], + _arg: ProtocolConfig, + _replacements: Dict[ComponentType, Dict[PublicId, PublicId]], ) -> None: """Do nothing - protocols have no references.""" @replace_component_ids.register(ConnectionConfig) # type: ignore def _( - arg: ConnectionConfig, replacements: Dict[ComponentType, Dict[PublicId, PublicId]], + arg: ConnectionConfig, + replacements: Dict[ComponentType, Dict[PublicId, PublicId]], ) -> None: """Replace references in a connection configuration.""" _replace_component_id( @@ -140,14 +143,16 @@ def _( @replace_component_ids.register(ContractConfig) # type: ignore def _( # type: ignore - _arg: ContractConfig, _replacements: Dict[ComponentType, Dict[PublicId, PublicId]], + _arg: ContractConfig, + _replacements: Dict[ComponentType, Dict[PublicId, PublicId]], ) -> None: """Do nothing - contracts have no references.""" @replace_component_ids.register(SkillConfig) # type: ignore def _( - arg: SkillConfig, replacements: Dict[ComponentType, Dict[PublicId, PublicId]], + arg: SkillConfig, + replacements: Dict[ComponentType, Dict[PublicId, PublicId]], ) -> None: """Replace references in a skill configuration.""" _replace_component_id( diff --git a/aea/connections/base.py b/aea/connections/base.py index 9eb6cfd057..81a9075ed6 100644 --- a/aea/connections/base.py +++ b/aea/connections/base.py @@ -394,7 +394,8 @@ def _task_done_callback(self, task: asyncio.Task) -> None: # cause task.get_name for python3.8+ task_name = getattr(task, "task_name", "TASK NAME NOT SET") self.logger.exception( - f"in task `{task_name}`, exception occurred", exc_info=task.exception(), + f"in task `{task_name}`, exception occurred", + exc_info=task.exception(), ) async def _run_in_pool(self, fn: Callable, *args: Any) -> Any: diff --git a/aea/contracts/base.py b/aea/contracts/base.py index 2a43d715b2..53a7866af3 100644 --- a/aea/contracts/base.py +++ b/aea/contracts/base.py @@ -248,7 +248,10 @@ def build_transaction( @classmethod def get_transaction_transfer_logs( - cls, ledger_api: LedgerApi, tx_hash: str, target_address: Optional[str] = None, + cls, + ledger_api: LedgerApi, + tx_hash: str, + target_address: Optional[str] = None, ) -> Optional[JSONLike]: """ Retrieve the logs from a transaction. diff --git a/aea/crypto/base.py b/aea/crypto/base.py index 554fcf5d11..c4bd1c9365 100644 --- a/aea/crypto/base.py +++ b/aea/crypto/base.py @@ -213,7 +213,11 @@ def is_transaction_settled(tx_receipt: JSONLike) -> bool: @staticmethod @abstractmethod def is_transaction_valid( - tx: JSONLike, seller: Address, client: Address, tx_nonce: str, amount: int, + tx: JSONLike, + seller: Address, + client: Address, + tx_nonce: str, + amount: int, ) -> bool: """ Check whether a transaction is valid or not. @@ -450,7 +454,10 @@ def update_with_gas_estimate(self, transaction: JSONLike) -> JSONLike: @abstractmethod def contract_method_call( - self, contract_instance: Any, method_name: str, **method_args: Any, + self, + contract_instance: Any, + method_name: str, + **method_args: Any, ) -> Optional[JSONLike]: """Call a contract's method diff --git a/aea/crypto/helpers.py b/aea/crypto/helpers.py index 1e9fce444b..93b50e07dd 100644 --- a/aea/crypto/helpers.py +++ b/aea/crypto/helpers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,7 +37,9 @@ def try_validate_private_key_path( - ledger_id: str, private_key_path: str, password: Optional[str] = None, + ledger_id: str, + private_key_path: str, + password: Optional[str] = None, ) -> None: """ Try validate a private key path. @@ -52,8 +54,10 @@ def try_validate_private_key_path( # with private_key_path as parameter make_crypto(ledger_id, private_key_path=private_key_path, password=password) except Exception as e: # pylint: disable=broad-except # thats ok, reraise - error_msg = "This is not a valid private key file: '{}'\n Exception: '{}'".format( - private_key_path, e + error_msg = ( + "This is not a valid private key file: '{}'\n Exception: '{}'".format( + private_key_path, e + ) ) _default_logger.error(error_msg) raise @@ -95,7 +99,9 @@ def try_generate_testnet_wealth( def private_key_verify( - aea_conf: AgentConfig, aea_project_path: Path, password: Optional[str] = None, + aea_conf: AgentConfig, + aea_project_path: Path, + password: Optional[str] = None, ) -> None: """ Check key. @@ -130,7 +136,8 @@ def private_key_verify( except FileNotFoundError: # pragma: no cover raise ValueError( "File {} for private key {} not found.".format( - repr(config_private_key_path), identifier, + repr(config_private_key_path), + identifier, ) ) diff --git a/aea/crypto/ledger_apis.py b/aea/crypto/ledger_apis.py index 4845ff87ad..2cf27521c5 100644 --- a/aea/crypto/ledger_apis.py +++ b/aea/crypto/ledger_apis.py @@ -139,7 +139,12 @@ def get_transfer_transaction( ) api = make_ledger_api(identifier, **cls.ledger_api_configs[identifier]) tx = api.get_transfer_transaction( - sender_address, destination_address, amount, tx_fee, tx_nonce, **kwargs, + sender_address, + destination_address, + amount, + tx_fee, + tx_nonce, + **kwargs, ) return tx diff --git a/aea/crypto/registries/base.py b/aea/crypto/registries/base.py index 4bf31e1e9a..c567444010 100644 --- a/aea/crypto/registries/base.py +++ b/aea/crypto/registries/base.py @@ -32,7 +32,7 @@ """A regex to match a Python identifier (i.e. a module/class name).""" PY_ID_REGEX = r"[^\d\W]\w*" -ITEM_ID_REGEX = fr"({SIMPLE_ID_REGEX})|{PublicId.PUBLIC_ID_REGEX}" +ITEM_ID_REGEX = rf"({SIMPLE_ID_REGEX})|{PublicId.PUBLIC_ID_REGEX}" ItemType = TypeVar("ItemType") diff --git a/aea/decision_maker/base.py b/aea/decision_maker/base.py index 0504599bee..e0b1506d70 100644 --- a/aea/decision_maker/base.py +++ b/aea/decision_maker/base.py @@ -312,7 +312,10 @@ class DecisionMaker(WithLogger): "_stopped", ) - def __init__(self, decision_maker_handler: DecisionMakerHandler,) -> None: + def __init__( + self, + decision_maker_handler: DecisionMakerHandler, + ) -> None: """ Initialize the decision maker. diff --git a/aea/decision_maker/default.py b/aea/decision_maker/default.py index c904eeef5f..1889c862d1 100644 --- a/aea/decision_maker/default.py +++ b/aea/decision_maker/default.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,7 +98,10 @@ def __init__( """ kwargs: Dict[str, Any] = {} super().__init__( - identity=identity, wallet=wallet, config=config, **kwargs, + identity=identity, + wallet=wallet, + config=config, + **kwargs, ) self.signing_dialogues = DecisionMakerHandler.SigningDialogues( self.self_address @@ -177,7 +180,9 @@ def _handle_message_signing( signing_msg.raw_message.is_deprecated_mode, ) signing_msg_response = signing_dialogue.reply( - performative=performative, target_message=signing_msg, **kwargs, + performative=performative, + target_message=signing_msg, + **kwargs, ) self.message_out_queue.put(signing_msg_response) @@ -204,6 +209,8 @@ def _handle_transaction_signing( signing_msg.raw_transaction.ledger_id, signed_tx ) signing_msg_response = signing_dialogue.reply( - performative=performative, target_message=signing_msg, **kwargs, + performative=performative, + target_message=signing_msg, + **kwargs, ) self.message_out_queue.put(signing_msg_response) diff --git a/aea/decision_maker/scaffold.py b/aea/decision_maker/scaffold.py index 0b7e616734..85e53f91ed 100644 --- a/aea/decision_maker/scaffold.py +++ b/aea/decision_maker/scaffold.py @@ -47,7 +47,10 @@ def __init__( } # type: Dict[str, Any] # You MUST NOT modify the constructor below: super().__init__( - identity=identity, wallet=wallet, config=config, **kwargs, + identity=identity, + wallet=wallet, + config=config, + **kwargs, ) def handle(self, message: Message) -> None: diff --git a/aea/helpers/base.py b/aea/helpers/base.py index eb4ad9a4c5..8eadf84c09 100644 --- a/aea/helpers/base.py +++ b/aea/helpers/base.py @@ -64,8 +64,8 @@ STRING_LENGTH_LIMIT = 128 IPFS_HASH_LENGTH_LIMIT = 46 -SIMPLE_ID_REGEX = fr"[a-zA-Z_][a-zA-Z0-9_]{{0,{STRING_LENGTH_LIMIT - 1}}}" -IPFS_HASH_REGEX = fr"[a-zA-Z_][a-zA-Z0-9]{{{IPFS_HASH_LENGTH_LIMIT - 1}}}" +SIMPLE_ID_REGEX = rf"[a-zA-Z_][a-zA-Z0-9_]{{0,{STRING_LENGTH_LIMIT - 1}}}" +IPFS_HASH_REGEX = rf"[a-zA-Z_][a-zA-Z0-9]{{{IPFS_HASH_LENGTH_LIMIT - 1}}}" ISO_8601_DATE_FORMAT = "%Y-%m-%d" _default_logger = logging.getLogger(__name__) @@ -431,7 +431,9 @@ def _is_dict_like(obj: Any) -> bool: def recursive_update( - to_update: Dict, new_values: Dict, allow_new_values: bool = False, + to_update: Dict, + new_values: Dict, + allow_new_values: bool = False, ) -> None: """ Update a dictionary by replacing conflicts with the new values. diff --git a/aea/helpers/constants.py b/aea/helpers/constants.py index 798b06aab4..f82a27f49c 100644 --- a/aea/helpers/constants.py +++ b/aea/helpers/constants.py @@ -24,7 +24,13 @@ FALSE_EQUIVALENTS = ["f", "false", "False", "0"] NULL_EQUIVALENTS = ["Null", "null", "None", "none"] FROM_STRING_TO_TYPE = dict( - str=str, int=int, bool=bool, float=float, dict=dict, list=list, none=None, + str=str, + int=int, + bool=bool, + float=float, + dict=dict, + list=list, + none=None, ) JSON_TYPES = Union[Dict, str, List, None, int, float] diff --git a/aea/helpers/file_io.py b/aea/helpers/file_io.py index ab323187f9..9100636ad9 100644 --- a/aea/helpers/file_io.py +++ b/aea/helpers/file_io.py @@ -91,7 +91,8 @@ def lock_file( :yield: generator """ with exception_log_and_reraise( - logger.error, f"Couldn't acquire lock for file {file_descriptor.name}: {{}}", + logger.error, + f"Couldn't acquire lock for file {file_descriptor.name}: {{}}", ): file_lock.lock(file_descriptor, file_lock.LOCK_EX) diff --git a/aea/helpers/file_lock.py b/aea/helpers/file_lock.py index 4d4b3d7006..2d4d4d5192 100644 --- a/aea/helpers/file_lock.py +++ b/aea/helpers/file_lock.py @@ -50,7 +50,6 @@ def unlock(file: IO) -> None: ) win32file.UnlockFileEx(hfile, 0, 0xFFFF0000, __overlapped) - elif os.name == "posix": # pragma: nocover # cause platform dependent! import fcntl from fcntl import LOCK_EX, LOCK_NB, LOCK_SH # noqa # pylint: disable=unused-import @@ -63,6 +62,5 @@ def unlock(file: IO) -> None: """Unlock a file.""" fcntl.flock(file.fileno(), fcntl.LOCK_UN) - else: # pragma: nocover raise RuntimeError("This module only works for nt and posix platforms") diff --git a/aea/helpers/fingerprint.py b/aea/helpers/fingerprint.py index a5850a2864..d3bfea24f6 100644 --- a/aea/helpers/fingerprint.py +++ b/aea/helpers/fingerprint.py @@ -59,7 +59,8 @@ def to_row(x: Tuple[str, str]) -> str: def compute_fingerprint( # pylint: disable=unsubscriptable-object - package_path: Path, fingerprint_ignore_patterns: Optional[Collection[str]], + package_path: Path, + fingerprint_ignore_patterns: Optional[Collection[str]], ) -> Dict[str, str]: """ Compute the fingerprint of a package. @@ -69,7 +70,8 @@ def compute_fingerprint( # pylint: disable=unsubscriptable-object :return: the fingerprint """ fingerprint = _compute_fingerprint( - package_path, ignore_patterns=fingerprint_ignore_patterns, + package_path, + ignore_patterns=fingerprint_ignore_patterns, ) return fingerprint diff --git a/aea/helpers/install_dependency.py b/aea/helpers/install_dependency.py index f8e34d51f6..f85c77a49a 100644 --- a/aea/helpers/install_dependency.py +++ b/aea/helpers/install_dependency.py @@ -54,7 +54,9 @@ def install_dependency( def install_dependencies( - dependencies: List[Dependency], logger: Logger, install_timeout: float = 300, + dependencies: List[Dependency], + logger: Logger, + install_timeout: float = 300, ) -> None: """ Install python dependencies to the current python environment. diff --git a/aea/helpers/ipfs/pb/unixfs_pb2.py b/aea/helpers/ipfs/pb/unixfs_pb2.py index 08d096b3c5..7388936f5a 100644 --- a/aea/helpers/ipfs/pb/unixfs_pb2.py +++ b/aea/helpers/ipfs/pb/unixfs_pb2.py @@ -177,7 +177,9 @@ ], extensions=[], nested_types=[], - enum_types=[_DATA_DATATYPE,], + enum_types=[ + _DATA_DATATYPE, + ], serialized_options=None, is_extendable=False, syntax="proto2", diff --git a/aea/helpers/logging.py b/aea/helpers/logging.py index 2091453bde..64b69ccdf7 100644 --- a/aea/helpers/logging.py +++ b/aea/helpers/logging.py @@ -69,7 +69,9 @@ class WithLogger: __slots__ = ("_logger", "_default_logger_name") def __init__( - self, logger: Optional[Logger] = None, default_logger_name: str = "aea", + self, + logger: Optional[Logger] = None, + default_logger_name: str = "aea", ) -> None: """ Initialize the logger. diff --git a/aea/helpers/profiling.py b/aea/helpers/profiling.py index d25f31e96f..1431f835b9 100644 --- a/aea/helpers/profiling.py +++ b/aea/helpers/profiling.py @@ -39,7 +39,7 @@ from aea.helpers.profiler_type_black_list import PROFILER_TYPE_BLACK_LIST -BYTES_TO_MBYTES = 1024 ** -2 +BYTES_TO_MBYTES = 1024**-2 lock = threading.Lock() @@ -65,7 +65,6 @@ def get_current_process_cpu_time() -> float: d = win32process.GetProcessTimes(win32process.GetCurrentProcess()) # type: ignore return d["UserTime"] / WIN32_PROCESS_TIMES_TICKS_PER_SECOND - else: import resource import tracemalloc diff --git a/aea/helpers/search/models.py b/aea/helpers/search/models.py index dbc34949a9..e4157a6f41 100644 --- a/aea/helpers/search/models.py +++ b/aea/helpers/search/models.py @@ -446,7 +446,9 @@ def _check_consistency(self) -> None: # value type matches data model, but it is not an allowed type raise AttributeInconsistencyException( "Attribute {} has unallowed type: {}. Allowed types: {}".format( - attribute.name, type(value), ALLOWED_ATTRIBUTE_TYPES, + attribute.name, + type(value), + ALLOWED_ATTRIBUTE_TYPES, ) ) @@ -1007,19 +1009,23 @@ def decode(cls, constraint_type_pb: Any, category: str) -> "ConstraintType": value_case = constraint_type_pb.values.WhichOneof("values") if value_case == proto_set_values["string"]: decoding = ConstraintType( - set_enum, tuple(constraint_type_pb.values.string.values), + set_enum, + tuple(constraint_type_pb.values.string.values), ) elif value_case == proto_set_values["boolean"]: decoding = ConstraintType( - set_enum, tuple(constraint_type_pb.values.boolean.values), + set_enum, + tuple(constraint_type_pb.values.boolean.values), ) elif value_case == proto_set_values["integer"]: decoding = ConstraintType( - set_enum, tuple(constraint_type_pb.values.integer.values), + set_enum, + tuple(constraint_type_pb.values.integer.values), ) elif value_case == proto_set_values["double"]: decoding = ConstraintType( - set_enum, tuple(constraint_type_pb.values.double.values), + set_enum, + tuple(constraint_type_pb.values.double.values), ) elif value_case == proto_set_values["location"]: locations = [ @@ -1625,7 +1631,10 @@ def _decode(cls, query_pb: Any) -> "Query": ] data_model = DataModel.decode(query_pb.model) - return cls(constraints, data_model if query_pb.HasField("model") else None,) + return cls( + constraints, + data_model if query_pb.HasField("model") else None, + ) @classmethod def decode(cls, query_pb: Any) -> "Query": @@ -1654,7 +1663,12 @@ def haversine(lat1: float, lon1: float, lat2: float, lon2: float) -> float: :param lon2: the longitude of the second location. :return: the Haversine distance. """ - lat1, lon1, lat2, lon2, = map(radians, [lat1, lon1, lat2, lon2]) + ( + lat1, + lon1, + lat2, + lon2, + ) = map(radians, [lat1, lon1, lat2, lon2]) earth_radius = 6372.8 # average earth radius dlat = lat2 - lat1 dlon = lon2 - lon1 diff --git a/aea/helpers/search/models_pb2.py b/aea/helpers/search/models_pb2.py index c66e9aadf1..055bcb6439 100644 --- a/aea/helpers/search/models_pb2.py +++ b/aea/helpers/search/models_pb2.py @@ -185,7 +185,9 @@ ], extensions=[], nested_types=[], - enum_types=[_QUERY_ATTRIBUTE_TYPE,], + enum_types=[ + _QUERY_ATTRIBUTE_TYPE, + ], serialized_options=None, is_extendable=False, syntax="proto3", @@ -981,7 +983,9 @@ ], extensions=[], nested_types=[], - enum_types=[_QUERY_RELATION_OPERATOR,], + enum_types=[ + _QUERY_RELATION_OPERATOR, + ], serialized_options=None, is_extendable=False, syntax="proto3", @@ -1350,8 +1354,12 @@ ), ], extensions=[], - nested_types=[_QUERY_SET_VALUES,], - enum_types=[_QUERY_SET_OPERATOR,], + nested_types=[ + _QUERY_SET_VALUES, + ], + enum_types=[ + _QUERY_SET_OPERATOR, + ], serialized_options=None, is_extendable=False, syntax="proto3", diff --git a/aea/helpers/transaction/base.py b/aea/helpers/transaction/base.py index 48fe915374..760860f782 100644 --- a/aea/helpers/transaction/base.py +++ b/aea/helpers/transaction/base.py @@ -38,7 +38,11 @@ class RawTransaction: __slots__ = ("_ledger_id", "_body") - def __init__(self, ledger_id: str, body: JSONLike,) -> None: + def __init__( + self, + ledger_id: str, + body: JSONLike, + ) -> None: """Initialise an instance of RawTransaction.""" self._ledger_id = ledger_id self._body = body @@ -77,8 +81,8 @@ def encode( "body": raw_transaction_object.body, } - raw_transaction_protobuf_object.raw_transaction = DictProtobufStructSerializer.encode( - raw_transaction_dict + raw_transaction_protobuf_object.raw_transaction = ( + DictProtobufStructSerializer.encode(raw_transaction_dict) ) @classmethod @@ -107,7 +111,8 @@ def __eq__(self, other: Any) -> bool: def __str__(self) -> str: """Get string representation.""" return "RawTransaction: ledger_id={}, body={}".format( - self.ledger_id, self.body, + self.ledger_id, + self.body, ) @@ -117,7 +122,10 @@ class RawMessage: __slots__ = ("_ledger_id", "_body", "_is_deprecated_mode") def __init__( - self, ledger_id: str, body: bytes, is_deprecated_mode: bool = False, + self, + ledger_id: str, + body: bytes, + is_deprecated_mode: bool = False, ) -> None: """Initialise an instance of RawMessage.""" self._ledger_id = ledger_id @@ -202,7 +210,9 @@ def __eq__(self, other: Any) -> bool: def __str__(self) -> str: """Get string representation.""" return "RawMessage: ledger_id={}, body={!r}, is_deprecated_mode={}".format( - self.ledger_id, self.body, self.is_deprecated_mode, + self.ledger_id, + self.body, + self.is_deprecated_mode, ) @@ -211,7 +221,11 @@ class SignedTransaction: __slots__ = ("_ledger_id", "_body") - def __init__(self, ledger_id: str, body: JSONLike,) -> None: + def __init__( + self, + ledger_id: str, + body: JSONLike, + ) -> None: """Initialise an instance of SignedTransaction.""" self._ledger_id = ledger_id self._body = body @@ -250,8 +264,8 @@ def encode( "body": signed_transaction_object.body, } - signed_transaction_protobuf_object.signed_transaction = DictProtobufStructSerializer.encode( - signed_transaction_dict + signed_transaction_protobuf_object.signed_transaction = ( + DictProtobufStructSerializer.encode(signed_transaction_dict) ) @classmethod @@ -282,7 +296,8 @@ def __eq__(self, other: Any) -> bool: def __str__(self) -> str: """Get string representation.""" return "SignedTransaction: ledger_id={}, body={}".format( - self.ledger_id, self.body, + self.ledger_id, + self.body, ) @@ -292,7 +307,10 @@ class SignedMessage: __slots__ = ("_ledger_id", "_body", "_is_deprecated_mode") def __init__( - self, ledger_id: str, body: str, is_deprecated_mode: bool = False, + self, + ledger_id: str, + body: str, + is_deprecated_mode: bool = False, ) -> None: """Initialise an instance of SignedMessage.""" self._ledger_id = ledger_id @@ -342,8 +360,8 @@ def encode( "is_deprecated_mode": signed_message_object.is_deprecated_mode, } - signed_message_protobuf_object.signed_message = DictProtobufStructSerializer.encode( - signed_message_dict + signed_message_protobuf_object.signed_message = ( + DictProtobufStructSerializer.encode(signed_message_dict) ) @classmethod @@ -377,7 +395,9 @@ def __eq__(self, other: Any) -> bool: def __str__(self) -> str: """Get string representation.""" return "SignedMessage: ledger_id={}, body={}, is_deprecated_mode={}".format( - self.ledger_id, self.body, self.is_deprecated_mode, + self.ledger_id, + self.body, + self.is_deprecated_mode, ) @@ -1008,8 +1028,8 @@ def encode( "body": transaction_digest_object.body, } - transaction_digest_protobuf_object.transaction_digest = DictProtobufStructSerializer.encode( - transaction_digest_dict + transaction_digest_protobuf_object.transaction_digest = ( + DictProtobufStructSerializer.encode(transaction_digest_dict) ) @classmethod @@ -1099,8 +1119,8 @@ def encode( "transaction": transaction_receipt_object.transaction, } - transaction_receipt_protobuf_object.transaction_receipt = DictProtobufStructSerializer.encode( - transaction_receipt_dict + transaction_receipt_protobuf_object.transaction_receipt = ( + DictProtobufStructSerializer.encode(transaction_receipt_dict) ) @classmethod diff --git a/aea/mail/base.py b/aea/mail/base.py index cece7ecc64..13dade58aa 100644 --- a/aea/mail/base.py +++ b/aea/mail/base.py @@ -124,7 +124,9 @@ class EnvelopeContext: __slots__ = ("_connection_id", "_uri") def __init__( - self, connection_id: Optional[PublicId] = None, uri: Optional[URI] = None, + self, + connection_id: Optional[PublicId] = None, + uri: Optional[URI] = None, ) -> None: """ Initialize the envelope context. @@ -432,7 +434,10 @@ def __eq__(self, other: Any) -> bool: and self.context == other.context ) - def encode(self, serializer: Optional[EnvelopeSerializer] = None,) -> bytes: + def encode( + self, + serializer: Optional[EnvelopeSerializer] = None, + ) -> bytes: """ Encode the envelope. diff --git a/aea/mail/base_pb2.py b/aea/mail/base_pb2.py index 281d3b9f77..6389b56012 100644 --- a/aea/mail/base_pb2.py +++ b/aea/mail/base_pb2.py @@ -21,7 +21,9 @@ syntax="proto3", serialized_options=None, serialized_pb=b'\n\nbase.proto\x12\x0f\x61\x65\x61.base.v0_1_0\x1a\x1cgoogle/protobuf/struct.proto"\x90\x01\n\x0f\x44ialogueMessage\x12\x12\n\nmessage_id\x18\x01 \x01(\x05\x12"\n\x1a\x64ialogue_starter_reference\x18\x02 \x01(\t\x12$\n\x1c\x64ialogue_responder_reference\x18\x03 \x01(\t\x12\x0e\n\x06target\x18\x04 \x01(\x05\x12\x0f\n\x07\x63ontent\x18\x05 \x01(\x0c"{\n\x07Message\x12\'\n\x04\x62ody\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12<\n\x10\x64ialogue_message\x18\x02 \x01(\x0b\x32 .aea.base.v0_1_0.DialogueMessageH\x00\x42\t\n\x07message"Y\n\x08\x45nvelope\x12\n\n\x02to\x18\x01 \x01(\t\x12\x0e\n\x06sender\x18\x02 \x01(\t\x12\x13\n\x0bprotocol_id\x18\x03 \x01(\t\x12\x0f\n\x07message\x18\x04 \x01(\x0c\x12\x0b\n\x03uri\x18\x05 \x01(\tb\x06proto3', - dependencies=[google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,], + dependencies=[ + google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, + ], ) diff --git a/aea/manager/manager.py b/aea/manager/manager.py index 44df5f9dfb..1e18f6f56f 100644 --- a/aea/manager/manager.py +++ b/aea/manager/manager.py @@ -200,7 +200,9 @@ def start(self) -> None: ) self._thread.start() - def stop(self,) -> None: + def stop( + self, + ) -> None: """Stop the task.""" super().stop() if self._thread is not None: @@ -259,7 +261,9 @@ def wait(self) -> asyncio.Future: @staticmethod def _run_agent( - agent_alias: AgentAlias, stop_event: Event, result_queue: multiprocessing.Queue, + agent_alias: AgentAlias, + stop_event: Event, + result_queue: multiprocessing.Queue, ) -> None: """Start an agent in a child process.""" t: Optional[Thread] = None @@ -516,7 +520,9 @@ def start_manager( def last_start_status( self, ) -> Tuple[ - bool, Dict[PublicId, List[Dict]], List[Tuple[PublicId, List[Dict], Exception]], + bool, + Dict[PublicId, List[Dict]], + List[Tuple[PublicId, List[Dict], Exception]], ]: """Get status of the last agents start loading state.""" if self._last_start_status is None: @@ -725,7 +731,10 @@ def add_agent( return self def add_agent_with_config( - self, public_id: PublicId, config: List[dict], agent_name: Optional[str] = None, + self, + public_id: PublicId, + config: List[dict], + agent_name: Optional[str] = None, ) -> "MultiAgentManager": """ Create new agent configuration based on project with config provided. @@ -1024,7 +1033,9 @@ def _ensure_working_dir(self) -> None: def _load_state( self, local: bool, remote: bool ) -> Tuple[ - bool, Dict[PublicId, List[Dict]], List[Tuple[PublicId, List[Dict], Exception]], + bool, + Dict[PublicId, List[Dict]], + List[Tuple[PublicId, List[Dict], Exception]], ]: """ Load saved state from file. @@ -1063,7 +1074,10 @@ def _load_state( for project_public_id, agents_settings in projects_agents.items(): try: self.add_project( - project_public_id, local=local, remote=remote, restore=True, + project_public_id, + local=local, + remote=remote, + restore=True, ) except ProjectCheckError as e: failed_to_load.append((project_public_id, agents_settings, e)) diff --git a/aea/manager/project.py b/aea/manager/project.py index 8370e80f3e..0391343f6e 100644 --- a/aea/manager/project.py +++ b/aea/manager/project.py @@ -232,7 +232,10 @@ def agent_config(self) -> AgentConfig: return self._agent_config def _create_private_key( - self, ledger: str, replace: bool = False, is_connection: bool = False, + self, + ledger: str, + replace: bool = False, + is_connection: bool = False, ) -> str: """ Create new key for agent alias in working dir keys dir. diff --git a/aea/multiplexer.py b/aea/multiplexer.py index 49e2159166..06457f37d3 100644 --- a/aea/multiplexer.py +++ b/aea/multiplexer.py @@ -160,7 +160,9 @@ def __init__( self._recv_loop_task = None # type: Optional[asyncio.Task] self._send_loop_task = None # type: Optional[asyncio.Task] - self._loop: asyncio.AbstractEventLoop = loop if loop is not None else asyncio.new_event_loop() + self._loop: asyncio.AbstractEventLoop = ( + loop if loop is not None else asyncio.new_event_loop() + ) self.set_loop(self._loop) @property @@ -967,7 +969,9 @@ def put(self, envelope: Envelope) -> None: self._multiplexer.put(envelope) def put_message( - self, message: Message, context: Optional[EnvelopeContext] = None, + self, + message: Message, + context: Optional[EnvelopeContext] = None, ) -> None: """ Put a message in the outbox. @@ -984,6 +988,9 @@ def put_message( if not message.has_sender: raise ValueError("Provided message has message.sender not set.") envelope = Envelope( - to=message.to, sender=message.sender, message=message, context=context, + to=message.to, + sender=message.sender, + message=message, + context=context, ) self.put(envelope) diff --git a/aea/protocols/base.py b/aea/protocols/base.py index 2793419942..97414fb9b3 100644 --- a/aea/protocols/base.py +++ b/aea/protocols/base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -400,7 +400,10 @@ def from_config(cls, configuration: ProtocolConfig, **kwargs: Any) -> "Protocol" ) classes = inspect.getmembers(class_module, inspect.isclass) serializer_classes = list( - filter(lambda x: re.match(f"{name_camel_case}Serializer", x[0]), classes,) + filter( + lambda x: re.match(f"{name_camel_case}Serializer", x[0]), + classes, + ) ) if len(serializer_classes) != 1: # pragma: nocover raise AEAComponentLoadException( diff --git a/aea/protocols/dialogue/base.py b/aea/protocols/dialogue/base.py index 45536861f5..4061bdfa9c 100644 --- a/aea/protocols/dialogue/base.py +++ b/aea/protocols/dialogue/base.py @@ -631,7 +631,8 @@ def _update(self, message: Message) -> None: if not is_valid_result: raise InvalidDialogueMessage( "Message {} is invalid with respect to this dialogue. Error: {}".format( - message.message_id, validation_message, + message.message_id, + validation_message, ) ) @@ -667,7 +668,9 @@ def _is_belonging_to_dialogue(self, message: Message) -> bool: result = self_initiated_dialogue_label in self.dialogue_labels else: other_initiated_dialogue_label = DialogueLabel( - message.dialogue_reference, opponent, opponent, + message.dialogue_reference, + opponent, + opponent, ) result = other_initiated_dialogue_label in self.dialogue_labels return result @@ -1712,7 +1715,10 @@ def new_self_initiated_dialogue_reference(cls) -> Tuple[str, str]: return cls._generate_dialogue_nonce(), Dialogue.UNASSIGNED_DIALOGUE_REFERENCE def create( - self, counterparty: Address, performative: Message.Performative, **kwargs: Any, + self, + counterparty: Address, + performative: Message.Performative, + **kwargs: Any, ) -> Tuple[Message, Dialogue]: """ Create a dialogue with 'counterparty', with an initial message whose performative is 'performative' and contents are from 'kwargs'. @@ -1881,7 +1887,9 @@ def _complete_dialogue_reference(self, message: Message) -> None: Dialogue.UNASSIGNED_DIALOGUE_REFERENCE, ) incomplete_dialogue_label = DialogueLabel( - incomplete_dialogue_reference, message.sender, self.self_address, + incomplete_dialogue_reference, + message.sender, + self.self_address, ) if self._dialogues_storage.is_dialogue_present(incomplete_dialogue_label): diff --git a/aea/protocols/generator/base.py b/aea/protocols/generator/base.py index f123a0925b..077267b9f7 100644 --- a/aea/protocols/generator/base.py +++ b/aea/protocols/generator/base.py @@ -262,7 +262,9 @@ def _import_from_custom_types_module(self) -> str: else: for custom_class in self.spec.all_custom_types: import_str += "from {}.custom_types import {} as Custom{}\n".format( - self.dotted_path_to_protocol_package, custom_class, custom_class, + self.dotted_path_to_protocol_package, + custom_class, + custom_class, ) import_str = import_str[:-1] return import_str @@ -918,7 +920,8 @@ def _message_class_str(self) -> str: else: cls_str += self.indent + "elif " cls_str += "self.performative == {}Message.Performative.{}:\n".format( - self.protocol_specification_in_camel_case, performative.upper(), + self.protocol_specification_in_camel_case, + performative.upper(), ) self._change_indent(1) nb_of_non_optional_contents = 0 @@ -1320,7 +1323,8 @@ def _custom_types_module_str(self) -> str: cls_str += ( self.indent + 'def decode(cls, {}_protobuf_object) -> "{}":\n'.format( - _camel_case_to_snake_case(custom_type), custom_type, + _camel_case_to_snake_case(custom_type), + custom_type, ) ) self._change_indent(1) @@ -1358,7 +1362,9 @@ def _custom_types_module_str(self) -> str: return cls_str def _encoding_message_content_from_python_to_protobuf( - self, content_name: str, content_type: str, + self, + content_name: str, + content_type: str, ) -> str: """ Produce the encoding of message contents for the serialisation class. @@ -1551,7 +1557,9 @@ def _decoding_message_content_from_protobuf_to_python( variable_name, ) decoding_str += self.indent + "{} = {}.decode(pb2_{})\n".format( - content_name, content_type, variable_name, + content_name, + content_type, + variable_name, ) decoding_str += self.indent + 'performative_content["{}"] = {}\n'.format( content_name, content_name @@ -1588,13 +1596,15 @@ def _serialization_class_str(self) -> str: cls_str += MESSAGE_IMPORT + "\n" cls_str += SERIALIZER_IMPORT + "\n\n" cls_str += self.indent + "from {} import (\n {}_pb2,\n)\n".format( - self.dotted_path_to_protocol_package, self.protocol_specification.name, + self.dotted_path_to_protocol_package, + self.protocol_specification.name, ) for custom_type in self.spec.all_custom_types: cls_str += ( self.indent + "from {}.custom_types import (\n {},\n)\n".format( - self.dotted_path_to_protocol_package, custom_type, + self.dotted_path_to_protocol_package, + custom_type, ) ) cls_str += self.indent + "from {}.message import (\n {}Message,\n)\n".format( @@ -1786,7 +1796,10 @@ def _serialization_class_str(self) -> str: return cls_str def _content_to_proto_field_str( - self, content_name: str, content_type: str, tag_no: int, + self, + content_name: str, + content_type: str, + tag_no: int, ) -> Tuple[str, int]: """ Convert a message content to its representation in a protocol buffer schema. @@ -1990,7 +2003,9 @@ def _init_str(self) -> str: return init_str def generate_protobuf_only_mode( - self, language: str = PROTOCOL_LANGUAGE_PYTHON, run_protolint: bool = True, + self, + language: str = PROTOCOL_LANGUAGE_PYTHON, + run_protolint: bool = True, ) -> Optional[str]: """ Run the generator in "protobuf only" mode: diff --git a/aea/protocols/generator/common.py b/aea/protocols/generator/common.py index 088e781712..bccd1fa8fe 100644 --- a/aea/protocols/generator/common.py +++ b/aea/protocols/generator/common.py @@ -129,7 +129,8 @@ def _match_brackets(text: str, index_of_open_bracket: int) -> int: if text[index_of_open_bracket] != "[": raise SyntaxError( "Index {} in 'text' is not an open bracket '['. It is {}".format( - index_of_open_bracket, text[index_of_open_bracket], + index_of_open_bracket, + text[index_of_open_bracket], ) ) @@ -468,7 +469,8 @@ def try_run_protolint(path_to_generated_protocol_package: str, name: str) -> Non """ # path to proto file path_to_proto_file = os.path.join( - path_to_generated_protocol_package, f"{name}.proto", + path_to_generated_protocol_package, + f"{name}.proto", ) # Dump protolint configuration into a temporary file diff --git a/aea/protocols/generator/extract_specification.py b/aea/protocols/generator/extract_specification.py index b14626a64d..7453821554 100644 --- a/aea/protocols/generator/extract_specification.py +++ b/aea/protocols/generator/extract_specification.py @@ -235,12 +235,14 @@ def extract( ) ] spec.reply = cast( - Dict[str, List[str]], protocol_specification.dialogue_config["reply"], + Dict[str, List[str]], + protocol_specification.dialogue_config["reply"], ) spec.terminal_performatives = [ terminal_performative.upper() for terminal_performative in cast( - List[str], protocol_specification.dialogue_config["termination"], + List[str], + protocol_specification.dialogue_config["termination"], ) ] roles_set = cast( diff --git a/aea/protocols/generator/validate.py b/aea/protocols/generator/validate.py index a143146d6e..8df9d6ef02 100644 --- a/aea/protocols/generator/validate.py +++ b/aea/protocols/generator/validate.py @@ -337,7 +337,8 @@ def _validate_content_name(content_name: str, performative: str) -> Tuple[bool, return ( False, "Invalid name for content '{}' of performative '{}'. This name is reserved.".format( - content_name, performative, + content_name, + performative, ), ) @@ -365,7 +366,8 @@ def _validate_content_type( return ( False, "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ), ) diff --git a/aea/registries/filter.py b/aea/registries/filter.py index 9389697741..0cab6ed5f9 100644 --- a/aea/registries/filter.py +++ b/aea/registries/filter.py @@ -148,7 +148,8 @@ def _handle_internal_message(self, message: Message) -> None: ) return handler = self.resources.handler_registry.fetch_by_protocol_and_skill( - message.protocol_id, skill_id, + message.protocol_id, + skill_id, ) if handler is not None: self.logger.debug( diff --git a/aea/skills/base.py b/aea/skills/base.py index 5ab7047d8b..e523efbaa7 100644 --- a/aea/skills/base.py +++ b/aea/skills/base.py @@ -993,7 +993,8 @@ def _get_declared_skill_component_configurations( return result def _get_component_instances( - self, component_loading_items: List[_SkillComponentLoadingItem], + self, + component_loading_items: List[_SkillComponentLoadingItem], ) -> _ComponentsHelperIndex: """ Instantiate classes declared in configuration files. @@ -1014,7 +1015,8 @@ def _get_component_instances( @classmethod def _get_skill_component_type( - cls, skill_component_type: Type[SkillComponent], + cls, + skill_component_type: Type[SkillComponent], ) -> Type[Union[Handler, Behaviour, Model]]: """Get the concrete skill component type.""" parent_skill_component_types = list( diff --git a/aea/test_tools/click_testing.py b/aea/test_tools/click_testing.py index 0b0dbf51bf..eec1c5a8ea 100644 --- a/aea/test_tools/click_testing.py +++ b/aea/test_tools/click_testing.py @@ -34,7 +34,6 @@ import sys from typing import Optional -from click._compat import string_types # type: ignore from click.testing import CliRunner as ClickCliRunner from click.testing import Result @@ -58,7 +57,7 @@ def invoke( # type: ignore exit_code = 0 with self.isolation(input=input, env=env, color=color) as outstreams: - if isinstance(args, string_types): + if isinstance(args, str): args = shlex.split(args) try: @@ -106,4 +105,5 @@ def invoke( # type: ignore exit_code=exit_code, exception=exception, exc_info=exc_info, + return_value=None, ) diff --git a/aea/test_tools/test_cases.py b/aea/test_tools/test_cases.py index 90b16c8b75..1766ca0818 100644 --- a/aea/test_tools/test_cases.py +++ b/aea/test_tools/test_cases.py @@ -149,7 +149,10 @@ def set_config( if aev: cmd.append("--aev") - return cls.run_cli_command(*cmd, cwd=cls._get_cwd(),) + return cls.run_cli_command( + *cmd, + cwd=cls._get_cwd(), + ) @classmethod def nested_set_config(cls, dotted_path: str, value: Any) -> None: @@ -220,7 +223,8 @@ def _run_python_subprocess(cls, *args: str, cwd: str = ".") -> subprocess.Popen: kwargs.update(win_popen_kwargs()) process = subprocess.Popen( # type: ignore # nosec # mypy fails on **kwargs - [sys.executable, *args], **kwargs, + [sys.executable, *args], + **kwargs, ) cls.subprocesses.append(process) return process @@ -447,7 +451,9 @@ def _start_cli_process(cls, *args: str) -> subprocess.Popen: @classmethod def terminate_agents( - cls, *subprocesses: subprocess.Popen, timeout: int = 20, + cls, + *subprocesses: subprocess.Popen, + timeout: int = 20, ) -> None: """ Terminate agent subprocesses. @@ -646,7 +652,9 @@ def add_private_key( @classmethod def remove_private_key( - cls, ledger_api_id: str = DEFAULT_LEDGER, connection: bool = False, + cls, + ledger_api_id: str = DEFAULT_LEDGER, + connection: bool = False, ) -> Result: """ Remove private key with CLI command. diff --git a/aea/test_tools/test_contract.py b/aea/test_tools/test_contract.py index e3af79a17c..4e06290afa 100644 --- a/aea/test_tools/test_contract.py +++ b/aea/test_tools/test_contract.py @@ -231,7 +231,9 @@ def _deploy_contract( :return: the transaction receipt for initial transaction deployment """ tx = contract.get_deploy_transaction( - ledger_api=ledger_api, deployer_address=deployer_crypto.address, gas=gas, + ledger_api=ledger_api, + deployer_address=deployer_crypto.address, + gas=gas, ) if tx is None: diff --git a/aea/test_tools/test_skill.py b/aea/test_tools/test_skill.py index f1efb64ec7..141d885b9a 100644 --- a/aea/test_tools/test_skill.py +++ b/aea/test_tools/test_skill.py @@ -112,7 +112,9 @@ def assert_quantity_in_decision_making_queue(self, expected_quantity: int) -> No @staticmethod def message_has_attributes( - actual_message: Message, message_type: Type[Message], **kwargs: Any, + actual_message: Message, + message_type: Type[Message], + **kwargs: Any, ) -> Tuple[bool, str]: """ Evaluates whether a message's attributes match the expected attributes provided. @@ -325,7 +327,10 @@ def _non_initial_incoming_message_dialogue_reference( return dialogue_reference def _extract_message_fields( - self, message: DialogueMessage, index: int, last_is_incoming: bool, + self, + message: DialogueMessage, + index: int, + last_is_incoming: bool, ) -> Tuple[Message.Performative, Dict, int, bool, Optional[int]]: """ Extracts message attributes from a dialogue message. @@ -424,8 +429,8 @@ def prepare_skill_dialogue( target = cast(Message, dialogue.last_message).message_id if is_incoming: # messages from the opponent - dialogue_reference = self._non_initial_incoming_message_dialogue_reference( - dialogue + dialogue_reference = ( + self._non_initial_incoming_message_dialogue_reference(dialogue) ) message_id = dialogue.get_incoming_next_message_id() diff --git a/benchmark/checks/check_agent_construction_time.py b/benchmark/checks/check_agent_construction_time.py index 4c79c34818..0ca984d4bb 100755 --- a/benchmark/checks/check_agent_construction_time.py +++ b/benchmark/checks/check_agent_construction_time.py @@ -94,7 +94,11 @@ def main(agents: int, number_of_runs: int, output_format: str) -> Any: parameters = {"Agents": agents, "Number of runs": number_of_runs} def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (agents,),) + return multi_run( + int(number_of_runs), + run, + (agents,), + ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/check_decision_maker.py b/benchmark/checks/check_decision_maker.py index 4731948cd4..51c3a3c6ed 100755 --- a/benchmark/checks/check_decision_maker.py +++ b/benchmark/checks/check_decision_maker.py @@ -91,7 +91,9 @@ def make_desc_maker_wallet( wallet = Wallet({ledger_id: key_path}) agent_name = "test" identity = Identity( - agent_name, addresses=wallet.addresses, default_address_key=ledger_id, + agent_name, + addresses=wallet.addresses, + default_address_key=ledger_id, ) config = {} # type: ignore decision_maker_handler = DecisionMakerHandler( @@ -223,7 +225,14 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (ledger_id, amount_of_tx,),) + return multi_run( + int(number_of_runs), + run, + ( + ledger_id, + amount_of_tx, + ), + ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/check_dialogues_memory_usage.py b/benchmark/checks/check_dialogues_memory_usage.py index 06e1175082..1d083701be 100755 --- a/benchmark/checks/check_dialogues_memory_usage.py +++ b/benchmark/checks/check_dialogues_memory_usage.py @@ -126,7 +126,11 @@ def main(messages: str, number_of_runs: int, output_format: str) -> Any: parameters = {"Messages": messages, "Number of runs": number_of_runs} def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (int(messages),),) + return multi_run( + int(number_of_runs), + run, + (int(messages),), + ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/check_mem_usage.py b/benchmark/checks/check_mem_usage.py index 00be8c1939..7dfd78900d 100755 --- a/benchmark/checks/check_mem_usage.py +++ b/benchmark/checks/check_mem_usage.py @@ -109,7 +109,11 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (duration, runtime_mode),) + return multi_run( + int(number_of_runs), + run, + (duration, runtime_mode), + ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/check_messages_memory_usage.py b/benchmark/checks/check_messages_memory_usage.py index 0a2510710e..9703d78ba3 100755 --- a/benchmark/checks/check_messages_memory_usage.py +++ b/benchmark/checks/check_messages_memory_usage.py @@ -71,7 +71,7 @@ def run(messages_amount: int) -> List[Tuple[str, Union[int, float]]]: @click.command() -@click.option("--messages", default=10 ** 6, help="Amount of messages.") +@click.option("--messages", default=10**6, help="Amount of messages.") @number_of_runs_deco @output_format_deco def main(messages: int, number_of_runs: int, output_format: str) -> Any: @@ -79,7 +79,11 @@ def main(messages: int, number_of_runs: int, output_format: str) -> Any: parameters = {"Messages": messages, "Number of runs": number_of_runs} def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (int(messages),),) + return multi_run( + int(number_of_runs), + run, + (int(messages),), + ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/check_multiagent.py b/benchmark/checks/check_multiagent.py index 69451a01c5..5e67a4c05f 100755 --- a/benchmark/checks/check_multiagent.py +++ b/benchmark/checks/check_multiagent.py @@ -64,10 +64,14 @@ class TestHandler(Handler): def setup(self) -> None: """Noop setup.""" self.count: int = 0 # pylint: disable=attribute-defined-outside-init - self.rtt_total_time: float = 0.0 # pylint: disable=attribute-defined-outside-init + self.rtt_total_time: float = ( # pylint: disable=attribute-defined-outside-init + 0.0 + ) self.rtt_count: int = 0 # pylint: disable=attribute-defined-outside-init - self.latency_total_time: float = 0.0 # pylint: disable=attribute-defined-outside-init + self.latency_total_time: float = ( # pylint: disable=attribute-defined-outside-init + 0.0 + ) self.latency_count: int = 0 # pylint: disable=attribute-defined-outside-init def teardown(self) -> None: diff --git a/benchmark/checks/check_proactive.py b/benchmark/checks/check_proactive.py index 8e805952d2..708b397536 100755 --- a/benchmark/checks/check_proactive.py +++ b/benchmark/checks/check_proactive.py @@ -108,7 +108,11 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (duration, runtime_mode),) + return multi_run( + int(number_of_runs), + run, + (duration, runtime_mode), + ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/check_reactive.py b/benchmark/checks/check_reactive.py index 68d85b907e..4809b1cd3e 100755 --- a/benchmark/checks/check_reactive.py +++ b/benchmark/checks/check_reactive.py @@ -118,13 +118,21 @@ def run( agent.stop() t.join(5) - latency = mean(map(lambda x: x[1] - x[0], zip(connection.sends, connection.recvs,))) + latency = mean( + map( + lambda x: x[1] - x[0], + zip( + connection.sends, + connection.recvs, + ), + ) + ) total_amount = len(connection.recvs) rate = total_amount / duration return [ ("envelopes received", len(connection.recvs)), ("envelopes sent", len(connection.sends)), - ("latency(ms)", 10 ** 6 * latency), + ("latency(ms)", 10**6 * latency), ("rate(envelopes/second)", rate), ] @@ -156,7 +164,9 @@ def main( def result_fn() -> List[Tuple[str, Any, Any, Any]]: return multi_run( - int(number_of_runs), run, (duration, runtime_mode, connection_mode), + int(number_of_runs), + run, + (duration, runtime_mode, connection_mode), ) return print_results(output_format, parameters, result_fn) diff --git a/benchmark/checks/utils.py b/benchmark/checks/utils.py index 140c6fe6bd..e86e9e103e 100644 --- a/benchmark/checks/utils.py +++ b/benchmark/checks/utils.py @@ -138,7 +138,11 @@ def make_envelope( ) message.sender = sender message.to = to - return Envelope(to=to, sender=sender, message=message,) + return Envelope( + to=to, + sender=sender, + message=message, + ) class GeneratorConnection(Connection): @@ -184,9 +188,13 @@ async def receive(self, *args: Any, **kwargs: Any) -> Optional["Envelope"]: return envelope @classmethod - def make(cls,) -> "GeneratorConnection": + def make( + cls, + ) -> "GeneratorConnection": """Construct connection instance.""" - configuration = ConnectionConfig(connection_id=cls.connection_id,) + configuration = ConnectionConfig( + connection_id=cls.connection_id, + ) test_connection = cls( configuration=configuration, identity=Identity("name", "address", "public_key"), @@ -251,7 +259,7 @@ def make_skill( def get_mem_usage_in_mb() -> float: """Get memory usage of the current process in megabytes.""" - return 1.0 * psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2 + return 1.0 * psutil.Process(os.getpid()).memory_info().rss / 1024**2 def multi_run( diff --git a/benchmark/framework/aea_test_wrapper.py b/benchmark/framework/aea_test_wrapper.py index 2263dc57f0..ffcf249fa8 100644 --- a/benchmark/framework/aea_test_wrapper.py +++ b/benchmark/framework/aea_test_wrapper.py @@ -142,7 +142,10 @@ def dummy_default_message( @classmethod def dummy_envelope( - cls, to: str = "test", sender: str = "test", message: Message = None, + cls, + to: str = "test", + sender: str = "test", + message: Message = None, ) -> Envelope: """ Create envelope, if message is not passed use .dummy_message method. diff --git a/docs/http-connection-and-skill.md b/docs/http-connection-and-skill.md index 16fbd4a0c2..cf41287e47 100644 --- a/docs/http-connection-and-skill.md +++ b/docs/http-connection-and-skill.md @@ -149,7 +149,9 @@ class HttpHandler(Handler): """ self.context.logger.info( "received http request with method={}, url={} and body={!r}".format( - http_msg.method, http_msg.url, http_msg.body, + http_msg.method, + http_msg.url, + http_msg.body, ) ) if http_msg.method == "get": diff --git a/examples/gym_ex/proxy/env.py b/examples/gym_ex/proxy/env.py index 4c9f03c446..bf17874fb1 100755 --- a/examples/gym_ex/proxy/env.py +++ b/examples/gym_ex/proxy/env.py @@ -150,7 +150,8 @@ def reset(self) -> None: if not self._agent.runtime.multiplexer.is_connected: self._connect() gym_msg, gym_dialogue = self.gym_dialogues.create( - counterparty=self.gym_address, performative=GymMessage.Performative.RESET, + counterparty=self.gym_address, + performative=GymMessage.Performative.RESET, ) gym_dialogue = cast(GymDialogue, gym_dialogue) self._active_dialogue = gym_dialogue @@ -167,7 +168,8 @@ def close(self) -> None: if last_msg is None: raise ValueError("Cannot retrieve last message.") gym_msg = self.active_dialogue.reply( - performative=GymMessage.Performative.CLOSE, target_message=last_msg, + performative=GymMessage.Performative.CLOSE, + target_message=last_msg, ) self._agent.outbox.put_message(message=gym_msg) diff --git a/packages/fetchai/agents/gym_aea/aea-config.yaml b/packages/fetchai/agents/gym_aea/aea-config.yaml index 30f1253093..e2b2a8647c 100644 --- a/packages/fetchai/agents/gym_aea/aea-config.yaml +++ b/packages/fetchai/agents/gym_aea/aea-config.yaml @@ -9,15 +9,15 @@ fingerprint: README.md: QmNZkqQZByU5yn18ELka8TAyypiRxhHjAfMSdZfUy9mRwy fingerprint_ignore_patterns: [] connections: -- fetchai/gym:0.19.0:QmRQtBH1mxYvKovuHCVCD5FRPxdwtBykWFX2rhQNssE1uF +- fetchai/gym:0.19.0:QmTBP9GVNG77w8J9TnhaekLCsgPzyBJkcnwhNaXpk7zvvo contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/gym:1.0.0:QmRTJHxbo9qWupgtGtqDphjmivT5ko6vEyLvh9gWvXYgJ6 -- fetchai/state_update:1.0.0:QmU11QAovn6MNWtBYnGVsUF9toLpniXHNwfoSNPu1LKxku +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/gym:1.0.0:QmRdTUcCzKWVhjqsqN6L9GqLftRnHPoVdGi45FNGsn5HnK +- fetchai/state_update:1.0.0:QmWLyfRY3pxZCK6arwKsodTS9SyodCPsQMHHyK2jAUCUJ7 - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: -- fetchai/gym:0.20.0:QmdYZP1aCTR3zDBvo8U699BdGfmD7dXv1AedRrxWctxcaY +- fetchai/gym:0.20.0:QmZiYvKu6Ei7K5Zw8DCxSZxp7yy1SXJYyxnAd6pmg6HWYS default_connection: fetchai/gym:0.19.0 default_ledger: fetchai required_ledgers: diff --git a/packages/fetchai/agents/my_first_aea/aea-config.yaml b/packages/fetchai/agents/my_first_aea/aea-config.yaml index 0425eefef6..a54c28b5c0 100644 --- a/packages/fetchai/agents/my_first_aea/aea-config.yaml +++ b/packages/fetchai/agents/my_first_aea/aea-config.yaml @@ -11,11 +11,11 @@ connections: - fetchai/stub:0.21.0:QmektTWmXcjThQd8md8nSYgLapR3Gks3n3WEzwAWQFgc4z contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/state_update:1.0.0:QmU11QAovn6MNWtBYnGVsUF9toLpniXHNwfoSNPu1LKxku +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/state_update:1.0.0:QmWLyfRY3pxZCK6arwKsodTS9SyodCPsQMHHyK2jAUCUJ7 - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: -- fetchai/echo:0.19.0:QmWkxgujut8dgG4ojgcE2xibqt4ReCu2QoGMbmwrggMhun +- fetchai/echo:0.19.0:QmZTVDhVedMAUMAqW1pCLrGQEe4gqFG11Dr41XzvgueCSJ default_connection: fetchai/stub:0.21.0 default_ledger: fetchai required_ledgers: diff --git a/packages/fetchai/connections/gym/connection.py b/packages/fetchai/connections/gym/connection.py index 59e693c0d8..1c591ff835 100644 --- a/packages/fetchai/connections/gym/connection.py +++ b/packages/fetchai/connections/gym/connection.py @@ -189,7 +189,11 @@ async def handle_gym_message(self, envelope: Envelope) -> None: elif gym_message.performative == GymMessage.Performative.CLOSE: await self._run_in_executor(self.gym_env.close) return - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) await self._send(envelope) async def _send(self, envelope: Envelope) -> None: diff --git a/packages/fetchai/connections/gym/connection.yaml b/packages/fetchai/connections/gym/connection.yaml index 18003813a5..41e60458eb 100644 --- a/packages/fetchai/connections/gym/connection.yaml +++ b/packages/fetchai/connections/gym/connection.yaml @@ -8,11 +8,11 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmUp6pFGZJ3KwqfG3owDEMTUyscn9J9Gzyh2VvgFw2o3RV __init__.py: QmNWJFw4cbRNvs5fwGJTFthNdT8g7SSr1ukcG4zrbfX2Bu - connection.py: QmaZ92Lu5e7b8FqVmKnuu2DBc53rJobnTvfJGHnMwtvszN + connection.py: QmNVBEYkr5drCWrCvVftiGmCnM4fDcLQv6qcowpA6XDGwg fingerprint_ignore_patterns: [] connections: [] protocols: -- fetchai/gym:1.0.0:QmRTJHxbo9qWupgtGtqDphjmivT5ko6vEyLvh9gWvXYgJ6 +- fetchai/gym:1.0.0:QmRdTUcCzKWVhjqsqN6L9GqLftRnHPoVdGi45FNGsn5HnK class_name: GymConnection config: env: '' diff --git a/packages/fetchai/connections/http_client/connection.py b/packages/fetchai/connections/http_client/connection.py index 6f07c74b7d..c1ed544fe6 100644 --- a/packages/fetchai/connections/http_client/connection.py +++ b/packages/fetchai/connections/http_client/connection.py @@ -110,7 +110,11 @@ class HTTPClientAsyncChannel: ) def __init__( - self, agent_address: Address, address: str, port: int, connection_id: PublicId, + self, + agent_address: Address, + address: str, + port: int, + connection_id: PublicId, ): """ Initialize an http client channel. @@ -333,7 +337,9 @@ def to_envelope( version="", ) envelope = Envelope( - to=http_message.to, sender=http_message.sender, message=http_message, + to=http_message.to, + sender=http_message.sender, + message=http_message, ) return envelope @@ -378,7 +384,10 @@ def __init__(self, **kwargs: Any) -> None: if host is None or port is None: # pragma: nocover raise ValueError("host and port must be set!") self.channel = HTTPClientAsyncChannel( - self.address, host, port, connection_id=self.connection_id, + self.address, + host, + port, + connection_id=self.connection_id, ) async def connect(self) -> None: diff --git a/packages/fetchai/connections/http_client/connection.yaml b/packages/fetchai/connections/http_client/connection.yaml index 72545df45f..189657d3a4 100644 --- a/packages/fetchai/connections/http_client/connection.yaml +++ b/packages/fetchai/connections/http_client/connection.yaml @@ -9,7 +9,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmS6oZ4AKuTm2Gj5Xjz99s9b7BXgXyBifcFPo7ZNPrWsqx __init__.py: QmPdKAks8A6XKAgZiopJzPZYXJumTeUqChd8UorqmLQQPU - connection.py: QmTQzM6QAjVTXXMtebbkzPav8Sq6eLYQsojT5iZ9deS8j8 + connection.py: QmeCktoKZDwXhwodihWSDgiNxt6JpVzcq5jePXsGNoS9fE fingerprint_ignore_patterns: [] connections: [] protocols: diff --git a/packages/fetchai/connections/http_server/connection.py b/packages/fetchai/connections/http_server/connection.py index 0321e430e2..ca29fd2ca3 100644 --- a/packages/fetchai/connections/http_server/connection.py +++ b/packages/fetchai/connections/http_server/connection.py @@ -169,7 +169,9 @@ async def create(cls, http_request: BaseRequest) -> "Request": return request def to_envelope_and_set_id( - self, dialogues: HttpDialogues, target_skill_id: PublicId, + self, + dialogues: HttpDialogues, + target_skill_id: PublicId, ) -> Envelope: """ Process incoming API request by packaging into Envelope and sending it in-queue. @@ -192,7 +194,9 @@ def to_envelope_and_set_id( dialogue = cast(HttpDialogue, http_dialogue) self.id = dialogue.incomplete_dialogue_label envelope = Envelope( - to=http_message.to, sender=http_message.sender, message=http_message, + to=http_message.to, + sender=http_message.sender, + message=http_message, ) return envelope @@ -455,7 +459,8 @@ async def _http_handler(self, http_request: BaseRequest) -> Response: # wait for response envelope within given timeout window (self.timeout_window) to appear in dispatch_ready_envelopes response_message = await asyncio.wait_for( - self.pending_requests[request.id], timeout=self.timeout_window, + self.pending_requests[request.id], + timeout=self.timeout_window, ) return Response.from_message(response_message) diff --git a/packages/fetchai/connections/http_server/connection.yaml b/packages/fetchai/connections/http_server/connection.yaml index 0b406c6c1e..6d0ff122c8 100644 --- a/packages/fetchai/connections/http_server/connection.yaml +++ b/packages/fetchai/connections/http_server/connection.yaml @@ -9,7 +9,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: Qme8ZDTZKeMMh8gxGu3x9qt2JcdujzYrynk9asTh8GTt9q __init__.py: Qmb6JEAkJeb5JweqrSGiGoQp1vGXqddjGgb9WMkm2phTgA - connection.py: QmegRjYdfrAqYx6XukFHWfzhg2diBBmKamXRmUwKn9GUw8 + connection.py: QmTjoH8uorJJ3ybq8QPuX1AyaV2HUqJ8R37k2E6wLeNrEb fingerprint_ignore_patterns: [] connections: [] protocols: diff --git a/packages/fetchai/connections/ledger/base.py b/packages/fetchai/connections/ledger/base.py index 7ccfed7012..ed4eaaf8e8 100644 --- a/packages/fetchai/connections/ledger/base.py +++ b/packages/fetchai/connections/ledger/base.py @@ -132,7 +132,11 @@ def get_handler(self, performative: Any) -> Callable[[Any], Task]: @abstractmethod def get_error_message( - self, e: Exception, api: LedgerApi, message: Message, dialogue: Dialogue, + self, + e: Exception, + api: LedgerApi, + message: Message, + dialogue: Dialogue, ) -> Message: """ Build an error message. diff --git a/packages/fetchai/connections/ledger/connection.yaml b/packages/fetchai/connections/ledger/connection.yaml index fb8e3cd878..26db016202 100644 --- a/packages/fetchai/connections/ledger/connection.yaml +++ b/packages/fetchai/connections/ledger/connection.yaml @@ -8,15 +8,15 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmVgyK1CoqvZ3veizsasgiBxA8Se2RzrkYn4XQgQ1twKTH __init__.py: QmVdEbfzEyGcS59ypmWaMNHGv9N3CDV7s2tdwnH7Xhmq4q - base.py: QmaLsdMYZK7bn2pSZDXHDu5JdNzJo4Ngz9WTky4k2rEcR6 + base.py: QmcL1H7V5VqbDShrmTA1yTjS6PW4bjCVTgGwWVTiTGeSfe connection.py: QmPKDQZtcKRxxvuJxBKED49t8SkJKajkY3rGQRdCuLGmxM - contract_dispatcher.py: QmSpukSibGFfhnReBGmun6e1M2Edcb3U2jRV88XcmYeUXf - ledger_dispatcher.py: QmVvHjAumryPNgE5vLnGtXt7FUx2pp8FdtkN3b74YqsXMJ + contract_dispatcher.py: QmcKmopEkMWXeafGWFPQ843v7BngrwQWAZJM9tEfaXXA7w + ledger_dispatcher.py: QmbGsYXChKaxTYBbc1eGippeoLzeYd9ZECWE1Jm6CD9p24 fingerprint_ignore_patterns: [] connections: [] protocols: -- fetchai/contract_api:1.0.0:QmXfEAhomDMvdR9oDKzLmmegyS5Kf6Un2KxWPLgfbRF1kt -- fetchai/ledger_api:1.0.0:QmZ6SPoXVUhjbgsL3qw1JM2UJxsCSr4G3Jm16nsT3MG7jA +- fetchai/contract_api:1.0.0:QmTg7H4cM428TegTqMWFaaz9pyaHhG1fBz28aLiZpgkVj6 +- fetchai/ledger_api:1.0.0:QmNVqsvmEaZ21QTK25s4S6Cdfc2vyAA4ipxoLZKA3NPRes class_name: LedgerConnection config: ledger_apis: diff --git a/packages/fetchai/connections/ledger/contract_dispatcher.py b/packages/fetchai/connections/ledger/contract_dispatcher.py index 707d905a76..77f55770f8 100644 --- a/packages/fetchai/connections/ledger/contract_dispatcher.py +++ b/packages/fetchai/connections/ledger/contract_dispatcher.py @@ -106,7 +106,11 @@ def get_ledger_id(self, message: Message) -> str: return message.ledger_id def get_error_message( - self, e: Exception, api: LedgerApi, message: Message, dialogue: BaseDialogue, + self, + e: Exception, + api: LedgerApi, + message: Message, + dialogue: BaseDialogue, ) -> ContractApiMessage: """ Build an error message. @@ -290,7 +294,10 @@ def build_response( return self.dispatch_request(ledger_api, message, dialogue, build_response) def _get_data( - self, api: LedgerApi, message: ContractApiMessage, contract: Contract, + self, + api: LedgerApi, + message: ContractApiMessage, + contract: Contract, ) -> Union[bytes, JSONLike]: """Get the data from the contract method, either from the stub or from the callable specified by the message.""" # first, check if the custom handler for this type of request has been implemented. diff --git a/packages/fetchai/connections/ledger/ledger_dispatcher.py b/packages/fetchai/connections/ledger/ledger_dispatcher.py index 15c1f5e46a..e7507e87d8 100644 --- a/packages/fetchai/connections/ledger/ledger_dispatcher.py +++ b/packages/fetchai/connections/ledger/ledger_dispatcher.py @@ -110,7 +110,10 @@ def dialogues(self) -> BaseDialogues: return self._ledger_api_dialogues def get_balance( - self, api: LedgerApi, message: LedgerApiMessage, dialogue: LedgerApiDialogue, + self, + api: LedgerApi, + message: LedgerApiMessage, + dialogue: LedgerApiDialogue, ) -> LedgerApiMessage: """ Send the request 'get_balance'. @@ -138,7 +141,10 @@ def get_balance( return response def get_state( - self, api: LedgerApi, message: LedgerApiMessage, dialogue: LedgerApiDialogue, + self, + api: LedgerApi, + message: LedgerApiMessage, + dialogue: LedgerApiDialogue, ) -> LedgerApiMessage: """ Send the request 'get_state'. @@ -166,7 +172,10 @@ def get_state( return response def get_raw_transaction( - self, api: LedgerApi, message: LedgerApiMessage, dialogue: LedgerApiDialogue, + self, + api: LedgerApi, + message: LedgerApiMessage, + dialogue: LedgerApiDialogue, ) -> LedgerApiMessage: """ Send the request 'get_raw_transaction'. @@ -202,7 +211,10 @@ def get_raw_transaction( return response def get_transaction_receipt( - self, api: LedgerApi, message: LedgerApiMessage, dialogue: LedgerApiDialogue, + self, + api: LedgerApi, + message: LedgerApiMessage, + dialogue: LedgerApiDialogue, ) -> LedgerApiMessage: """ Send the request 'get_transaction_receipt'. @@ -267,7 +279,10 @@ def get_transaction_receipt( return response def send_signed_transaction( - self, api: LedgerApi, message: LedgerApiMessage, dialogue: LedgerApiDialogue, + self, + api: LedgerApi, + message: LedgerApiMessage, + dialogue: LedgerApiDialogue, ) -> LedgerApiMessage: """ Send the request 'send_signed_tx'. @@ -301,7 +316,11 @@ def send_signed_transaction( ) def get_error_message( - self, e: Exception, api: LedgerApi, message: Message, dialogue: BaseDialogue, + self, + e: Exception, + api: LedgerApi, + message: Message, + dialogue: BaseDialogue, ) -> LedgerApiMessage: """ Build an error message. diff --git a/packages/fetchai/connections/local/connection.py b/packages/fetchai/connections/local/connection.py index cab6a6c199..4882a9f0d6 100644 --- a/packages/fetchai/connections/local/connection.py +++ b/packages/fetchai/connections/local/connection.py @@ -254,7 +254,9 @@ async def _handle_agent_message(self, envelope: Envelope) -> None: error_data={}, ) error_envelope = Envelope( - to=envelope.sender, sender=OEF_LOCAL_NODE_ADDRESS, message=msg, + to=envelope.sender, + sender=OEF_LOCAL_NODE_ADDRESS, + message=msg, ) await self._send(error_envelope) return @@ -273,7 +275,9 @@ async def _register_service( self.services[address].append(service_description) async def _unregister_service( - self, oef_search_msg: OefSearchMessage, dialogue: OefSearchDialogue, + self, + oef_search_msg: OefSearchMessage, + dialogue: OefSearchDialogue, ) -> None: """ Unregister a service agent. @@ -290,7 +294,11 @@ async def _unregister_service( target_message=oef_search_msg, oef_error_operation=OefSearchMessage.OefErrorOperation.UNREGISTER_SERVICE, ) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) await self._send(envelope) else: self.services[address].remove(service_description) @@ -298,7 +306,9 @@ async def _unregister_service( self.services.pop(address) async def _search_services( - self, oef_search_msg: OefSearchMessage, dialogue: OefSearchDialogue, + self, + oef_search_msg: OefSearchMessage, + dialogue: OefSearchDialogue, ) -> None: """ Search the agents in the local Service Directory, and send back the result. @@ -326,7 +336,11 @@ async def _search_services( agents=tuple(sorted(set(result))), ) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) await self._send(envelope) def _get_message_and_dialogue( diff --git a/packages/fetchai/connections/local/connection.yaml b/packages/fetchai/connections/local/connection.yaml index 1168d2cdf7..039277da41 100644 --- a/packages/fetchai/connections/local/connection.yaml +++ b/packages/fetchai/connections/local/connection.yaml @@ -8,11 +8,11 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmbK7MtyAVqh2LmSh9TY6yBZqfWaAXURP4rQGATyP2hTKC __init__.py: QmRTQZuqfT5dYpZUMx9vDMmstWFJrYZ2V5HmX9fvrXZ31h - connection.py: QmZ4FNxvudhaaBRNEYnqQ2dzhjGtFGSvVS3bm43cUygzE8 + connection.py: QmXjzMdSv8vFoHR5qedABJqEKQPLj29vx1bq1vXRr2Mdpn fingerprint_ignore_patterns: [] connections: [] protocols: -- fetchai/oef_search:1.0.0:QmPVwWnsvSRFxu89kRFcQSpbgeDuGrwscJYXXhtQAu7KqK +- fetchai/oef_search:1.0.0:QmVD8sxmqeca59CM7XkVA8XJV8HhhzaffGHudUKSA956uV class_name: OEFLocalConnection config: {} excluded_protocols: [] diff --git a/packages/fetchai/protocols/contract_api/contract_api_pb2.py b/packages/fetchai/protocols/contract_api/contract_api_pb2.py index 71ca3fecc7..b3aa2dc806 100644 --- a/packages/fetchai/protocols/contract_api/contract_api_pb2.py +++ b/packages/fetchai/protocols/contract_api/contract_api_pb2.py @@ -25,24 +25,24 @@ "RawTransaction" ] _CONTRACTAPIMESSAGE_STATE = _CONTRACTAPIMESSAGE.nested_types_by_name["State"] -_CONTRACTAPIMESSAGE_GET_DEPLOY_TRANSACTION_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ - "Get_Deploy_Transaction_Performative" -] -_CONTRACTAPIMESSAGE_GET_RAW_TRANSACTION_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ - "Get_Raw_Transaction_Performative" -] -_CONTRACTAPIMESSAGE_GET_RAW_MESSAGE_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ - "Get_Raw_Message_Performative" -] +_CONTRACTAPIMESSAGE_GET_DEPLOY_TRANSACTION_PERFORMATIVE = ( + _CONTRACTAPIMESSAGE.nested_types_by_name["Get_Deploy_Transaction_Performative"] +) +_CONTRACTAPIMESSAGE_GET_RAW_TRANSACTION_PERFORMATIVE = ( + _CONTRACTAPIMESSAGE.nested_types_by_name["Get_Raw_Transaction_Performative"] +) +_CONTRACTAPIMESSAGE_GET_RAW_MESSAGE_PERFORMATIVE = ( + _CONTRACTAPIMESSAGE.nested_types_by_name["Get_Raw_Message_Performative"] +) _CONTRACTAPIMESSAGE_GET_STATE_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ "Get_State_Performative" ] _CONTRACTAPIMESSAGE_STATE_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ "State_Performative" ] -_CONTRACTAPIMESSAGE_RAW_TRANSACTION_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ - "Raw_Transaction_Performative" -] +_CONTRACTAPIMESSAGE_RAW_TRANSACTION_PERFORMATIVE = ( + _CONTRACTAPIMESSAGE.nested_types_by_name["Raw_Transaction_Performative"] +) _CONTRACTAPIMESSAGE_RAW_MESSAGE_PERFORMATIVE = _CONTRACTAPIMESSAGE.nested_types_by_name[ "Raw_Message_Performative" ] diff --git a/packages/fetchai/protocols/contract_api/custom_types.py b/packages/fetchai/protocols/contract_api/custom_types.py index 49436b0564..af549fa6a7 100644 --- a/packages/fetchai/protocols/contract_api/custom_types.py +++ b/packages/fetchai/protocols/contract_api/custom_types.py @@ -40,7 +40,8 @@ class Kwargs: __slots__ = ("_body",) def __init__( - self, body: JSONLike, + self, + body: JSONLike, ): """Initialise an instance of RawTransaction.""" self._body = body diff --git a/packages/fetchai/protocols/contract_api/protocol.yaml b/packages/fetchai/protocols/contract_api/protocol.yaml index 21a68cf540..5968af498c 100644 --- a/packages/fetchai/protocols/contract_api/protocol.yaml +++ b/packages/fetchai/protocols/contract_api/protocol.yaml @@ -10,8 +10,8 @@ fingerprint: README.md: QmYJqcqfbCFE3LHMgok2xkP9z8myB9NNZsm6iR6NXh2HQF __init__.py: QmcUoi36ehCnRWcAbzfoxqDom9DD5xm31x6NeyZU1Krfuy contract_api.proto: QmVezvQ3vgN19nzJD1CfgvjHxjdaP4yLUSwaQDMQq85vUZ - contract_api_pb2.py: QmRp7JBW1HQGwShSagVLTpvQvEkQPqAZLqnTT2HkBpXBuk - custom_types.py: QmW9Ju9GnYc8A7sbG8RvR8NnTCf5sVfycYqotN6WZb76LG + contract_api_pb2.py: QmXgS6swWgask1MH1B1rGWeF4YgPwcVnuZuAVPGwgNV7XH + custom_types.py: QmUyCSgCKMUkL1FJBjBjS6mCxAoniqDUT8T3nVNkkf87B7 dialogues.py: QmcZkkLmVg6a1QZZxCA9KN9DrKBaYY8b6y8cwUnUpqbXhq message.py: Qmbe4GiQYi9fUPm8M9trSHsGygWYUeay6cTtbtMVU7XnYe serialization.py: QmbDFNH8iu6rUEt1prtmqya9U339qSaXXXZF9C2Vxa9Rhf diff --git a/packages/fetchai/protocols/default/default_pb2.py b/packages/fetchai/protocols/default/default_pb2.py index 218da5160a..423f18f99c 100644 --- a/packages/fetchai/protocols/default/default_pb2.py +++ b/packages/fetchai/protocols/default/default_pb2.py @@ -26,9 +26,9 @@ _DEFAULTMESSAGE_ERROR_PERFORMATIVE = _DEFAULTMESSAGE.nested_types_by_name[ "Error_Performative" ] -_DEFAULTMESSAGE_ERROR_PERFORMATIVE_ERRORDATAENTRY = _DEFAULTMESSAGE_ERROR_PERFORMATIVE.nested_types_by_name[ - "ErrorDataEntry" -] +_DEFAULTMESSAGE_ERROR_PERFORMATIVE_ERRORDATAENTRY = ( + _DEFAULTMESSAGE_ERROR_PERFORMATIVE.nested_types_by_name["ErrorDataEntry"] +) _DEFAULTMESSAGE_END_PERFORMATIVE = _DEFAULTMESSAGE.nested_types_by_name[ "End_Performative" ] diff --git a/packages/fetchai/protocols/default/protocol.yaml b/packages/fetchai/protocols/default/protocol.yaml index 91d23a5860..136f2b2414 100644 --- a/packages/fetchai/protocols/default/protocol.yaml +++ b/packages/fetchai/protocols/default/protocol.yaml @@ -11,7 +11,7 @@ fingerprint: __init__.py: QmTpuT9XnHiQUf1SeBZUEAYJLoBMDiod1FkRysB7a2RR9x custom_types.py: QmVbmxfpiHM8xDvsRvytPr4jmjD5Ktc5171fweYGBkXvBd default.proto: QmWYzTSHVbz7FBS84iKFMhGSXPxay2mss29vY7ufz2BFJ8 - default_pb2.py: QmRjBnFfnHHPygYmSdXfVp6A2FZ7PtrYKpdwTXxMYLwEGK + default_pb2.py: QmPX9tm18ddM5Q928JLd1HmdUZKp2ssKhCJzhZ53FJmjxM dialogues.py: Qmf8f7w8vr1zNgcRFiiNSd2EcrwQdffhv61X9qQ2tSNUxj message.py: QmcTXLt4K18kGxuQXivwEVrqYWse1gaXkD5oh7wSnAmiGv serialization.py: QmXKrfcSiUzHnP6Jh5zXsTT4yktNSFZTUbyEQJ6M7Qbjt9 diff --git a/packages/fetchai/protocols/fipa/fipa_pb2.py b/packages/fetchai/protocols/fipa/fipa_pb2.py index c81dc723e9..d01328b723 100644 --- a/packages/fetchai/protocols/fipa/fipa_pb2.py +++ b/packages/fetchai/protocols/fipa/fipa_pb2.py @@ -28,21 +28,21 @@ _FIPAMESSAGE_ACCEPT_W_INFORM_PERFORMATIVE = _FIPAMESSAGE.nested_types_by_name[ "Accept_W_Inform_Performative" ] -_FIPAMESSAGE_ACCEPT_W_INFORM_PERFORMATIVE_INFOENTRY = _FIPAMESSAGE_ACCEPT_W_INFORM_PERFORMATIVE.nested_types_by_name[ - "InfoEntry" -] +_FIPAMESSAGE_ACCEPT_W_INFORM_PERFORMATIVE_INFOENTRY = ( + _FIPAMESSAGE_ACCEPT_W_INFORM_PERFORMATIVE.nested_types_by_name["InfoEntry"] +) _FIPAMESSAGE_MATCH_ACCEPT_W_INFORM_PERFORMATIVE = _FIPAMESSAGE.nested_types_by_name[ "Match_Accept_W_Inform_Performative" ] -_FIPAMESSAGE_MATCH_ACCEPT_W_INFORM_PERFORMATIVE_INFOENTRY = _FIPAMESSAGE_MATCH_ACCEPT_W_INFORM_PERFORMATIVE.nested_types_by_name[ - "InfoEntry" -] +_FIPAMESSAGE_MATCH_ACCEPT_W_INFORM_PERFORMATIVE_INFOENTRY = ( + _FIPAMESSAGE_MATCH_ACCEPT_W_INFORM_PERFORMATIVE.nested_types_by_name["InfoEntry"] +) _FIPAMESSAGE_INFORM_PERFORMATIVE = _FIPAMESSAGE.nested_types_by_name[ "Inform_Performative" ] -_FIPAMESSAGE_INFORM_PERFORMATIVE_INFOENTRY = _FIPAMESSAGE_INFORM_PERFORMATIVE.nested_types_by_name[ - "InfoEntry" -] +_FIPAMESSAGE_INFORM_PERFORMATIVE_INFOENTRY = ( + _FIPAMESSAGE_INFORM_PERFORMATIVE.nested_types_by_name["InfoEntry"] +) _FIPAMESSAGE_ACCEPT_PERFORMATIVE = _FIPAMESSAGE.nested_types_by_name[ "Accept_Performative" ] diff --git a/packages/fetchai/protocols/fipa/protocol.yaml b/packages/fetchai/protocols/fipa/protocol.yaml index 922d77c409..458635024a 100644 --- a/packages/fetchai/protocols/fipa/protocol.yaml +++ b/packages/fetchai/protocols/fipa/protocol.yaml @@ -12,7 +12,7 @@ fingerprint: custom_types.py: Qmf72KRbkNsxxAHwMtkmJc5TRL23fU7AuzJAdSTftckwJQ dialogues.py: QmRvjJDEbGyhTh1cF6kSbzf45F7bEXFpWMnTw4Yf2TBymL fipa.proto: QmS7aXZ2JoG3oyMHWiPYoP9RJ7iChsoTC9KQLsj6vi3ejR - fipa_pb2.py: QmdWGLjJodWABWvEokcX1gE6aXbZsncqFtbdHQ3LdGtNj7 + fipa_pb2.py: QmT6CxDiwyz3ucsNxZSxtNZXE9NThshV68zvXEYtiWjEUP message.py: QmSHn574QE8rgZhky2PaTUjRx8HgXWzh1vX57hfv38S8Rr serialization.py: QmaT2ufYcRQE2naPPQHtj97XNDLd6aRZcA3Q2oWqqNQUhw fingerprint_ignore_patterns: [] diff --git a/packages/fetchai/protocols/gym/gym_pb2.py b/packages/fetchai/protocols/gym/gym_pb2.py index 8d76fe961e..a169cb3635 100644 --- a/packages/fetchai/protocols/gym/gym_pb2.py +++ b/packages/fetchai/protocols/gym/gym_pb2.py @@ -27,9 +27,9 @@ _GYMMESSAGE_STATUS_PERFORMATIVE = _GYMMESSAGE.nested_types_by_name[ "Status_Performative" ] -_GYMMESSAGE_STATUS_PERFORMATIVE_CONTENTENTRY = _GYMMESSAGE_STATUS_PERFORMATIVE.nested_types_by_name[ - "ContentEntry" -] +_GYMMESSAGE_STATUS_PERFORMATIVE_CONTENTENTRY = ( + _GYMMESSAGE_STATUS_PERFORMATIVE.nested_types_by_name["ContentEntry"] +) _GYMMESSAGE_RESET_PERFORMATIVE = _GYMMESSAGE.nested_types_by_name["Reset_Performative"] _GYMMESSAGE_CLOSE_PERFORMATIVE = _GYMMESSAGE.nested_types_by_name["Close_Performative"] GymMessage = _reflection.GeneratedProtocolMessageType( diff --git a/packages/fetchai/protocols/gym/protocol.yaml b/packages/fetchai/protocols/gym/protocol.yaml index 622778920e..26b7041510 100644 --- a/packages/fetchai/protocols/gym/protocol.yaml +++ b/packages/fetchai/protocols/gym/protocol.yaml @@ -12,7 +12,7 @@ fingerprint: custom_types.py: QmTQSizkRh6awSk4J2cPGjidMcZ356bTyYxNG2HSgfkj9B dialogues.py: QmYPuD9fkw6Rowu6eXJV5yaCjUe9jX9Ji3JSx3kQ6xaDKK gym.proto: QmSYD1qtmNwKnfuTUtPGzbfW3kww4viJ714aRTPupLdV62 - gym_pb2.py: QmcsNTwaEj4KRLMhPG4ybNHfzuoTjCjJGPwFnmBmxedY7z + gym_pb2.py: QmeUmYahs7P3iehNKnEF3pcQQ4kvMkhKaKc1nwVCFB2eA4 message.py: QmWBrPTavG6GjyWJj52Y4AgaCE2YhUHGQZ5EHt2dUABMzA serialization.py: QmNRi51HSCzCqUgBNMrdghjACAo1j5QoDU5HWPhjwWjSLP fingerprint_ignore_patterns: [] diff --git a/packages/fetchai/protocols/ledger_api/custom_types.py b/packages/fetchai/protocols/ledger_api/custom_types.py index 8a459563bc..76e0652830 100644 --- a/packages/fetchai/protocols/ledger_api/custom_types.py +++ b/packages/fetchai/protocols/ledger_api/custom_types.py @@ -46,7 +46,8 @@ class Kwargs: __slots__ = ("_body",) def __init__( - self, body: JSONLike, + self, + body: JSONLike, ): """Initialise an instance of RawTransaction.""" self._body = body diff --git a/packages/fetchai/protocols/ledger_api/ledger_api_pb2.py b/packages/fetchai/protocols/ledger_api/ledger_api_pb2.py index 29c7fc4177..2c229250f2 100644 --- a/packages/fetchai/protocols/ledger_api/ledger_api_pb2.py +++ b/packages/fetchai/protocols/ledger_api/ledger_api_pb2.py @@ -37,27 +37,27 @@ _LEDGERAPIMESSAGE_GET_BALANCE_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ "Get_Balance_Performative" ] -_LEDGERAPIMESSAGE_GET_RAW_TRANSACTION_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ - "Get_Raw_Transaction_Performative" -] -_LEDGERAPIMESSAGE_SEND_SIGNED_TRANSACTION_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ - "Send_Signed_Transaction_Performative" -] -_LEDGERAPIMESSAGE_GET_TRANSACTION_RECEIPT_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ - "Get_Transaction_Receipt_Performative" -] +_LEDGERAPIMESSAGE_GET_RAW_TRANSACTION_PERFORMATIVE = ( + _LEDGERAPIMESSAGE.nested_types_by_name["Get_Raw_Transaction_Performative"] +) +_LEDGERAPIMESSAGE_SEND_SIGNED_TRANSACTION_PERFORMATIVE = ( + _LEDGERAPIMESSAGE.nested_types_by_name["Send_Signed_Transaction_Performative"] +) +_LEDGERAPIMESSAGE_GET_TRANSACTION_RECEIPT_PERFORMATIVE = ( + _LEDGERAPIMESSAGE.nested_types_by_name["Get_Transaction_Receipt_Performative"] +) _LEDGERAPIMESSAGE_BALANCE_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ "Balance_Performative" ] _LEDGERAPIMESSAGE_RAW_TRANSACTION_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ "Raw_Transaction_Performative" ] -_LEDGERAPIMESSAGE_TRANSACTION_DIGEST_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ - "Transaction_Digest_Performative" -] -_LEDGERAPIMESSAGE_TRANSACTION_RECEIPT_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ - "Transaction_Receipt_Performative" -] +_LEDGERAPIMESSAGE_TRANSACTION_DIGEST_PERFORMATIVE = ( + _LEDGERAPIMESSAGE.nested_types_by_name["Transaction_Digest_Performative"] +) +_LEDGERAPIMESSAGE_TRANSACTION_RECEIPT_PERFORMATIVE = ( + _LEDGERAPIMESSAGE.nested_types_by_name["Transaction_Receipt_Performative"] +) _LEDGERAPIMESSAGE_GET_STATE_PERFORMATIVE = _LEDGERAPIMESSAGE.nested_types_by_name[ "Get_State_Performative" ] diff --git a/packages/fetchai/protocols/ledger_api/protocol.yaml b/packages/fetchai/protocols/ledger_api/protocol.yaml index b3468a4164..d038f1852c 100644 --- a/packages/fetchai/protocols/ledger_api/protocol.yaml +++ b/packages/fetchai/protocols/ledger_api/protocol.yaml @@ -9,10 +9,10 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmUjEQqcfDm1F1ARmG2fVp9J6nBdeHrXQiFAPKawtgR1g6 __init__.py: QmYppSmQXVNxSpRW4ipnGeQq1VmyBDsV3kq2hX8N9ePynY - custom_types.py: QmT3aUh6HP2LaD5HziEEvjxVpv4G671P5EKV3rfh77epgy + custom_types.py: QmfYLxQVcFtwVpBbqsvjsFauhSmySFrQebURZYQsRAnirw dialogues.py: QmcYRdn3UNeyCD8aSrcrc19Witznb2LqeMwyNRCVFkBmDb ledger_api.proto: QmdSbtU1eXT1ZLFZkdCzTpBD8NyDMWgiA4MJBoHJLdCkz3 - ledger_api_pb2.py: QmfHR13iNQKBCr8SD4CR2gue1w6Uy5cMLaZLxSiBRe4GG7 + ledger_api_pb2.py: QmcVLcoeYQBE55SRajkZM4JuZnooQMJgWxpZn1yLGrY7F3 message.py: QmTSksrYwk9E2LVN6K3ByduWQuWFR4ZmangEvckVioeTiB serialization.py: QmU8zQRrdpz7BKazcE1iPb5HT9pWcdcA8YvJpbDxEYjPKZ fingerprint_ignore_patterns: [] diff --git a/packages/fetchai/protocols/oef_search/oef_search_pb2.py b/packages/fetchai/protocols/oef_search/oef_search_pb2.py index d110386258..0d652c58c5 100644 --- a/packages/fetchai/protocols/oef_search/oef_search_pb2.py +++ b/packages/fetchai/protocols/oef_search/oef_search_pb2.py @@ -25,12 +25,12 @@ "OefErrorOperation" ] _OEFSEARCHMESSAGE_QUERY = _OEFSEARCHMESSAGE.nested_types_by_name["Query"] -_OEFSEARCHMESSAGE_REGISTER_SERVICE_PERFORMATIVE = _OEFSEARCHMESSAGE.nested_types_by_name[ - "Register_Service_Performative" -] -_OEFSEARCHMESSAGE_UNREGISTER_SERVICE_PERFORMATIVE = _OEFSEARCHMESSAGE.nested_types_by_name[ - "Unregister_Service_Performative" -] +_OEFSEARCHMESSAGE_REGISTER_SERVICE_PERFORMATIVE = ( + _OEFSEARCHMESSAGE.nested_types_by_name["Register_Service_Performative"] +) +_OEFSEARCHMESSAGE_UNREGISTER_SERVICE_PERFORMATIVE = ( + _OEFSEARCHMESSAGE.nested_types_by_name["Unregister_Service_Performative"] +) _OEFSEARCHMESSAGE_SEARCH_SERVICES_PERFORMATIVE = _OEFSEARCHMESSAGE.nested_types_by_name[ "Search_Services_Performative" ] @@ -43,9 +43,9 @@ _OEFSEARCHMESSAGE_OEF_ERROR_PERFORMATIVE = _OEFSEARCHMESSAGE.nested_types_by_name[ "Oef_Error_Performative" ] -_OEFSEARCHMESSAGE_OEFERROROPERATION_OEFERRORENUM = _OEFSEARCHMESSAGE_OEFERROROPERATION.enum_types_by_name[ - "OefErrorEnum" -] +_OEFSEARCHMESSAGE_OEFERROROPERATION_OEFERRORENUM = ( + _OEFSEARCHMESSAGE_OEFERROROPERATION.enum_types_by_name["OefErrorEnum"] +) OefSearchMessage = _reflection.GeneratedProtocolMessageType( "OefSearchMessage", (_message.Message,), diff --git a/packages/fetchai/protocols/oef_search/protocol.yaml b/packages/fetchai/protocols/oef_search/protocol.yaml index d2c9b44cd2..00998657cb 100644 --- a/packages/fetchai/protocols/oef_search/protocol.yaml +++ b/packages/fetchai/protocols/oef_search/protocol.yaml @@ -13,7 +13,7 @@ fingerprint: dialogues.py: QmTQL6ccCPnYCwaFQiJGtuWQx5SbCXmukUaPainmreyFBZ message.py: QmRAqT4QhYP4b3o1HbU1NcU6hpzoxRbyzv4PEYwVZbnV9T oef_search.proto: QmaYkawAXEeeNuCcjmwcvdsttnE3owtuP9ouAYVyRu7M2J - oef_search_pb2.py: QmaSXn3irhKQH7cVT4A1F38dNTwB9XhF41y5gZqA52ANGd + oef_search_pb2.py: QmSCvcwkLmwWESqiAs2Vj2yioUwLmdzMGaCDRo3sHT1ByL serialization.py: QmPoGQ7xvQQWoByWMTLJEPnQL9J5EXxWCVCCo4HQn9PiCW fingerprint_ignore_patterns: [] dependencies: diff --git a/packages/fetchai/protocols/state_update/protocol.yaml b/packages/fetchai/protocols/state_update/protocol.yaml index 782b9f96e4..55cfb7bb3f 100644 --- a/packages/fetchai/protocols/state_update/protocol.yaml +++ b/packages/fetchai/protocols/state_update/protocol.yaml @@ -13,7 +13,7 @@ fingerprint: message.py: QmP9uR4AvQv1A1Fx41bVC3cbQj4veRuEY1yERCdV8HvcQj serialization.py: QmZTJMieof5uL3zDQXRMnZso8Fs1CqgNn4Tua7DqihkFdk state_update.proto: QmPqvqnUQtcE475C3kCctNUsmi46JkMFGYE3rqMmqvbyEz - state_update_pb2.py: QmNQesScq6QBFtf1A6aRXBoawrLoTGr1TrfatHWx6wdujL + state_update_pb2.py: QmdhbG4QDykNBKXY2opbFUgaX37j4D1gVcPQCF499mm5Fv fingerprint_ignore_patterns: [] dependencies: protobuf: {} diff --git a/packages/fetchai/protocols/state_update/state_update_pb2.py b/packages/fetchai/protocols/state_update/state_update_pb2.py index 5caef19d8e..54207e1caf 100644 --- a/packages/fetchai/protocols/state_update/state_update_pb2.py +++ b/packages/fetchai/protocols/state_update/state_update_pb2.py @@ -22,27 +22,39 @@ _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE = _STATEUPDATEMESSAGE.nested_types_by_name[ "Initialize_Performative" ] -_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_EXCHANGEPARAMSBYCURRENCYIDENTRY = _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ - "ExchangeParamsByCurrencyIdEntry" -] -_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_UTILITYPARAMSBYGOODIDENTRY = _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ - "UtilityParamsByGoodIdEntry" -] -_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ - "AmountByCurrencyIdEntry" -] -_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ - "QuantitiesByGoodIdEntry" -] +_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_EXCHANGEPARAMSBYCURRENCYIDENTRY = ( + _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ + "ExchangeParamsByCurrencyIdEntry" + ] +) +_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_UTILITYPARAMSBYGOODIDENTRY = ( + _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ + "UtilityParamsByGoodIdEntry" + ] +) +_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = ( + _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ + "AmountByCurrencyIdEntry" + ] +) +_STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = ( + _STATEUPDATEMESSAGE_INITIALIZE_PERFORMATIVE.nested_types_by_name[ + "QuantitiesByGoodIdEntry" + ] +) _STATEUPDATEMESSAGE_APPLY_PERFORMATIVE = _STATEUPDATEMESSAGE.nested_types_by_name[ "Apply_Performative" ] -_STATEUPDATEMESSAGE_APPLY_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = _STATEUPDATEMESSAGE_APPLY_PERFORMATIVE.nested_types_by_name[ - "AmountByCurrencyIdEntry" -] -_STATEUPDATEMESSAGE_APPLY_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = _STATEUPDATEMESSAGE_APPLY_PERFORMATIVE.nested_types_by_name[ - "QuantitiesByGoodIdEntry" -] +_STATEUPDATEMESSAGE_APPLY_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = ( + _STATEUPDATEMESSAGE_APPLY_PERFORMATIVE.nested_types_by_name[ + "AmountByCurrencyIdEntry" + ] +) +_STATEUPDATEMESSAGE_APPLY_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = ( + _STATEUPDATEMESSAGE_APPLY_PERFORMATIVE.nested_types_by_name[ + "QuantitiesByGoodIdEntry" + ] +) _STATEUPDATEMESSAGE_END_PERFORMATIVE = _STATEUPDATEMESSAGE.nested_types_by_name[ "End_Performative" ] diff --git a/packages/fetchai/protocols/tac/protocol.yaml b/packages/fetchai/protocols/tac/protocol.yaml index daaef46774..6ba1e66901 100644 --- a/packages/fetchai/protocols/tac/protocol.yaml +++ b/packages/fetchai/protocols/tac/protocol.yaml @@ -15,7 +15,7 @@ fingerprint: message.py: QmSSGEPx2kR2Q1bdXFCKxQAkt9RDXxwhoWeozf76MY2Kce serialization.py: QmaaUfm1tKj77JBXfdhVWVzKyrFuNCdA9TGc7oonCZm9Uf tac.proto: QmTjxGkEoMdvdDvBMoKhjkBV4CNNgsn6JWt6rJEwXfnq7Z - tac_pb2.py: QmUBYXuuLfRJEYNbtjLM5UfwRacFf7EybBbrbE3nv78oy6 + tac_pb2.py: QmWAQ22NBCVLsBDK7x5CNXcC9GQcZRxZkQyHteJmRYiAQX fingerprint_ignore_patterns: [] dependencies: protobuf: {} diff --git a/packages/fetchai/protocols/tac/tac_pb2.py b/packages/fetchai/protocols/tac/tac_pb2.py index b1ff4672a7..fffbdf78f3 100644 --- a/packages/fetchai/protocols/tac/tac_pb2.py +++ b/packages/fetchai/protocols/tac/tac_pb2.py @@ -29,63 +29,71 @@ _TACMESSAGE_TRANSACTION_PERFORMATIVE = _TACMESSAGE.nested_types_by_name[ "Transaction_Performative" ] -_TACMESSAGE_TRANSACTION_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = _TACMESSAGE_TRANSACTION_PERFORMATIVE.nested_types_by_name[ - "AmountByCurrencyIdEntry" -] -_TACMESSAGE_TRANSACTION_PERFORMATIVE_FEEBYCURRENCYIDENTRY = _TACMESSAGE_TRANSACTION_PERFORMATIVE.nested_types_by_name[ - "FeeByCurrencyIdEntry" -] -_TACMESSAGE_TRANSACTION_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = _TACMESSAGE_TRANSACTION_PERFORMATIVE.nested_types_by_name[ - "QuantitiesByGoodIdEntry" -] +_TACMESSAGE_TRANSACTION_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = ( + _TACMESSAGE_TRANSACTION_PERFORMATIVE.nested_types_by_name["AmountByCurrencyIdEntry"] +) +_TACMESSAGE_TRANSACTION_PERFORMATIVE_FEEBYCURRENCYIDENTRY = ( + _TACMESSAGE_TRANSACTION_PERFORMATIVE.nested_types_by_name["FeeByCurrencyIdEntry"] +) +_TACMESSAGE_TRANSACTION_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = ( + _TACMESSAGE_TRANSACTION_PERFORMATIVE.nested_types_by_name["QuantitiesByGoodIdEntry"] +) _TACMESSAGE_CANCELLED_PERFORMATIVE = _TACMESSAGE.nested_types_by_name[ "Cancelled_Performative" ] _TACMESSAGE_GAME_DATA_PERFORMATIVE = _TACMESSAGE.nested_types_by_name[ "Game_Data_Performative" ] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "AmountByCurrencyIdEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_EXCHANGEPARAMSBYCURRENCYIDENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "ExchangeParamsByCurrencyIdEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "QuantitiesByGoodIdEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_UTILITYPARAMSBYGOODIDENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "UtilityParamsByGoodIdEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_FEEBYCURRENCYIDENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "FeeByCurrencyIdEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_AGENTADDRTONAMEENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "AgentAddrToNameEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_CURRENCYIDTONAMEENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "CurrencyIdToNameEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_GOODIDTONAMEENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "GoodIdToNameEntry" -] -_TACMESSAGE_GAME_DATA_PERFORMATIVE_INFOENTRY = _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ - "InfoEntry" -] +_TACMESSAGE_GAME_DATA_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["AmountByCurrencyIdEntry"] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_EXCHANGEPARAMSBYCURRENCYIDENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ + "ExchangeParamsByCurrencyIdEntry" + ] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["QuantitiesByGoodIdEntry"] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_UTILITYPARAMSBYGOODIDENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name[ + "UtilityParamsByGoodIdEntry" + ] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_FEEBYCURRENCYIDENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["FeeByCurrencyIdEntry"] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_AGENTADDRTONAMEENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["AgentAddrToNameEntry"] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_CURRENCYIDTONAMEENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["CurrencyIdToNameEntry"] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_GOODIDTONAMEENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["GoodIdToNameEntry"] +) +_TACMESSAGE_GAME_DATA_PERFORMATIVE_INFOENTRY = ( + _TACMESSAGE_GAME_DATA_PERFORMATIVE.nested_types_by_name["InfoEntry"] +) _TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE = _TACMESSAGE.nested_types_by_name[ "Transaction_Confirmation_Performative" ] -_TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = _TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE.nested_types_by_name[ - "AmountByCurrencyIdEntry" -] -_TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = _TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE.nested_types_by_name[ - "QuantitiesByGoodIdEntry" -] +_TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE_AMOUNTBYCURRENCYIDENTRY = ( + _TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE.nested_types_by_name[ + "AmountByCurrencyIdEntry" + ] +) +_TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE_QUANTITIESBYGOODIDENTRY = ( + _TACMESSAGE_TRANSACTION_CONFIRMATION_PERFORMATIVE.nested_types_by_name[ + "QuantitiesByGoodIdEntry" + ] +) _TACMESSAGE_TAC_ERROR_PERFORMATIVE = _TACMESSAGE.nested_types_by_name[ "Tac_Error_Performative" ] -_TACMESSAGE_TAC_ERROR_PERFORMATIVE_INFOENTRY = _TACMESSAGE_TAC_ERROR_PERFORMATIVE.nested_types_by_name[ - "InfoEntry" -] +_TACMESSAGE_TAC_ERROR_PERFORMATIVE_INFOENTRY = ( + _TACMESSAGE_TAC_ERROR_PERFORMATIVE.nested_types_by_name["InfoEntry"] +) _TACMESSAGE_ERRORCODE_ERRORCODEENUM = _TACMESSAGE_ERRORCODE.enum_types_by_name[ "ErrorCodeEnum" ] diff --git a/packages/fetchai/skills/echo/skill.yaml b/packages/fetchai/skills/echo/skill.yaml index 5aa4e3ded7..45770c294e 100644 --- a/packages/fetchai/skills/echo/skill.yaml +++ b/packages/fetchai/skills/echo/skill.yaml @@ -15,7 +15,7 @@ fingerprint_ignore_patterns: [] connections: [] contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT skills: [] behaviours: echo: diff --git a/packages/fetchai/skills/erc1155_client/handlers.py b/packages/fetchai/skills/erc1155_client/handlers.py index b9754b38b3..a3130456cd 100644 --- a/packages/fetchai/skills/erc1155_client/handlers.py +++ b/packages/fetchai/skills/erc1155_client/handlers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -134,7 +134,8 @@ def _handle_propose( # accept any proposal with the correct keys self.context.logger.info( "received valid PROPOSE from sender={}: proposal={}".format( - fipa_msg.sender[-5:], fipa_msg.proposal.values, + fipa_msg.sender[-5:], + fipa_msg.proposal.values, ) ) strategy = cast(Strategy, self.context.strategy) @@ -184,7 +185,8 @@ def _handle_propose( else: self.context.logger.info( "received invalid PROPOSE from sender={}: proposal={}".format( - fipa_msg.sender[-5:], fipa_msg.proposal.values, + fipa_msg.sender[-5:], + fipa_msg.proposal.values, ) ) @@ -317,7 +319,8 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle oef_search message of performative={} in dialogue={}.".format( - oef_search_msg.performative, oef_search_dialogue, + oef_search_msg.performative, + oef_search_dialogue, ) ) @@ -435,7 +438,8 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle contract_api message of performative={} in dialogue={}.".format( - contract_api_msg.performative, contract_api_dialogue, + contract_api_msg.performative, + contract_api_dialogue, ) ) @@ -510,7 +514,8 @@ def _handle_signed_message( ) self.context.logger.info( "sending ACCEPT_W_INFORM to agent={}: tx_signature={}".format( - last_fipa_msg.sender[-5:], signing_msg.signed_message, + last_fipa_msg.sender[-5:], + signing_msg.signed_message, ) ) self.context.outbox.put_message(message=inform_msg) @@ -604,7 +609,8 @@ def _handle_balance(self, ledger_api_msg: LedgerApiMessage) -> None: """ self.context.logger.info( "starting balance on {} ledger={}.".format( - ledger_api_msg.ledger_id, ledger_api_msg.balance, + ledger_api_msg.ledger_id, + ledger_api_msg.balance, ) ) @@ -634,6 +640,7 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle ledger_api message of performative={} in dialogue={}.".format( - ledger_api_msg.performative, ledger_api_dialogue, + ledger_api_msg.performative, + ledger_api_dialogue, ) ) diff --git a/packages/fetchai/skills/erc1155_client/skill.yaml b/packages/fetchai/skills/erc1155_client/skill.yaml index 5c8d68c531..17ae5f46fb 100644 --- a/packages/fetchai/skills/erc1155_client/skill.yaml +++ b/packages/fetchai/skills/erc1155_client/skill.yaml @@ -11,19 +11,19 @@ fingerprint: __init__.py: QmVQL3rBSKs1ApmySCSn9E23PsCeYezdrZ5dy7nJn4fZ4G behaviours.py: QmUBSxNv2D64f7DWimsqgRSWT8FuuALkx66ntBxBZ9XD7e dialogues.py: QmbEZwChPGR7Ax925YKu43FzG9ZRpfsGmfR91ede7cWGVG - handlers.py: QmS6nVoqCQ3g7grKntCySoESw7k7xMzts37nTPvFBB3vnm - strategy.py: QmPerQFTS2mtPfgkMmpnTup3CaYHWmDRNhCphcRU22VaYN + handlers.py: QmZ9G73cVtpChCWseoTWZoY66Lve3mRyXEt3KumiFeAioK + strategy.py: QmaThA58u9Pwkg1ft7kAXbWuvqCKsDS1H79LjcDX7hdQaE fingerprint_ignore_patterns: [] connections: -- fetchai/ledger:0.19.0:QmPCbasPNL1wFno9pFCF8wTqR9CaCt8i1QagMF2HmdkP2s +- fetchai/ledger:0.19.0:QmR2bvMWRzbcWMgqVP3xWpZ3GBnGyrtW9jQMXuFY51PWvt contracts: - fetchai/erc1155:0.22.0:QmcWju76BLXDzeH6po8nHhkZL7BgSEq4KqgvTgP1Y1ZUQ2 protocols: -- fetchai/contract_api:1.0.0:QmXfEAhomDMvdR9oDKzLmmegyS5Kf6Un2KxWPLgfbRF1kt -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/fipa:1.0.0:QmQELeVL8MvqAW28Jbzzz3sRS4Ewdi3tviZt3zsCwHKD79 -- fetchai/ledger_api:1.0.0:QmZ6SPoXVUhjbgsL3qw1JM2UJxsCSr4G3Jm16nsT3MG7jA -- fetchai/oef_search:1.0.0:QmPVwWnsvSRFxu89kRFcQSpbgeDuGrwscJYXXhtQAu7KqK +- fetchai/contract_api:1.0.0:QmTg7H4cM428TegTqMWFaaz9pyaHhG1fBz28aLiZpgkVj6 +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/fipa:1.0.0:Qmbe2oDXWp8eJ5SQfrChiHWPVA1qmaUmcWYXpnQKuSVUDb +- fetchai/ledger_api:1.0.0:QmNVqsvmEaZ21QTK25s4S6Cdfc2vyAA4ipxoLZKA3NPRes +- fetchai/oef_search:1.0.0:QmVD8sxmqeca59CM7XkVA8XJV8HhhzaffGHudUKSA956uV - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: [] behaviours: diff --git a/packages/fetchai/skills/erc1155_client/strategy.py b/packages/fetchai/skills/erc1155_client/strategy.py index c58185073b..f5d1eae978 100644 --- a/packages/fetchai/skills/erc1155_client/strategy.py +++ b/packages/fetchai/skills/erc1155_client/strategy.py @@ -88,7 +88,9 @@ def get_location_and_service_query(self) -> Query: self._search_query["search_value"], ), ) - query = Query([close_to_my_service, service_key_filter],) + query = Query( + [close_to_my_service, service_key_filter], + ) return query def get_service_query(self) -> Query: diff --git a/packages/fetchai/skills/erc1155_deploy/behaviours.py b/packages/fetchai/skills/erc1155_deploy/behaviours.py index fe353ce898..88ac6d42b7 100644 --- a/packages/fetchai/skills/erc1155_deploy/behaviours.py +++ b/packages/fetchai/skills/erc1155_deploy/behaviours.py @@ -154,7 +154,10 @@ def _request_contract_deploy_transaction(self) -> None: {"deployer_address": self.context.agent_address, "gas": strategy.gas} ), ) - contract_api_dialogue = cast(ContractApiDialogue, contract_api_dialogue,) + contract_api_dialogue = cast( + ContractApiDialogue, + contract_api_dialogue, + ) contract_api_dialogue.terms = strategy.get_deploy_terms() self.context.outbox.put_message(message=contract_api_msg) self.context.logger.info("requesting contract deployment transaction...") diff --git a/packages/fetchai/skills/erc1155_deploy/handlers.py b/packages/fetchai/skills/erc1155_deploy/handlers.py index 053e4ec7e4..aeaeee8d82 100644 --- a/packages/fetchai/skills/erc1155_deploy/handlers.py +++ b/packages/fetchai/skills/erc1155_deploy/handlers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -138,7 +138,8 @@ def _handle_cfp(self, fipa_msg: FipaMessage, fipa_dialogue: FipaDialogue) -> Non ) self.context.logger.info( "sending PROPOSE to agent={}: proposal={}".format( - fipa_msg.sender[-5:], fipa_dialogue.proposal.values, + fipa_msg.sender[-5:], + fipa_dialogue.proposal.values, ) ) self.context.outbox.put_message(message=proposal_msg) @@ -286,7 +287,8 @@ def _handle_balance(self, ledger_api_msg: LedgerApiMessage) -> None: """ self.context.logger.info( "starting balance on {} ledger={}.".format( - ledger_api_msg.ledger_id, ledger_api_msg.balance, + ledger_api_msg.ledger_id, + ledger_api_msg.balance, ) ) @@ -385,7 +387,8 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle ledger_api message of performative={} in dialogue={}.".format( - ledger_api_msg.performative, ledger_api_dialogue, + ledger_api_msg.performative, + ledger_api_dialogue, ) ) @@ -502,7 +505,8 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle contract_api message of performative={} in dialogue={}.".format( - contract_api_msg.performative, contract_api_dialogue, + contract_api_msg.performative, + contract_api_dialogue, ) ) @@ -753,6 +757,7 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle oef_search message of performative={} in dialogue={}.".format( - oef_search_msg.performative, oef_search_dialogue, + oef_search_msg.performative, + oef_search_dialogue, ) ) diff --git a/packages/fetchai/skills/erc1155_deploy/skill.yaml b/packages/fetchai/skills/erc1155_deploy/skill.yaml index 25b3ed2e58..6b1d464e76 100644 --- a/packages/fetchai/skills/erc1155_deploy/skill.yaml +++ b/packages/fetchai/skills/erc1155_deploy/skill.yaml @@ -9,21 +9,21 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmNg45JuqfVzDmvgpWLeaR861LSEvf9pishDKSPihtQnLE __init__.py: QmXT2fFD2y4hXNU7WLtaGnMJ74GG3UDuWeYXufDBdnXWcv - behaviours.py: QmZLACzjAHi3XmhdK4Wgr9R891buKLzLax1Sw9J4FfTUAs + behaviours.py: QmatnZhzx8k5Gdw1o9huKyN67VVQB2UiGTzddButBVW9Ke dialogues.py: QmT9ytEAKc6Gqdc7AxtB2on61uVyGne7wpsFAoHESDPMrb - handlers.py: QmQZqpiM1iFStmyrgM1gJAYvZR1MB8bNRy56gxazptVMqg - strategy.py: QmXPNZ8u59GNAu4uhY8CZwuVoaffpf3dadtuXyFLeFvAoM + handlers.py: QmbfRjCm7C2aB5fMeDUJBmYfQxMwmrkdaBQzYyX1Yhwq4s + strategy.py: Qmb4yHRtGYwZFdKHdKZS7NLyFhFbnipvGh3SznVDbZRpGd fingerprint_ignore_patterns: [] connections: -- fetchai/ledger:0.19.0:QmPCbasPNL1wFno9pFCF8wTqR9CaCt8i1QagMF2HmdkP2s +- fetchai/ledger:0.19.0:QmR2bvMWRzbcWMgqVP3xWpZ3GBnGyrtW9jQMXuFY51PWvt contracts: - fetchai/erc1155:0.22.0:QmcWju76BLXDzeH6po8nHhkZL7BgSEq4KqgvTgP1Y1ZUQ2 protocols: -- fetchai/contract_api:1.0.0:QmXfEAhomDMvdR9oDKzLmmegyS5Kf6Un2KxWPLgfbRF1kt -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/fipa:1.0.0:QmQELeVL8MvqAW28Jbzzz3sRS4Ewdi3tviZt3zsCwHKD79 -- fetchai/ledger_api:1.0.0:QmZ6SPoXVUhjbgsL3qw1JM2UJxsCSr4G3Jm16nsT3MG7jA -- fetchai/oef_search:1.0.0:QmPVwWnsvSRFxu89kRFcQSpbgeDuGrwscJYXXhtQAu7KqK +- fetchai/contract_api:1.0.0:QmTg7H4cM428TegTqMWFaaz9pyaHhG1fBz28aLiZpgkVj6 +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/fipa:1.0.0:Qmbe2oDXWp8eJ5SQfrChiHWPVA1qmaUmcWYXpnQKuSVUDb +- fetchai/ledger_api:1.0.0:QmNVqsvmEaZ21QTK25s4S6Cdfc2vyAA4ipxoLZKA3NPRes +- fetchai/oef_search:1.0.0:QmVD8sxmqeca59CM7XkVA8XJV8HhhzaffGHudUKSA956uV - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: [] behaviours: diff --git a/packages/fetchai/skills/erc1155_deploy/strategy.py b/packages/fetchai/skills/erc1155_deploy/strategy.py index 05d021b16d..fe05fc1153 100644 --- a/packages/fetchai/skills/erc1155_deploy/strategy.py +++ b/packages/fetchai/skills/erc1155_deploy/strategy.py @@ -223,7 +223,8 @@ def get_location_description(self) -> Description: :return: a description of the agent's location """ description = Description( - self._agent_location, data_model=AGENT_LOCATION_MODEL, + self._agent_location, + data_model=AGENT_LOCATION_MODEL, ) return description @@ -234,7 +235,8 @@ def get_register_service_description(self) -> Description: :return: a description of the offered services """ description = Description( - self._set_service_data, data_model=AGENT_SET_SERVICE_MODEL, + self._set_service_data, + data_model=AGENT_SET_SERVICE_MODEL, ) return description @@ -245,7 +247,8 @@ def get_register_personality_description(self) -> Description: :return: a description of the personality """ description = Description( - self._set_personality_data, data_model=AGENT_PERSONALITY_MODEL, + self._set_personality_data, + data_model=AGENT_PERSONALITY_MODEL, ) return description @@ -256,7 +259,8 @@ def get_register_classification_description(self) -> Description: :return: a description of the classification """ description = Description( - self._set_classification, data_model=AGENT_PERSONALITY_MODEL, + self._set_classification, + data_model=AGENT_PERSONALITY_MODEL, ) return description @@ -267,7 +271,8 @@ def get_service_description(self) -> Description: :return: a description of the offered services """ description = Description( - self._simple_service_data, data_model=SIMPLE_SERVICE_MODEL, + self._simple_service_data, + data_model=SIMPLE_SERVICE_MODEL, ) return description @@ -278,7 +283,8 @@ def get_unregister_service_description(self) -> Description: :return: a description of the to be removed service """ description = Description( - self._remove_service_data, data_model=AGENT_REMOVE_SERVICE_MODEL, + self._remove_service_data, + data_model=AGENT_REMOVE_SERVICE_MODEL, ) return description diff --git a/packages/fetchai/skills/error/skill.yaml b/packages/fetchai/skills/error/skill.yaml index 156309b5cf..a1d46c0421 100644 --- a/packages/fetchai/skills/error/skill.yaml +++ b/packages/fetchai/skills/error/skill.yaml @@ -13,7 +13,7 @@ fingerprint_ignore_patterns: [] connections: [] contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT skills: [] behaviours: {} handlers: diff --git a/packages/fetchai/skills/fipa_dummy_buyer/skill.yaml b/packages/fetchai/skills/fipa_dummy_buyer/skill.yaml index 1e44bdb702..2c21d3a3d5 100644 --- a/packages/fetchai/skills/fipa_dummy_buyer/skill.yaml +++ b/packages/fetchai/skills/fipa_dummy_buyer/skill.yaml @@ -15,7 +15,7 @@ fingerprint_ignore_patterns: [] connections: [] contracts: [] protocols: -- fetchai/fipa:1.0.0:QmQELeVL8MvqAW28Jbzzz3sRS4Ewdi3tviZt3zsCwHKD79 +- fetchai/fipa:1.0.0:Qmbe2oDXWp8eJ5SQfrChiHWPVA1qmaUmcWYXpnQKuSVUDb skills: [] behaviours: initializer: diff --git a/packages/fetchai/skills/generic_buyer/handlers.py b/packages/fetchai/skills/generic_buyer/handlers.py index 42b1290586..ef3a2f0f46 100644 --- a/packages/fetchai/skills/generic_buyer/handlers.py +++ b/packages/fetchai/skills/generic_buyer/handlers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -122,7 +122,8 @@ def _handle_propose( """ self.context.logger.info( "received proposal={} from sender={}".format( - fipa_msg.proposal.values, fipa_msg.sender[-5:], + fipa_msg.proposal.values, + fipa_msg.sender[-5:], ) ) strategy = cast(GenericStrategy, self.context.strategy) @@ -135,7 +136,8 @@ def _handle_propose( terms = strategy.terms_from_proposal(fipa_msg.proposal, fipa_msg.sender) fipa_dialogue.terms = terms accept_msg = fipa_dialogue.reply( - performative=FipaMessage.Performative.ACCEPT, target_message=fipa_msg, + performative=FipaMessage.Performative.ACCEPT, + target_message=fipa_msg, ) self.context.outbox.put_message(message=accept_msg) else: @@ -143,7 +145,8 @@ def _handle_propose( "declining the proposal from sender={}".format(fipa_msg.sender[-5:]) ) decline_msg = fipa_dialogue.reply( - performative=FipaMessage.Performative.DECLINE, target_message=fipa_msg, + performative=FipaMessage.Performative.DECLINE, + target_message=fipa_msg, ) self.context.outbox.put_message(message=decline_msg) @@ -380,7 +383,8 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle oef_search message of performative={} in dialogue={}.".format( - oef_search_msg.performative, oef_search_dialogue, + oef_search_msg.performative, + oef_search_dialogue, ) ) @@ -573,7 +577,8 @@ def _handle_balance(self, ledger_api_msg: LedgerApiMessage) -> None: if ledger_api_msg.balance > 0: self.context.logger.info( "starting balance on {} ledger={}.".format( - strategy.ledger_id, ledger_api_msg.balance, + strategy.ledger_id, + ledger_api_msg.balance, ) ) strategy.balance = ledger_api_msg.balance @@ -715,6 +720,7 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle ledger_api message of performative={} in dialogue={}.".format( - ledger_api_msg.performative, ledger_api_dialogue, + ledger_api_msg.performative, + ledger_api_dialogue, ) ) diff --git a/packages/fetchai/skills/generic_buyer/skill.yaml b/packages/fetchai/skills/generic_buyer/skill.yaml index 93f74c934b..cbd34dde9f 100644 --- a/packages/fetchai/skills/generic_buyer/skill.yaml +++ b/packages/fetchai/skills/generic_buyer/skill.yaml @@ -10,17 +10,17 @@ fingerprint: __init__.py: QmUfk1wtsr82C4AE4dYXezdZXkXm6Vx2jJs8NM16vwM3H1 behaviours.py: Qmb9EeboF8GkS1Hqz1Pw3Bo72riGdGx7XN4PKin6hQVGKg dialogues.py: QmcvxFzt2Z2oYbxzdbCPPXuds6rRi5o4mh2fghX1srgNtw - handlers.py: QmXWqHV2xL1RSAEw4L4kde1V2VoHMHLkGtJpT9srPz14my - strategy.py: QmRVeQXmkB1eN4JwqqETVUEgcvNUNQhVXhDm1HpRcGiYNt + handlers.py: QmZMwHvrvnouY7NV24px5pr8zVtTyrC45BNSLR16Vu9WNa + strategy.py: QmWXgNA8Fqdz2PFyig1hS8hHqGDDC7CyoRmZQ4LkGLLyTn fingerprint_ignore_patterns: [] connections: -- fetchai/ledger:0.19.0:QmPCbasPNL1wFno9pFCF8wTqR9CaCt8i1QagMF2HmdkP2s +- fetchai/ledger:0.19.0:QmR2bvMWRzbcWMgqVP3xWpZ3GBnGyrtW9jQMXuFY51PWvt contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/fipa:1.0.0:QmQELeVL8MvqAW28Jbzzz3sRS4Ewdi3tviZt3zsCwHKD79 -- fetchai/ledger_api:1.0.0:QmZ6SPoXVUhjbgsL3qw1JM2UJxsCSr4G3Jm16nsT3MG7jA -- fetchai/oef_search:1.0.0:QmPVwWnsvSRFxu89kRFcQSpbgeDuGrwscJYXXhtQAu7KqK +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/fipa:1.0.0:Qmbe2oDXWp8eJ5SQfrChiHWPVA1qmaUmcWYXpnQKuSVUDb +- fetchai/ledger_api:1.0.0:QmNVqsvmEaZ21QTK25s4S6Cdfc2vyAA4ipxoLZKA3NPRes +- fetchai/oef_search:1.0.0:QmVD8sxmqeca59CM7XkVA8XJV8HhhzaffGHudUKSA956uV - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: [] behaviours: diff --git a/packages/fetchai/skills/generic_buyer/strategy.py b/packages/fetchai/skills/generic_buyer/strategy.py index 698a0c1595..29aae367c2 100644 --- a/packages/fetchai/skills/generic_buyer/strategy.py +++ b/packages/fetchai/skills/generic_buyer/strategy.py @@ -157,7 +157,9 @@ def get_location_and_service_query(self) -> Query: self._search_query["search_value"], ), ) - query = Query([close_to_my_service, service_key_filter],) + query = Query( + [close_to_my_service, service_key_filter], + ) return query def get_service_query(self) -> Query: diff --git a/packages/fetchai/skills/generic_seller/handlers.py b/packages/fetchai/skills/generic_seller/handlers.py index c9bc0cb1ce..c80933f22d 100644 --- a/packages/fetchai/skills/generic_seller/handlers.py +++ b/packages/fetchai/skills/generic_seller/handlers.py @@ -145,7 +145,8 @@ def _handle_cfp(self, fipa_msg: FipaMessage, fipa_dialogue: FipaDialogue) -> Non "declined the CFP from sender={}".format(fipa_msg.sender[-5:]) ) decline_msg = fipa_dialogue.reply( - performative=FipaMessage.Performative.DECLINE, target_message=fipa_msg, + performative=FipaMessage.Performative.DECLINE, + target_message=fipa_msg, ) self.context.outbox.put_message(message=decline_msg) @@ -193,7 +194,8 @@ def _handle_accept( ) self.context.logger.info( "sending MATCH_ACCEPT_W_INFORM to sender={} with info={}".format( - fipa_msg.sender[-5:], info, + fipa_msg.sender[-5:], + info, ) ) self.context.outbox.put_message(message=match_accept_msg) @@ -253,7 +255,8 @@ def _handle_inform( ) self.context.logger.info( "transaction confirmed, sending data={} to buyer={}.".format( - fipa_dialogue.data_for_sale, fipa_msg.sender[-5:], + fipa_dialogue.data_for_sale, + fipa_msg.sender[-5:], ) ) else: @@ -342,7 +345,8 @@ def _handle_balance(self, ledger_api_msg: LedgerApiMessage) -> None: """ self.context.logger.info( "starting balance on {} ledger={}.".format( - ledger_api_msg.ledger_id, ledger_api_msg.balance, + ledger_api_msg.ledger_id, + ledger_api_msg.balance, ) ) @@ -385,7 +389,8 @@ def _handle_transaction_receipt( ) self.context.logger.info( "transaction confirmed, sending data={} to buyer={}.".format( - fipa_dialogue.data_for_sale, last_message.sender[-5:], + fipa_dialogue.data_for_sale, + last_message.sender[-5:], ) ) else: @@ -421,7 +426,8 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle ledger_api message of performative={} in dialogue={}.".format( - ledger_api_msg.performative, ledger_api_dialogue, + ledger_api_msg.performative, + ledger_api_dialogue, ) ) @@ -568,6 +574,7 @@ def _handle_invalid( """ self.context.logger.warning( "cannot handle oef_search message of performative={} in dialogue={}.".format( - oef_search_msg.performative, oef_search_dialogue, + oef_search_msg.performative, + oef_search_dialogue, ) ) diff --git a/packages/fetchai/skills/generic_seller/skill.yaml b/packages/fetchai/skills/generic_seller/skill.yaml index efb16daca2..81cb0237cf 100644 --- a/packages/fetchai/skills/generic_seller/skill.yaml +++ b/packages/fetchai/skills/generic_seller/skill.yaml @@ -11,17 +11,17 @@ fingerprint: __init__.py: QmNgbxAZUeLtGGA1eAAQufEd4y7eGpjC97wytq7yuWfjZR behaviours.py: QmZMdMaxM6gShJVxo83HoZGPQ1CZH2UxHe85R2nydsU9GQ dialogues.py: QmV4CzjeTnss1M3cDa7xwv6hfRCkeoDwaTDR6mHGkm9hrE - handlers.py: QmbUM86PH5FNriAQ43Gvc7hRMv5T24ZxXANGhpf4R6HHMK - strategy.py: QmfJwo9KxzZvSYexT84wMa2Wzy2TU3Byy3e9FqTnonYsL3 + handlers.py: Qmd1ZxjxJZgW4HFm3Ay8sAuo1AxGypgtThRMMmeg4Tweow + strategy.py: QmQKMb3YcmpewEq3mXabnk3rX6ZzipxCgdAPu8VDo2VEwL fingerprint_ignore_patterns: [] connections: -- fetchai/ledger:0.19.0:QmPCbasPNL1wFno9pFCF8wTqR9CaCt8i1QagMF2HmdkP2s +- fetchai/ledger:0.19.0:QmR2bvMWRzbcWMgqVP3xWpZ3GBnGyrtW9jQMXuFY51PWvt contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/fipa:1.0.0:QmQELeVL8MvqAW28Jbzzz3sRS4Ewdi3tviZt3zsCwHKD79 -- fetchai/ledger_api:1.0.0:QmZ6SPoXVUhjbgsL3qw1JM2UJxsCSr4G3Jm16nsT3MG7jA -- fetchai/oef_search:1.0.0:QmPVwWnsvSRFxu89kRFcQSpbgeDuGrwscJYXXhtQAu7KqK +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/fipa:1.0.0:Qmbe2oDXWp8eJ5SQfrChiHWPVA1qmaUmcWYXpnQKuSVUDb +- fetchai/ledger_api:1.0.0:QmNVqsvmEaZ21QTK25s4S6Cdfc2vyAA4ipxoLZKA3NPRes +- fetchai/oef_search:1.0.0:QmVD8sxmqeca59CM7XkVA8XJV8HhhzaffGHudUKSA956uV skills: [] behaviours: service_registration: diff --git a/packages/fetchai/skills/generic_seller/strategy.py b/packages/fetchai/skills/generic_seller/strategy.py index b5e089d5d9..0ef3dc64d6 100644 --- a/packages/fetchai/skills/generic_seller/strategy.py +++ b/packages/fetchai/skills/generic_seller/strategy.py @@ -151,7 +151,8 @@ def get_location_description(self) -> Description: :return: a description of the agent's location """ description = Description( - self._agent_location, data_model=AGENT_LOCATION_MODEL, + self._agent_location, + data_model=AGENT_LOCATION_MODEL, ) return description @@ -162,7 +163,8 @@ def get_register_service_description(self) -> Description: :return: a description of the offered services """ description = Description( - self._set_service_data, data_model=AGENT_SET_SERVICE_MODEL, + self._set_service_data, + data_model=AGENT_SET_SERVICE_MODEL, ) return description @@ -173,7 +175,8 @@ def get_register_personality_description(self) -> Description: :return: a description of the personality """ description = Description( - self._set_personality_data, data_model=AGENT_PERSONALITY_MODEL, + self._set_personality_data, + data_model=AGENT_PERSONALITY_MODEL, ) return description @@ -184,7 +187,8 @@ def get_register_classification_description(self) -> Description: :return: a description of the classification """ description = Description( - self._set_classification, data_model=AGENT_PERSONALITY_MODEL, + self._set_classification, + data_model=AGENT_PERSONALITY_MODEL, ) return description @@ -195,7 +199,8 @@ def get_service_description(self) -> Description: :return: a description of the offered services """ description = Description( - self._simple_service_data, data_model=SIMPLE_SERVICE_MODEL, + self._simple_service_data, + data_model=SIMPLE_SERVICE_MODEL, ) return description @@ -206,7 +211,8 @@ def get_unregister_service_description(self) -> Description: :return: a description of the to be removed service """ description = Description( - self._remove_service_data, data_model=AGENT_REMOVE_SERVICE_MODEL, + self._remove_service_data, + data_model=AGENT_REMOVE_SERVICE_MODEL, ) return description diff --git a/packages/fetchai/skills/gym/helpers.py b/packages/fetchai/skills/gym/helpers.py index 3204fe47f3..148ded6814 100644 --- a/packages/fetchai/skills/gym/helpers.py +++ b/packages/fetchai/skills/gym/helpers.py @@ -139,7 +139,8 @@ def reset(self) -> None: self._step_count = 0 self._is_rl_agent_trained = False gym_msg, gym_dialogue = self.gym_dialogues.create( - counterparty=self.gym_address, performative=GymMessage.Performative.RESET, + counterparty=self.gym_address, + performative=GymMessage.Performative.RESET, ) gym_dialogue = cast(GymDialogue, gym_dialogue) self._active_dialogue = gym_dialogue @@ -162,7 +163,8 @@ def close(self) -> None: if last_msg is None: # pragma: nocover raise ValueError("Cannot retrieve last message.") gym_msg = self.active_gym_dialogue.reply( - performative=GymMessage.Performative.CLOSE, target_message=last_msg, + performative=GymMessage.Performative.CLOSE, + target_message=last_msg, ) self._skill_context.outbox.put_message(message=gym_msg) diff --git a/packages/fetchai/skills/gym/skill.yaml b/packages/fetchai/skills/gym/skill.yaml index 39a8fe9221..0aff9245b9 100644 --- a/packages/fetchai/skills/gym/skill.yaml +++ b/packages/fetchai/skills/gym/skill.yaml @@ -10,15 +10,15 @@ fingerprint: __init__.py: QmdbXPv9mGP9jhyjL8odSUrFxWESaMJD27Scze7RF9LwM4 dialogues.py: QmTXi5973ww57PSh1aEpZfy4Gt6CWsjQHui9amsiVNUryM handlers.py: Qmenjg4jCoL6R7Qsbf26LZ5kp3nrVZzazFfvHHAdMakVyr - helpers.py: QmQQ69aze51AbVibqFGnZmnYMN6oq2i8SKysxSnK1CEQ9S + helpers.py: QmXxsdmntq2ZKFKDH6dDZa473EAhNRWZ2zrJdx3GnLH2DD rl_agent.py: Qmc93aj586usDy5a34c9HPM1Pv1azD4VTvT7qTHoMuabEA tasks.py: QmaZe6dwZU9G9FLsuzrVDE1oRCbxzi2GKSu6np1tAkJxre fingerprint_ignore_patterns: [] connections: -- fetchai/gym:0.19.0:QmRQtBH1mxYvKovuHCVCD5FRPxdwtBykWFX2rhQNssE1uF +- fetchai/gym:0.19.0:QmTBP9GVNG77w8J9TnhaekLCsgPzyBJkcnwhNaXpk7zvvo contracts: [] protocols: -- fetchai/gym:1.0.0:QmRTJHxbo9qWupgtGtqDphjmivT5ko6vEyLvh9gWvXYgJ6 +- fetchai/gym:1.0.0:QmRdTUcCzKWVhjqsqN6L9GqLftRnHPoVdGi45FNGsn5HnK skills: [] behaviours: {} handlers: diff --git a/packages/fetchai/skills/http_echo/handlers.py b/packages/fetchai/skills/http_echo/handlers.py index c16d72c996..787ea6e757 100644 --- a/packages/fetchai/skills/http_echo/handlers.py +++ b/packages/fetchai/skills/http_echo/handlers.py @@ -94,7 +94,9 @@ def _handle_request( """ self.context.logger.info( "received http request with method={}, url={} and body={!r}".format( - http_msg.method, http_msg.url, http_msg.body, + http_msg.method, + http_msg.url, + http_msg.body, ) ) if http_msg.method == "get": diff --git a/packages/fetchai/skills/http_echo/skill.yaml b/packages/fetchai/skills/http_echo/skill.yaml index 1678650fe6..59b6dff1cc 100644 --- a/packages/fetchai/skills/http_echo/skill.yaml +++ b/packages/fetchai/skills/http_echo/skill.yaml @@ -10,10 +10,10 @@ fingerprint: README.md: QmYC2Y95Mg327LyHzQ3WbxZA8g1NfSHasmDTRcvrGCXmiR __init__.py: QmbzzcpZFLNPNSMWJxPoJo225KdN3sdF1iCpo9P7g8ZnsH dialogues.py: QmQhYUN61trwX9juEwgyBeYHmEUyTZQ7voMMZM4RXrcoyU - handlers.py: QmVS26pHPzjVikrcZnJDFx9VLwBpH123DBshyVtRQLphm7 + handlers.py: QmWPorow1KQLFcHkyX7FMziF2ugyDQ9NiUzUvKYpMsNaHo fingerprint_ignore_patterns: [] connections: -- fetchai/http_server:0.22.0:QmNZLaHND6cXCFCwGHV3kbsguYxBm89v9h7c1sGHDvmqax +- fetchai/http_server:0.22.0:QmSjFKWEjBPUFyB6eNZ61Y2CJPrGYedu9p8VXFt49zZmiB contracts: [] protocols: - fetchai/http:1.0.0:QmUKPQ41NMxTmzEmcv5y3U5rc4EJAvj2kdQoEJWvP34ceD diff --git a/packages/hashes.csv b/packages/hashes.csv index 58617b71dc..c3a35a5504 100644 --- a/packages/hashes.csv +++ b/packages/hashes.csv @@ -1,43 +1,43 @@ fetchai/agents/error_test,QmNmxNm8XByXs7KZpkVTUYghnuak1nZjX27tBoarWu17Sa -fetchai/agents/gym_aea,QmUgwwgFKZKea5miwovU3JhrPSXgCj41qpnKLNY5ZjdbaJ -fetchai/agents/my_first_aea,QmNmJU9CH9rqCrE8Hu169xMSVEMCTAWHDdarfzyz1UJCp2 -fetchai/connections/gym,QmRQtBH1mxYvKovuHCVCD5FRPxdwtBykWFX2rhQNssE1uF -fetchai/connections/http_client,QmYKGz3EV1W3sZyChcf3DRsCB3YDqrJqKL9ivz1EAjAkda -fetchai/connections/http_server,QmNZLaHND6cXCFCwGHV3kbsguYxBm89v9h7c1sGHDvmqax -fetchai/connections/ledger,QmPCbasPNL1wFno9pFCF8wTqR9CaCt8i1QagMF2HmdkP2s -fetchai/connections/local,QmfHhX6TKc6mRawLSe4V71nBtynd1BcY5YnHL6HH963rp6 +fetchai/agents/gym_aea,QmXwebaF8vv7ZD5FHaRjXpQ1by8Ko49go2i8a6mVY2XtSN +fetchai/agents/my_first_aea,QmVGMrHJzriNsFWBiza8vc8to5oE7xfRQ4jcXA8BrhptWp +fetchai/connections/gym,QmTBP9GVNG77w8J9TnhaekLCsgPzyBJkcnwhNaXpk7zvvo +fetchai/connections/http_client,QmfXqyFVzsnjFjyChS16YuuvfHaLydr158HDwN4o9iTviz +fetchai/connections/http_server,QmSjFKWEjBPUFyB6eNZ61Y2CJPrGYedu9p8VXFt49zZmiB +fetchai/connections/ledger,QmR2bvMWRzbcWMgqVP3xWpZ3GBnGyrtW9jQMXuFY51PWvt +fetchai/connections/local,QmehB8jwfQUksp9m7EaUZqQevC2JQd672icQsL9RZxgKhC fetchai/connections/stub,QmektTWmXcjThQd8md8nSYgLapR3Gks3n3WEzwAWQFgc4z fetchai/contracts/erc1155,QmcWju76BLXDzeH6po8nHhkZL7BgSEq4KqgvTgP1Y1ZUQ2 -fetchai/protocols/contract_api,QmXfEAhomDMvdR9oDKzLmmegyS5Kf6Un2KxWPLgfbRF1kt -fetchai/protocols/default,QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -fetchai/protocols/fipa,QmQELeVL8MvqAW28Jbzzz3sRS4Ewdi3tviZt3zsCwHKD79 -fetchai/protocols/gym,QmRTJHxbo9qWupgtGtqDphjmivT5ko6vEyLvh9gWvXYgJ6 +fetchai/protocols/contract_api,QmTg7H4cM428TegTqMWFaaz9pyaHhG1fBz28aLiZpgkVj6 +fetchai/protocols/default,QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +fetchai/protocols/fipa,Qmbe2oDXWp8eJ5SQfrChiHWPVA1qmaUmcWYXpnQKuSVUDb +fetchai/protocols/gym,QmRdTUcCzKWVhjqsqN6L9GqLftRnHPoVdGi45FNGsn5HnK fetchai/protocols/http,QmUKPQ41NMxTmzEmcv5y3U5rc4EJAvj2kdQoEJWvP34ceD -fetchai/protocols/ledger_api,QmZ6SPoXVUhjbgsL3qw1JM2UJxsCSr4G3Jm16nsT3MG7jA -fetchai/protocols/oef_search,QmPVwWnsvSRFxu89kRFcQSpbgeDuGrwscJYXXhtQAu7KqK -fetchai/protocols/state_update,QmU11QAovn6MNWtBYnGVsUF9toLpniXHNwfoSNPu1LKxku -fetchai/protocols/tac,Qma6CsaTrGGJ5fjsyxqUmiYbUjyMpiY2GmuMeX5ymyfdPK -fetchai/skills/echo,QmWkxgujut8dgG4ojgcE2xibqt4ReCu2QoGMbmwrggMhun -fetchai/skills/erc1155_client,QmfAu2nAZeXL2hL9YmG1zoWvnjCshrTdWpCrHh9ExkHvdw -fetchai/skills/erc1155_deploy,QmUP7BrqSsQDtKGBqGwTuejcPs6v185d9WpKfoNeQqcYKX -fetchai/skills/error,QmXcGCkZgpSfnBCxauyz6CZXxk5Kxz1W7FwG2XeMpURakA +fetchai/protocols/ledger_api,QmNVqsvmEaZ21QTK25s4S6Cdfc2vyAA4ipxoLZKA3NPRes +fetchai/protocols/oef_search,QmVD8sxmqeca59CM7XkVA8XJV8HhhzaffGHudUKSA956uV +fetchai/protocols/state_update,QmWLyfRY3pxZCK6arwKsodTS9SyodCPsQMHHyK2jAUCUJ7 +fetchai/protocols/tac,QmWGdvkWH1LQ1wfmq8Ky4JvqhFdmVuJJncAS5GpNkCXvqD +fetchai/skills/echo,QmZTVDhVedMAUMAqW1pCLrGQEe4gqFG11Dr41XzvgueCSJ +fetchai/skills/erc1155_client,QmW2QcMwYzQsD9up1JyPL3tGvkvxmEhUYuLqm2oofby8L8 +fetchai/skills/erc1155_deploy,QmR3nsKxxsX28YwTGt8p79n4aHnpNZmqqAxwNHmRxKynfz +fetchai/skills/error,QmcEBHNx4yYwBuwEquGfsmGpevu97cMmBho5Pb7Nu4CQxB fetchai/skills/error_test_skill,QmZhWDHmU1VTY6ghwFHvcaCUrFBGg7utTdDkckY4Xiy3fr -fetchai/skills/fipa_dummy_buyer,QmXbEqDcxpsy5SoapwMsyNQ62FzftonUk7KE1XZcWRT3PK -fetchai/skills/generic_buyer,QmUxAmmEjexQYZV7WC5VsXV5jqMUqd5rBmMCiY7zyyHZh9 -fetchai/skills/generic_seller,QmPHQ3AHCNH8vhhrSA6wng6TbRiwXHVFVMCnsAy7VfijcZ -fetchai/skills/gym,QmdYZP1aCTR3zDBvo8U699BdGfmD7dXv1AedRrxWctxcaY -fetchai/skills/http_echo,QmRf9mzpTpdWvP2LuAK9sGVQHPJuzWrVcJNU63aTHX9c7o +fetchai/skills/fipa_dummy_buyer,QmeBcU8D64RLXtuvk6XQht8dC95e9uGKH95qqAJ6o9j61W +fetchai/skills/generic_buyer,QmWXynC11hfF924sjuvuBqW6WL3RfRmR79S6cXxFakaBXN +fetchai/skills/generic_seller,QmZUp7EpqWVPwRPHi2XrcQBB666uyXYZofng2zrzPH28ev +fetchai/skills/gym,QmZiYvKu6Ei7K5Zw8DCxSZxp7yy1SXJYyxnAd6pmg6HWYS +fetchai/skills/http_echo,Qmewu2F9NeGDxiYirYLda8McsWTuQ3HHih3n3CEGabDk4h fetchai/skills/task_test_skill,QmfMiEsAJnnN57TmtJ9PxsK4apg36LKPQM95pKuDU8LGHn -open_aea/agents/gym_aea,QmdzZ1n1sXQJLefxuZEBi72LnY55w7GCNHyY2qGQA9ccdT -open_aea/agents/http_echo,QmX38Jexrt1DGJP1njDdNiEuQTUi6YA5kioAYgHS2DbDsC -open_aea/agents/my_first_aea,Qma8191MQim5UFCf7zbgRrk7wZYTSckX5QTas1dpGzq6GE +open_aea/agents/gym_aea,QmRuiK9JwMWm44zLoa2kAAJdPASG95dX2HhCB78gLCAsf3 +open_aea/agents/http_echo,QmVtBe1jGPoZ7mDNWo8WKmgCtEYviU93puG39XkpcaYEch +open_aea/agents/my_first_aea,QmSUXu256PH22D4ZKp1K8ySmFCuHmghJhikJbtjQp5ka6Q open_aea/connections/scaffold,QmZ42VNQKHxG1pWad4GCtD4Z8pwS258xd45KbM8pTgmyFk open_aea/contracts/scaffold,QmWk6GLpbV3ZSZuhpTqejGdPd6c5iJQCGjo7g4ktW2BdMu open_aea/protocols/scaffold,QmSV8Xe9eDWvtSxRKZQquMy5d2kcR7FprJtStUD7wb5b3B open_aea/protocols/signing,QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf open_aea/skills/scaffold,QmemZUe28kMS72q9zLW6VVzfss2adEgFGwtWinPXzGPmUm -valory/connections/p2p_libp2p,QmSRpBExz3zYB4pur3wMUgmSTsaz6Qbb44hoG3Thj5nBA7 -valory/connections/p2p_libp2p_client,QmVm1uaKx2ZY1GgXe7BPx4v6NoD7eggAXSz3MQT9awUtew -valory/connections/p2p_libp2p_mailbox,QmTYsGMzZ1b1faXDGs3CHqRfdhcXyhA5L9kcFUD6msjGKM +valory/connections/p2p_libp2p,QmTSATrpyAnqUZ2XHvZZBQjKkSKNbEcDkeHP2M6GS2m2Vz +valory/connections/p2p_libp2p_client,QmPoUQTk5cGKNLf5eJYEhwod1pisY6pniPpbTSxjKW7hQ6 +valory/connections/p2p_libp2p_mailbox,QmTqd6eDnb1sGD6ED1nrV2EC8RMjAG3TMZU89L1vi1c11D valory/protocols/acn,QmbUv2WwG6o2q8F17esBweFuFiogRWbU4wBLrAkCFRUkUm -valory/protocols/tendermint,QmWVKFf8NQ5pNjCMjNpWUtY1efWupzAxx1RLQH4ggyZd9x +valory/protocols/tendermint,QmdP2sqXzLBLkLYcnN7z5t2ersMxpknBvpHmVaN5gCnBYx diff --git a/packages/open_aea/agents/gym_aea/aea-config.yaml b/packages/open_aea/agents/gym_aea/aea-config.yaml index 71d9d1412d..9eef3778a7 100644 --- a/packages/open_aea/agents/gym_aea/aea-config.yaml +++ b/packages/open_aea/agents/gym_aea/aea-config.yaml @@ -9,15 +9,15 @@ fingerprint: README.md: QmNZkqQZByU5yn18ELka8TAyypiRxhHjAfMSdZfUy9mRwy fingerprint_ignore_patterns: [] connections: -- fetchai/gym:0.19.0:QmRQtBH1mxYvKovuHCVCD5FRPxdwtBykWFX2rhQNssE1uF +- fetchai/gym:0.19.0:QmTBP9GVNG77w8J9TnhaekLCsgPzyBJkcnwhNaXpk7zvvo contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/gym:1.0.0:QmRTJHxbo9qWupgtGtqDphjmivT5ko6vEyLvh9gWvXYgJ6 -- fetchai/state_update:1.0.0:QmU11QAovn6MNWtBYnGVsUF9toLpniXHNwfoSNPu1LKxku +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/gym:1.0.0:QmRdTUcCzKWVhjqsqN6L9GqLftRnHPoVdGi45FNGsn5HnK +- fetchai/state_update:1.0.0:QmWLyfRY3pxZCK6arwKsodTS9SyodCPsQMHHyK2jAUCUJ7 - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: -- fetchai/gym:0.20.0:QmdYZP1aCTR3zDBvo8U699BdGfmD7dXv1AedRrxWctxcaY +- fetchai/gym:0.20.0:QmZiYvKu6Ei7K5Zw8DCxSZxp7yy1SXJYyxnAd6pmg6HWYS default_connection: fetchai/gym:0.19.0 default_ledger: ethereum private_key_paths: {} diff --git a/packages/open_aea/agents/http_echo/aea-config.yaml b/packages/open_aea/agents/http_echo/aea-config.yaml index 64b611cd98..1b69ed5b38 100644 --- a/packages/open_aea/agents/http_echo/aea-config.yaml +++ b/packages/open_aea/agents/http_echo/aea-config.yaml @@ -8,14 +8,14 @@ fingerprint: README.md: QmcUt99EhiM9CRqXNVZXhMrJRWUd28EA1FR6jnZq8PhTzu fingerprint_ignore_patterns: [] connections: -- fetchai/http_server:0.22.0:QmNZLaHND6cXCFCwGHV3kbsguYxBm89v9h7c1sGHDvmqax +- fetchai/http_server:0.22.0:QmSjFKWEjBPUFyB6eNZ61Y2CJPrGYedu9p8VXFt49zZmiB contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT - fetchai/http:1.0.0:QmUKPQ41NMxTmzEmcv5y3U5rc4EJAvj2kdQoEJWvP34ceD - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: -- fetchai/http_echo:0.20.0:QmRf9mzpTpdWvP2LuAK9sGVQHPJuzWrVcJNU63aTHX9c7o +- fetchai/http_echo:0.20.0:Qmewu2F9NeGDxiYirYLda8McsWTuQ3HHih3n3CEGabDk4h default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/open_aea/agents/my_first_aea/aea-config.yaml b/packages/open_aea/agents/my_first_aea/aea-config.yaml index ab4c44e1b7..2c80b78844 100644 --- a/packages/open_aea/agents/my_first_aea/aea-config.yaml +++ b/packages/open_aea/agents/my_first_aea/aea-config.yaml @@ -11,11 +11,11 @@ connections: - fetchai/stub:0.21.0:QmektTWmXcjThQd8md8nSYgLapR3Gks3n3WEzwAWQFgc4z contracts: [] protocols: -- fetchai/default:1.0.0:QmNuQp2z2bq2SsEGCUdYAyXLXyCRtB16RrsR2enGPaF3Nr -- fetchai/state_update:1.0.0:QmU11QAovn6MNWtBYnGVsUF9toLpniXHNwfoSNPu1LKxku +- fetchai/default:1.0.0:QmVxny6aqskQokYacKcEhxSSJrdA14eDQRX69N9xXKjLsT +- fetchai/state_update:1.0.0:QmWLyfRY3pxZCK6arwKsodTS9SyodCPsQMHHyK2jAUCUJ7 - open_aea/signing:1.0.0:QmYvwPTb6HXrNcKYvQwCWiHsB6sYQGHPLxr5DXQFtAbMrf skills: -- fetchai/echo:0.19.0:QmWkxgujut8dgG4ojgcE2xibqt4ReCu2QoGMbmwrggMhun +- fetchai/echo:0.19.0:QmZTVDhVedMAUMAqW1pCLrGQEe4gqFG11Dr41XzvgueCSJ default_connection: fetchai/stub:0.21.0 default_ledger: ethereum required_ledgers: diff --git a/packages/valory/connections/p2p_libp2p/check_dependencies.py b/packages/valory/connections/p2p_libp2p/check_dependencies.py index 3bb0f8c324..8421095bdc 100644 --- a/packages/valory/connections/p2p_libp2p/check_dependencies.py +++ b/packages/valory/connections/p2p_libp2p/check_dependencies.py @@ -189,7 +189,8 @@ def main() -> None: # pragma: nocover def _golang_module_build( - path: str, timeout: float = LIBP2P_NODE_DEPS_DOWNLOAD_TIMEOUT, + path: str, + timeout: float = LIBP2P_NODE_DEPS_DOWNLOAD_TIMEOUT, ) -> Optional[str]: """ Builds go module located at `path`, downloads necessary dependencies diff --git a/packages/valory/connections/p2p_libp2p/connection.yaml b/packages/valory/connections/p2p_libp2p/connection.yaml index f59dd18794..c862fa8382 100644 --- a/packages/valory/connections/p2p_libp2p/connection.yaml +++ b/packages/valory/connections/p2p_libp2p/connection.yaml @@ -10,7 +10,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmZP7GPu67Ag2Fw8zgZnzpQPqaYJvr7w8Zy5VhQ8Jpekkg __init__.py: QmRo1DRePomRccoY2tB3GnKV2rUoNFaaE26WDRKp4ATs33 - check_dependencies.py: QmS7PnP2G3vMrjqPHeuuTH74Nfowd33FUZkqYTUb3269Pi + check_dependencies.py: QmQCTSKYKcB5nj3x4esNHQkkW6u39grQ2j5KJ9g3nNnJzx connection.py: Qmagjyj3QrcmU3q7LGvSiHLzQFfLkzvux2mxaWFVCbij2D consts.py: QmWAHrbN2fhqEe8o6cVLtwhWaEFp6h5cUJtJddYWbibPJj libp2p_node/Makefile: QmYMR8evkEV166HXTxjaAYEBiQ9HFh2whKQ7uotXvr88TU diff --git a/packages/valory/connections/p2p_libp2p_client/connection.py b/packages/valory/connections/p2p_libp2p_client/connection.py index 2373e98510..64b5175cdb 100644 --- a/packages/valory/connections/p2p_libp2p_client/connection.py +++ b/packages/valory/connections/p2p_libp2p_client/connection.py @@ -220,7 +220,9 @@ async def _read(self) -> Optional[bytes]: """ return await self.pipe.read() - async def register(self,) -> None: + async def register( + self, + ) -> None: """Register agent on the remote node.""" agent_record = self.make_agent_record() acn_msg = acn_pb2.AcnMessage() @@ -662,7 +664,9 @@ async def _open_tls_connection(self) -> TCPSocketProtocol: ssl_ctx.check_hostname = False ssl_ctx.verify_mode = ssl.CERT_REQUIRED reader, writer = await asyncio.open_connection( - self._host, self._port, ssl=ssl_ctx, + self._host, + self._port, + ssl=ssl_ctx, ) return TCPSocketProtocol(reader, writer, logger=self.logger, loop=self._loop) diff --git a/packages/valory/connections/p2p_libp2p_client/connection.yaml b/packages/valory/connections/p2p_libp2p_client/connection.yaml index 514dc4da35..71376cee2d 100644 --- a/packages/valory/connections/p2p_libp2p_client/connection.yaml +++ b/packages/valory/connections/p2p_libp2p_client/connection.yaml @@ -10,7 +10,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmRmDYNeEsKRgKjroGCJmLVJqjfnUm9FNXBXv3YYBBwsXq __init__.py: QmWYz6a1UrsXsG55CQj6X2snQZWU7isUGBiWJWwDqEpYyS - connection.py: QmRRiFaEPA2K4unN4wWJuSGZEtqapachP1eguXVQeRxUqQ + connection.py: Qmcb8TxqJRDM4paQMARAdwrkTesCPidBZsvaFckRUD4k1f fingerprint_ignore_patterns: [] connections: [] protocols: diff --git a/packages/valory/connections/p2p_libp2p_mailbox/connection.py b/packages/valory/connections/p2p_libp2p_mailbox/connection.py index 0fc01ca557..8d54d356b8 100644 --- a/packages/valory/connections/p2p_libp2p_mailbox/connection.py +++ b/packages/valory/connections/p2p_libp2p_mailbox/connection.py @@ -495,7 +495,10 @@ class SSLValidator: """Interprocess communication channel client using tcp sockets with TLS.""" def __init__( - self, url: str, server_pub_key: str, logger: logging.Logger = _default_logger, + self, + url: str, + server_pub_key: str, + logger: logging.Logger = _default_logger, ) -> None: """ Check ssl certificate with server pub key. @@ -559,7 +562,11 @@ async def get_ssl_ctx_and_session_pub_key( ssl_ctx = ssl.create_default_context(cadata=cadata) ssl_ctx.check_hostname = False ssl_ctx.verify_mode = ssl.CERT_REQUIRED - _, writer = await asyncio.open_connection(self.host, self.port, ssl=ssl_ctx,) + _, writer = await asyncio.open_connection( + self.host, + self.port, + ssl=ssl_ctx, + ) session_pub_key = self._get_session_pub_key(writer) writer.close() return ssl_ctx, session_pub_key diff --git a/packages/valory/connections/p2p_libp2p_mailbox/connection.yaml b/packages/valory/connections/p2p_libp2p_mailbox/connection.yaml index c33b25bd14..9a1ebc9c5f 100644 --- a/packages/valory/connections/p2p_libp2p_mailbox/connection.yaml +++ b/packages/valory/connections/p2p_libp2p_mailbox/connection.yaml @@ -10,7 +10,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: QmRmDYNeEsKRgKjroGCJmLVJqjfnUm9FNXBXv3YYBBwsXq __init__.py: QmWYz6a1UrsXsG55CQj6X2snQZWU7isUGBiWJWwDqEpYyS - connection.py: Qmf5Vwi8o9wPbP8VjUfnqL7jwCo373LrGt59CbsjPVzpdi + connection.py: Qmdwk9NtXpcZeQFF7fp6pYv9xbhQZKNP7p51onCaeCXqDc fingerprint_ignore_patterns: [] connections: [] protocols: diff --git a/packages/valory/protocols/tendermint/protocol.yaml b/packages/valory/protocols/tendermint/protocol.yaml index 37c12e8651..9de64d3a6b 100644 --- a/packages/valory/protocols/tendermint/protocol.yaml +++ b/packages/valory/protocols/tendermint/protocol.yaml @@ -15,7 +15,7 @@ fingerprint: message.py: QmeHjyNVGkb6T6UwZBxdBajmGR4wQrUycZdSePAkA6Zibo serialization.py: QmPR6pQociRaSbDqd4GgizfrNtpoLq7yKeesoWRWUQd5aJ tendermint.proto: QmZup4Pkm26FqQvhXtH2JZsAzUQsrdgmUdhdCEM9774cxJ - tendermint_pb2.py: QmQyAhhVTpea4UJtzGNtJGf65Vuoa6fiT5WUYZpksp4TAC + tendermint_pb2.py: QmTAe7UQ3hiL92VSWujkCS5dgzLUBcd7RZgiVZT4AVRjK4 fingerprint_ignore_patterns: [] dependencies: protobuf: {} diff --git a/packages/valory/protocols/tendermint/tendermint_pb2.py b/packages/valory/protocols/tendermint/tendermint_pb2.py index 5ee0d0dc01..ee0c451adc 100644 --- a/packages/valory/protocols/tendermint/tendermint_pb2.py +++ b/packages/valory/protocols/tendermint/tendermint_pb2.py @@ -29,12 +29,12 @@ _TENDERMINTMESSAGE_ERROR_PERFORMATIVE = _TENDERMINTMESSAGE.nested_types_by_name[ "Error_Performative" ] -_TENDERMINTMESSAGE_ERROR_PERFORMATIVE_ERRORDATAENTRY = _TENDERMINTMESSAGE_ERROR_PERFORMATIVE.nested_types_by_name[ - "ErrorDataEntry" -] -_TENDERMINTMESSAGE_ERRORCODE_ERRORCODEENUM = _TENDERMINTMESSAGE_ERRORCODE.enum_types_by_name[ - "ErrorCodeEnum" -] +_TENDERMINTMESSAGE_ERROR_PERFORMATIVE_ERRORDATAENTRY = ( + _TENDERMINTMESSAGE_ERROR_PERFORMATIVE.nested_types_by_name["ErrorDataEntry"] +) +_TENDERMINTMESSAGE_ERRORCODE_ERRORCODEENUM = ( + _TENDERMINTMESSAGE_ERRORCODE.enum_types_by_name["ErrorCodeEnum"] +) TendermintMessage = _reflection.GeneratedProtocolMessageType( "TendermintMessage", (_message.Message,), diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/case.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/case.py index 860c627180..db808d5da5 100755 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/case.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/case.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # +# Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -69,7 +70,11 @@ def make_envelope(from_addr: str, to_addr: str) -> Envelope: performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=to_addr, sender=from_addr, message=msg,) + envelope = Envelope( + to=to_addr, + sender=from_addr, + message=msg, + ) return envelope diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/command.py index 8f739f5e79..c580574168 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/command.py @@ -71,6 +71,13 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (connection, connect_times,),) + return multi_run( + int(number_of_runs), + run, + ( + connection, + connect_times, + ), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_startup/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_startup/command.py index bffff429b4..1cbb35de53 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_startup/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_startup/command.py @@ -70,6 +70,13 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (connection, connect_times,),) + return multi_run( + int(number_of_runs), + run, + ( + connection, + connect_times, + ), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_agent_construction_time/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_agent_construction_time/command.py index 146c1e858d..121b4a37e9 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_agent_construction_time/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_agent_construction_time/command.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # +# Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,6 +44,10 @@ def main(agents: int, number_of_runs: int, output_format: str) -> Any: parameters = {"Agents": agents, "Number of runs": number_of_runs} def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (agents,),) + return multi_run( + int(number_of_runs), + run, + (agents,), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_decision_maker/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_decision_maker/command.py index 2e43dfba8f..2c51af9503 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_decision_maker/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_decision_maker/command.py @@ -62,6 +62,13 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (ledger_id, amount_of_tx,),) + return multi_run( + int(number_of_runs), + run, + ( + ledger_id, + amount_of_tx, + ), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_dialogues_memory_usage/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_dialogues_memory_usage/command.py index 6e49a9d249..bd0e69a677 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_dialogues_memory_usage/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_dialogues_memory_usage/command.py @@ -36,7 +36,10 @@ @click.command(name="dialogues_mem_usage") @click.option( - "--messages", default=1000, help="Run time in seconds.", show_default=True, + "--messages", + default=1000, + help="Run time in seconds.", + show_default=True, ) @number_of_runs_deco @output_format_deco @@ -48,6 +51,10 @@ def main(messages: str, number_of_runs: int, output_format: str) -> Any: parameters = {"Messages": messages, "Number of runs": number_of_runs} def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (int(messages),),) + return multi_run( + int(number_of_runs), + run, + (int(messages),), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_mem_usage/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_mem_usage/command.py index 89f7e49a0c..09945afac2 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_mem_usage/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_mem_usage/command.py @@ -54,6 +54,10 @@ def main( from aea_cli_benchmark.case_mem_usage.case import run def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (duration, runtime_mode),) + return multi_run( + int(number_of_runs), + run, + (duration, runtime_mode), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_messages_memory_usage/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_messages_memory_usage/command.py index 054bd56645..7351bd2f36 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_messages_memory_usage/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_messages_memory_usage/command.py @@ -36,7 +36,10 @@ @click.command(name="messages_mem_usage") @click.option( - "--messages", default=10 ** 6, help="Amount of messages.", show_default=True, + "--messages", + default=10**6, + help="Amount of messages.", + show_default=True, ) @number_of_runs_deco @output_format_deco @@ -48,7 +51,11 @@ def main(messages: int, number_of_runs: int, output_format: str) -> Any: parameters = {"Messages": messages, "Number of runs": number_of_runs} def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (int(messages),),) + return multi_run( + int(number_of_runs), + run, + (int(messages),), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent/case.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent/case.py index 9bf522783c..df37cc1acc 100755 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent/case.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent/case.py @@ -53,10 +53,14 @@ class TestHandler(Handler): def setup(self) -> None: """Noop setup.""" self.count: int = 0 # pylint: disable=attribute-defined-outside-init - self.rtt_total_time: float = 0.0 # pylint: disable=attribute-defined-outside-init + self.rtt_total_time: float = ( + 0.0 # pylint: disable=attribute-defined-outside-init + ) self.rtt_count: int = 0 # pylint: disable=attribute-defined-outside-init - self.latency_total_time: float = 0.0 # pylint: disable=attribute-defined-outside-init + self.latency_total_time: float = ( + 0.0 # pylint: disable=attribute-defined-outside-init + ) self.latency_count: int = 0 # pylint: disable=attribute-defined-outside-init def teardown(self) -> None: diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent_http_dialogues/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent_http_dialogues/command.py index 197b57de05..ab049bf023 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent_http_dialogues/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_multiagent_http_dialogues/command.py @@ -42,7 +42,10 @@ @click.command(name="multiagent_http_dialogues") @click.option( - "--duration", default=1, help="Run time in seconds.", show_default=True, + "--duration", + default=1, + help="Run time in seconds.", + show_default=True, ) @runtime_mode_deco @click.option( @@ -59,7 +62,10 @@ show_default=True, ) @click.option( - "--num_of_agents", default=2, help="Amount of agents to run.", show_default=True, + "--num_of_agents", + default=2, + help="Amount of agents to run.", + show_default=True, ) @number_of_runs_deco @output_format_deco diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_proactive/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_proactive/command.py index 6b05c9842d..927b4ce4b3 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_proactive/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_proactive/command.py @@ -36,7 +36,10 @@ @click.command(name="proactive") @click.option( - "--duration", default=3, help="Run time in seconds.", show_default=True, + "--duration", + default=3, + help="Run time in seconds.", + show_default=True, ) @runtime_mode_deco @number_of_runs_deco @@ -55,6 +58,10 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (duration, runtime_mode),) + return multi_run( + int(number_of_runs), + run, + (duration, runtime_mode), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/case.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/case.py index b2e5ebbb8b..ae5fb10f5a 100755 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/case.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/case.py @@ -113,7 +113,15 @@ def run( agent.stop() t.join(5) - data = list(map(lambda x: x[1] - x[0], zip(connection.sends, connection.recvs,))) + data = list( + map( + lambda x: x[1] - x[0], + zip( + connection.sends, + connection.recvs, + ), + ) + ) if not data: raise ValueError("Could not collect enough data.") @@ -123,6 +131,6 @@ def run( return [ ("envelopes received", len(connection.recvs)), ("envelopes sent", len(connection.sends)), - ("latency(ms)", 10 ** 6 * latency), + ("latency(ms)", 10**6 * latency), ("rate(envelopes/second)", rate), ] diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/command.py index e6c494470d..5b8c887085 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_reactive/command.py @@ -36,7 +36,10 @@ @click.command(name="reactive") @click.option( - "--duration", default=1, help="Run time in seconds.", show_default=True, + "--duration", + default=1, + help="Run time in seconds.", + show_default=True, ) @runtime_mode_deco @click.option( @@ -68,7 +71,9 @@ def main( def result_fn() -> List[Tuple[str, Any, Any, Any]]: return multi_run( - int(number_of_runs), run, (duration, runtime_mode, connection_mode), + int(number_of_runs), + run, + (duration, runtime_mode, connection_mode), ) try: diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/case.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/case.py index ce203a902d..5e05651982 100755 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/case.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/case.py @@ -373,7 +373,12 @@ def start_agent(self) -> None: protocol_specification_id=LedgerApiMessage.protocol_specification_id, ) - resources.add_protocol(Protocol(pconfig, message_class=LedgerApiMessage,)) + resources.add_protocol( + Protocol( + pconfig, + message_class=LedgerApiMessage, + ) + ) connection = LedgerConnection( data_dir="./", @@ -490,7 +495,9 @@ def run(ledger_id: str, running_time: float) -> List[Tuple[str, Union[int, float private_keys=private_keys, ) - tx_processed, execution_time = case.run(time_in_seconds=running_time,) + tx_processed, execution_time = case.run( + time_in_seconds=running_time, + ) return [ ("run_time (seconds)", execution_time), diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/command.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/command.py index 37bc9d02a2..a05bca29c8 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/command.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/command.py @@ -75,6 +75,13 @@ def main( } def result_fn() -> List[Tuple[str, Any, Any, Any]]: - return multi_run(int(number_of_runs), run, (ledger_id, test_time,),) + return multi_run( + int(number_of_runs), + run, + ( + ledger_id, + test_time, + ), + ) return print_results(output_format, parameters, result_fn) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/core.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/core.py index 9d32a0923a..603d17fdff 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/core.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/case_tx_generate/core.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # +# Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -150,7 +151,8 @@ def make_section(case: BenchmarkCase) -> Dict: yaml_dump_all(configs, stream=f) else: yaml_dump_all( - configs, stream=sys.stdout, + configs, + stream=sys.stdout, ) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/core.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/core.py index 40a619e99c..fbf8d9b89a 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/core.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/core.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # +# Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -156,7 +157,8 @@ def make_section(case: BenchmarkCase) -> Dict: yaml_dump_all(configs, stream=f) else: yaml_dump_all( - configs, stream=sys.stdout, + configs, + stream=sys.stdout, ) diff --git a/plugins/aea-cli-benchmark/aea_cli_benchmark/utils.py b/plugins/aea-cli-benchmark/aea_cli_benchmark/utils.py index a42288f841..3824a5cd5c 100644 --- a/plugins/aea-cli-benchmark/aea_cli_benchmark/utils.py +++ b/plugins/aea-cli-benchmark/aea_cli_benchmark/utils.py @@ -154,7 +154,11 @@ def make_envelope(sender: str, to: str, message: Optional[Message] = None) -> En ) message.sender = sender message.to = to - return Envelope(to=to, sender=sender, message=message,) + return Envelope( + to=to, + sender=sender, + message=message, + ) class GeneratorConnection(Connection): @@ -200,9 +204,13 @@ async def receive(self, *args: Any, **kwargs: Any) -> Optional["Envelope"]: return envelope @classmethod - def make(cls,) -> "GeneratorConnection": + def make( + cls, + ) -> "GeneratorConnection": """Construct connection instance.""" - configuration = ConnectionConfig(connection_id=cls.connection_id,) + configuration = ConnectionConfig( + connection_id=cls.connection_id, + ) test_connection = cls( configuration=configuration, identity=Identity("name", "address", "pubkey"), @@ -271,7 +279,7 @@ def make_skill( def get_mem_usage_in_mb() -> float: """Get memory usage of the current process in megabytes.""" - return 1.0 * psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2 + return 1.0 * psutil.Process(os.getpid()).memory_info().rss / 1024**2 def multi_run( diff --git a/plugins/aea-cli-ipfs/aea_cli_ipfs/core.py b/plugins/aea-cli-ipfs/aea_cli_ipfs/core.py index 0b3d6c4466..80e10a89be 100644 --- a/plugins/aea-cli-ipfs/aea_cli_ipfs/core.py +++ b/plugins/aea-cli-ipfs/aea_cli_ipfs/core.py @@ -93,7 +93,10 @@ def add( @ipfs.command() @click.argument( - "hash_", metavar="hash", type=str, required=True, + "hash_", + metavar="hash", + type=str, + required=True, ) @click.pass_context def remove(click_context: click.Context, hash_: str) -> None: @@ -108,7 +111,10 @@ def remove(click_context: click.Context, hash_: str) -> None: @ipfs.command() @click.argument( - "hash_", metavar="hash", type=str, required=True, + "hash_", + metavar="hash", + type=str, + required=True, ) @click.argument( "target_dir", @@ -146,7 +152,11 @@ def _get_path_data(dir_path: str) -> Optional[Tuple[str, str]]: return None -def register_package(ipfs_tool: IPFSTool, dir_path: str, no_pin: bool,) -> str: +def register_package( + ipfs_tool: IPFSTool, + dir_path: str, + no_pin: bool, +) -> str: """ Register package to IPFS registry. diff --git a/plugins/aea-cli-ipfs/aea_cli_ipfs/ipfs_utils.py b/plugins/aea-cli-ipfs/aea_cli_ipfs/ipfs_utils.py index 44ce256469..a9555db65e 100644 --- a/plugins/aea-cli-ipfs/aea_cli_ipfs/ipfs_utils.py +++ b/plugins/aea-cli-ipfs/aea_cli_ipfs/ipfs_utils.py @@ -117,7 +117,9 @@ def _check_ipfs() -> None: if res is None: raise Exception("Please install IPFS first!") process = subprocess.Popen( # nosec - ["ipfs", "--version"], stdout=subprocess.PIPE, env=os.environ.copy(), + ["ipfs", "--version"], + stdout=subprocess.PIPE, + env=os.environ.copy(), ) output, _ = process.communicate() if b"0.6.0" not in output: @@ -145,7 +147,9 @@ def start(self) -> None: """Run the ipfs daemon.""" cmd = ["ipfs", "daemon", "--offline"] self.process = subprocess.Popen( # nosec - cmd, stdout=subprocess.PIPE, env=os.environ.copy(), + cmd, + stdout=subprocess.PIPE, + env=os.environ.copy(), ) empty_outputs = 0 for stdout_line in iter(self.process.stdout.readline, ""): @@ -197,7 +201,9 @@ def __init__(self, addr: Optional[str] = None): self.daemon = IPFSDaemon(node_url=addr_to_url(self.addr)) @property - def addr(self,) -> str: + def addr( + self, + ) -> str: """Node address""" if self._addr is None: addr = os.environ.get("OPEN_AEA_IPFS_ADDR", DEFAULT_IPFS_URL) @@ -234,7 +240,10 @@ def add(self, dir_path: str, pin: bool = True) -> Tuple[str, str, List]: :return: dir name published, hash, list of items processed """ response = self.client.add( - dir_path, pin=pin, recursive=True, wrap_with_directory=True, + dir_path, + pin=pin, + recursive=True, + wrap_with_directory=True, ) return response[-2]["Name"], response[-1]["Hash"], response[:-1] diff --git a/plugins/aea-cli-ipfs/aea_cli_ipfs/registry.py b/plugins/aea-cli-ipfs/aea_cli_ipfs/registry.py index 3516f518be..87beae9c10 100644 --- a/plugins/aea-cli-ipfs/aea_cli_ipfs/registry.py +++ b/plugins/aea-cli-ipfs/aea_cli_ipfs/registry.py @@ -108,7 +108,9 @@ def load_local_registry(registry_path: str = LOCAL_REGISTRY_PATH) -> LocalRegist def get_ipfs_hash_from_public_id( - item_type: str, public_id: PublicId, registry_path: str = LOCAL_REGISTRY_PATH, + item_type: str, + public_id: PublicId, + registry_path: str = LOCAL_REGISTRY_PATH, ) -> Optional[str]: """Get IPFS hash from local registry.""" @@ -150,7 +152,10 @@ def register_item_to_local_registry( def fetch_ipfs( - item_type: str, public_id: PublicId, dest: str, remote: bool = True, + item_type: str, + public_id: PublicId, + dest: str, + remote: bool = True, ) -> Optional[Path]: """Fetch a package from IPFS node.""" if remote: diff --git a/plugins/aea-ledger-cosmos/aea_ledger_cosmos/cosmos.py b/plugins/aea-ledger-cosmos/aea_ledger_cosmos/cosmos.py index 3308aefe27..40aef9df44 100644 --- a/plugins/aea-ledger-cosmos/aea_ledger_cosmos/cosmos.py +++ b/plugins/aea-ledger-cosmos/aea_ledger_cosmos/cosmos.py @@ -136,7 +136,7 @@ def _password_to_key_and_salt( password: str, salt: Optional[bytes] = None ) -> Tuple[bytes, bytes]: salt = salt or get_random_bytes(16) - key = scrypt(password, salt, 16, N=2 ** 14, r=8, p=1) # type: ignore + key = scrypt(password, salt, 16, N=2**14, r=8, p=1) # type: ignore return key, salt # type: ignore @classmethod @@ -284,7 +284,11 @@ def get_contract_address(cls, tx_receipt: JSONLike) -> Optional[str]: @staticmethod def is_transaction_valid( - tx: JSONLike, seller: Address, client: Address, tx_nonce: str, amount: int, + tx: JSONLike, + seller: Address, + client: Address, + tx_nonce: str, + amount: int, ) -> bool: """ Check whether a transaction is valid or not. @@ -375,7 +379,10 @@ def recover_public_keys_from_message( """ signature_b64 = base64.b64decode(signature) verifying_keys = VerifyingKey.from_public_key_recovery( - signature_b64, message, SECP256k1, hashfunc=hashlib.sha256, + signature_b64, + message, + SECP256k1, + hashfunc=hashlib.sha256, ) public_keys = [ verifying_key.to_string("compressed").hex() @@ -517,7 +524,9 @@ def sign_message( :return: signature of the message in string form """ signature_compact = self.entity.sign_deterministic( - message, hashfunc=hashlib.sha256, sigencode=sigencode_string_canonize, + message, + hashfunc=hashlib.sha256, + sigencode=sigencode_string_canonize, ) signature_base64_str = base64.b64encode(signature_compact).decode("utf-8") return signature_base64_str @@ -1280,7 +1289,9 @@ def _get_transaction( single = ModeInfo.Single(mode=SignMode.SIGN_MODE_DIRECT) mode_info = ModeInfo(single=single) signer_info = SignerInfo( - public_key=from_pub_key_packed, mode_info=mode_info, sequence=sequence, + public_key=from_pub_key_packed, + mode_info=mode_info, + sequence=sequence, ) signer_infos.append(signer_info) @@ -1291,7 +1302,8 @@ def _get_transaction( # Prepare auth info auth_info = AuthInfo( - signer_infos=signer_infos, fee=Fee(amount=tx_fee, gas_limit=gas), + signer_infos=signer_infos, + fee=Fee(amount=tx_fee, gas_limit=gas), ) # Prepare Tx body @@ -1430,7 +1442,10 @@ def update_with_gas_estimate(self, transaction: JSONLike) -> JSONLike: ) def contract_method_call( - self, contract_instance: Any, method_name: str, **method_args: Any, + self, + contract_instance: Any, + method_name: str, + **method_args: Any, ) -> Optional[JSONLike]: """Call a contract's method @@ -1607,7 +1622,10 @@ def _try_check_faucet_claim( if "txStatus" in data["claim"]: tx_digest = data["claim"]["txStatus"]["hash"] - return CosmosFaucetStatus(tx_digest=tx_digest, status=data["claim"]["status"],) + return CosmosFaucetStatus( + tx_digest=tx_digest, + status=data["claim"]["status"], + ) @classmethod def _faucet_request_uri(cls, url: Optional[str] = None) -> str: diff --git a/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py b/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py index 13a8c981cc..7bf2cced11 100644 --- a/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py +++ b/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py @@ -626,7 +626,11 @@ def get_contract_address(tx_receipt: JSONLike) -> Optional[str]: @staticmethod def is_transaction_valid( - tx: dict, seller: Address, client: Address, tx_nonce: str, amount: int, + tx: dict, + seller: Address, + client: Address, + tx_nonce: str, + amount: int, ) -> bool: """ Check whether a transaction is valid or not. @@ -963,7 +967,8 @@ def try_get_gas_pricing( """ retrieved_strategy = self._get_gas_price_strategy( - gas_price_strategy, extra_config, + gas_price_strategy, + extra_config, ) if retrieved_strategy is None: # pragma: nocover return None @@ -1157,7 +1162,8 @@ def get_contract_instance( """ if contract_address is None: instance = self.api.eth.contract( - abi=contract_interface[_ABI], bytecode=contract_interface[_BYTECODE], + abi=contract_interface[_ABI], + bytecode=contract_interface[_BYTECODE], ) else: _contract_address = self.api.toChecksumAddress(contract_address) @@ -1263,7 +1269,10 @@ def is_valid_address(cls, address: Address) -> bool: @classmethod def contract_method_call( - cls, contract_instance: Any, method_name: str, **method_args: Any, + cls, + contract_instance: Any, + method_name: str, + **method_args: Any, ) -> Optional[JSONLike]: """Call a contract's method diff --git a/plugins/aea-ledger-ethereum/tests/test_ethereum.py b/plugins/aea-ledger-ethereum/tests/test_ethereum.py index 08b843e3e3..fad1e229ce 100644 --- a/plugins/aea-ledger-ethereum/tests/test_ethereum.py +++ b/plugins/aea-ledger-ethereum/tests/test_ethereum.py @@ -253,7 +253,9 @@ def _wait_get_receipt( def _construct_and_settle_tx( - ethereum_api: EthereumApi, account: EthereumCrypto, tx_params: dict, + ethereum_api: EthereumApi, + account: EthereumCrypto, + tx_params: dict, ) -> Tuple[str, JSONLike, bool]: """Construct and settle a transaction.""" transfer_transaction = ethereum_api.get_transfer_transaction(**tx_params) @@ -301,7 +303,9 @@ def test_construct_sign_and_submit_transfer_transaction( } transaction_digest, transaction_receipt, is_settled = _construct_and_settle_tx( - ethereum_api, account, tx_params, + ethereum_api, + account, + tx_params, ) assert is_settled, "Failed to verify tx!" @@ -464,7 +468,11 @@ def test_gas_price_strategy_eip1559() -> None: ) fee_history_mock = mock.patch.object( - web3.eth, "fee_history", return_value=get_history_data(n_blocks=5,), + web3.eth, + "fee_history", + return_value=get_history_data( + n_blocks=5, + ), ) with get_block_mock: @@ -487,7 +495,11 @@ def test_gas_price_strategy_eip1559_estimate_none() -> None: ) fee_history_mock = mock.patch.object( - web3.eth, "fee_history", return_value=get_history_data(n_blocks=5,), + web3.eth, + "fee_history", + return_value=get_history_data( + n_blocks=5, + ), ) with get_block_mock: with fee_history_mock: @@ -515,7 +527,11 @@ def test_gas_price_strategy_eip1559_fallback() -> None: ) fee_history_mock = mock.patch.object( - web3.eth, "fee_history", return_value=get_history_data(n_blocks=5,), + web3.eth, + "fee_history", + return_value=get_history_data( + n_blocks=5, + ), ) with get_block_mock: with fee_history_mock: @@ -652,7 +668,8 @@ def pass_tx_params(tx_params): eth_api = EthereumApi(**ethereum_testnet_config) with mock.patch( - "web3.eth.Eth.get_transaction_count", return_value=0, + "web3.eth.Eth.get_transaction_count", + return_value=0, ): result = eth_api.build_transaction( contract_instance=contract_instance, @@ -669,17 +686,27 @@ def pass_tx_params(tx_params): ) assert result == dict( - nonce=0, value=0, gas=0, gasPrice=0, maxFeePerGas=0, maxPriorityFeePerGas=0, + nonce=0, + value=0, + gas=0, + gasPrice=0, + maxFeePerGas=0, + maxPriorityFeePerGas=0, ) with mock.patch.object( - EthereumApi, "try_get_gas_pricing", return_value={"gas": 0}, + EthereumApi, + "try_get_gas_pricing", + return_value={"gas": 0}, ): result = eth_api.build_transaction( contract_instance=contract_instance, method_name="dummy_method", method_args={}, - tx_args=dict(sender_address="sender_address", eth_value=0,), + tx_args=dict( + sender_address="sender_address", + eth_value=0, + ), ) assert result == dict(nonce=0, value=0, gas=0) @@ -692,13 +719,15 @@ def test_get_transaction_transfer_logs(ethereum_testnet_config): dummy_receipt = {"logs": [{"topics": ["0x0", "0x0"]}]} with mock.patch( - "web3.eth.Eth.get_transaction_receipt", return_value=dummy_receipt, + "web3.eth.Eth.get_transaction_receipt", + return_value=dummy_receipt, ): contract_instance = MagicMock() contract_instance.events.Transfer().processReceipt.return_value = {"log": "log"} result = eth_api.get_transaction_transfer_logs( - contract_instance=contract_instance, tx_hash="dummy_hash", + contract_instance=contract_instance, + tx_hash="dummy_hash", ) assert result == dict(logs={"log": "log"}) @@ -709,13 +738,15 @@ def test_get_transaction_transfer_logs_raise(ethereum_testnet_config): eth_api = EthereumApi(**ethereum_testnet_config) with mock.patch( - "web3.eth.Eth.get_transaction_receipt", return_value=None, + "web3.eth.Eth.get_transaction_receipt", + return_value=None, ): contract_instance = MagicMock() contract_instance.events.Transfer().processReceipt.return_value = {"log": "log"} result = eth_api.get_transaction_transfer_logs( - contract_instance=contract_instance, tx_hash="dummy_hash", + contract_instance=contract_instance, + tx_hash="dummy_hash", ) assert result == dict(logs=[]) @@ -725,7 +756,9 @@ def test_get_transaction_transfer_logs_raise(ethereum_testnet_config): @pytest.mark.integration @pytest.mark.ledger def test_revert_reason( - ethereum_private_key_file: str, ethereum_testnet_config: dict, ganache: Generator, + ethereum_private_key_file: str, + ethereum_testnet_config: dict, + ganache: Generator, ) -> None: """Test the retrieval of the revert reason for a transaction.""" account = EthereumCrypto(private_key_path=ethereum_private_key_file) @@ -748,10 +781,13 @@ def test_revert_reason( return_value=AttributeDict({"status": 0}), ): with mock.patch( - "web3.eth.Eth.call", side_effect=SolidityError("test revert reason"), + "web3.eth.Eth.call", + side_effect=SolidityError("test revert reason"), ): _, transaction_receipt, is_settled = _construct_and_settle_tx( - ethereum_api, account, tx_params, + ethereum_api, + account, + tx_params, ) assert transaction_receipt["revert_reason"] == "test revert reason" diff --git a/plugins/aea-ledger-ethereum/tests/test_ethereum_contract.py b/plugins/aea-ledger-ethereum/tests/test_ethereum_contract.py index 0c7f981608..21cb703a5d 100644 --- a/plugins/aea-ledger-ethereum/tests/test_ethereum_contract.py +++ b/plugins/aea-ledger-ethereum/tests/test_ethereum_contract.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -60,10 +60,13 @@ def test_get_contract_instance(ethereum_testnet_config, ganache): erc1155_contract_address = cast(Dict, receipt)["contractAddress"] interface = {"abi": [], "bytecode": b""} instance = ethereum_api.get_contract_instance( - contract_interface=interface, contract_address=erc1155_contract_address, + contract_interface=interface, + contract_address=erc1155_contract_address, ) assert str(type(instance)) == "" - instance = ethereum_api.get_contract_instance(contract_interface=interface,) + instance = ethereum_api.get_contract_instance( + contract_interface=interface, + ) assert ( str(type(instance)) == "" ) diff --git a/plugins/aea-ledger-fetchai/aea_ledger_fetchai/_cosmos.py b/plugins/aea-ledger-fetchai/aea_ledger_fetchai/_cosmos.py index 3308aefe27..40aef9df44 100644 --- a/plugins/aea-ledger-fetchai/aea_ledger_fetchai/_cosmos.py +++ b/plugins/aea-ledger-fetchai/aea_ledger_fetchai/_cosmos.py @@ -136,7 +136,7 @@ def _password_to_key_and_salt( password: str, salt: Optional[bytes] = None ) -> Tuple[bytes, bytes]: salt = salt or get_random_bytes(16) - key = scrypt(password, salt, 16, N=2 ** 14, r=8, p=1) # type: ignore + key = scrypt(password, salt, 16, N=2**14, r=8, p=1) # type: ignore return key, salt # type: ignore @classmethod @@ -284,7 +284,11 @@ def get_contract_address(cls, tx_receipt: JSONLike) -> Optional[str]: @staticmethod def is_transaction_valid( - tx: JSONLike, seller: Address, client: Address, tx_nonce: str, amount: int, + tx: JSONLike, + seller: Address, + client: Address, + tx_nonce: str, + amount: int, ) -> bool: """ Check whether a transaction is valid or not. @@ -375,7 +379,10 @@ def recover_public_keys_from_message( """ signature_b64 = base64.b64decode(signature) verifying_keys = VerifyingKey.from_public_key_recovery( - signature_b64, message, SECP256k1, hashfunc=hashlib.sha256, + signature_b64, + message, + SECP256k1, + hashfunc=hashlib.sha256, ) public_keys = [ verifying_key.to_string("compressed").hex() @@ -517,7 +524,9 @@ def sign_message( :return: signature of the message in string form """ signature_compact = self.entity.sign_deterministic( - message, hashfunc=hashlib.sha256, sigencode=sigencode_string_canonize, + message, + hashfunc=hashlib.sha256, + sigencode=sigencode_string_canonize, ) signature_base64_str = base64.b64encode(signature_compact).decode("utf-8") return signature_base64_str @@ -1280,7 +1289,9 @@ def _get_transaction( single = ModeInfo.Single(mode=SignMode.SIGN_MODE_DIRECT) mode_info = ModeInfo(single=single) signer_info = SignerInfo( - public_key=from_pub_key_packed, mode_info=mode_info, sequence=sequence, + public_key=from_pub_key_packed, + mode_info=mode_info, + sequence=sequence, ) signer_infos.append(signer_info) @@ -1291,7 +1302,8 @@ def _get_transaction( # Prepare auth info auth_info = AuthInfo( - signer_infos=signer_infos, fee=Fee(amount=tx_fee, gas_limit=gas), + signer_infos=signer_infos, + fee=Fee(amount=tx_fee, gas_limit=gas), ) # Prepare Tx body @@ -1430,7 +1442,10 @@ def update_with_gas_estimate(self, transaction: JSONLike) -> JSONLike: ) def contract_method_call( - self, contract_instance: Any, method_name: str, **method_args: Any, + self, + contract_instance: Any, + method_name: str, + **method_args: Any, ) -> Optional[JSONLike]: """Call a contract's method @@ -1607,7 +1622,10 @@ def _try_check_faucet_claim( if "txStatus" in data["claim"]: tx_digest = data["claim"]["txStatus"]["hash"] - return CosmosFaucetStatus(tx_digest=tx_digest, status=data["claim"]["status"],) + return CosmosFaucetStatus( + tx_digest=tx_digest, + status=data["claim"]["status"], + ) @classmethod def _faucet_request_uri(cls, url: Optional[str] = None) -> str: diff --git a/plugins/aea-ledger-fetchai/aea_ledger_fetchai/fetchai.py b/plugins/aea-ledger-fetchai/aea_ledger_fetchai/fetchai.py index c922f95974..cde7b425c7 100644 --- a/plugins/aea-ledger-fetchai/aea_ledger_fetchai/fetchai.py +++ b/plugins/aea-ledger-fetchai/aea_ledger_fetchai/fetchai.py @@ -69,7 +69,10 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) def contract_method_call( - self, contract_instance: Any, method_name: str, **method_args: Any, + self, + contract_instance: Any, + method_name: str, + **method_args: Any, ) -> Optional[JSONLike]: """Call a contract's method diff --git a/plugins/aea-ledger-fetchai/tests/test_fetchai.py b/plugins/aea-ledger-fetchai/tests/test_fetchai.py index aae400db23..209ec3ef1b 100644 --- a/plugins/aea-ledger-fetchai/tests/test_fetchai.py +++ b/plugins/aea-ledger-fetchai/tests/test_fetchai.py @@ -442,7 +442,10 @@ def test_get_storage_transaction_cosmwasm(): contract_interface = {"wasm_byte_code": "1234"} deployer_address = cc2.address deploy_transaction = cosmos_api.get_deploy_transaction( - contract_interface, deployer_address, account_number=1, sequence=0, + contract_interface, + deployer_address, + account_number=1, + sequence=0, ) assert type(deploy_transaction) == dict and len(deploy_transaction) == 2 @@ -780,7 +783,11 @@ def test_multiple_signatures_transaction(): coins = [Coin(denom="DENOM", amount="1234")] - msg_send = MsgSend(from_address=str("from"), to_address=str("to"), amount=coins,) + msg_send = MsgSend( + from_address=str("from"), + to_address=str("to"), + amount=coins, + ) send_msg_packed = ProtoAny() send_msg_packed.Pack(msg_send, type_url_prefix="/") @@ -810,7 +817,11 @@ def test_multiple_signatures_transaction_missing_pubkeys(): coins = [Coin(denom="DENOM", amount="1234")] - msg_send = MsgSend(from_address=str("from"), to_address=str("to"), amount=coins,) + msg_send = MsgSend( + from_address=str("from"), + to_address=str("to"), + amount=coins, + ) send_msg_packed = ProtoAny() send_msg_packed.Pack(msg_send, type_url_prefix="/") @@ -838,7 +849,11 @@ def test_multiple_signatures_transaction_wrong_number_of_params(): coins = [Coin(denom="DENOM", amount="1234")] - msg_send = MsgSend(from_address=str("from"), to_address=str("to"), amount=coins,) + msg_send = MsgSend( + from_address=str("from"), + to_address=str("to"), + amount=coins, + ) send_msg_packed = ProtoAny() send_msg_packed.Pack(msg_send, type_url_prefix="/") diff --git a/scripts/acn/run_acn_node_standalone.py b/scripts/acn/run_acn_node_standalone.py index 599ad36e9f..648db8cbde 100644 --- a/scripts/acn/run_acn_node_standalone.py +++ b/scripts/acn/run_acn_node_standalone.py @@ -234,7 +234,10 @@ def run(self): log_file.write(line) log_file.flush() else: - self._proc = subprocess.Popen(cmd, shell=False,) # nosec + self._proc = subprocess.Popen( # nosec + cmd, + shell=False, + ) try: self._proc.wait() diff --git a/scripts/bump_aea_version.py b/scripts/bump_aea_version.py index be58bd862d..7eb642ca27 100644 --- a/scripts/bump_aea_version.py +++ b/scripts/bump_aea_version.py @@ -364,7 +364,8 @@ def _replace_specifier_sets( old_specifier_set_regex = get_regex_from_specifier_set(old_specifier_set) for pattern_template in self.specifier_set_patterns: regex = pattern_template.format( - package_name=self.package_name, specifier_set=old_specifier_set_regex, + package_name=self.package_name, + specifier_set=old_specifier_set_regex, ) pattern = re.compile(regex) if pattern.search(content) is not None: @@ -540,7 +541,9 @@ def bump(arguments: argparse.Namespace) -> int: ) else: logging.info("Updating hashes and fingerprints.") - return_code = update_hashes(packages_dir=ROOT_DIR / "packages",) + return_code = update_hashes( + packages_dir=ROOT_DIR / "packages", + ) return return_code diff --git a/scripts/check_copyright_notice.py b/scripts/check_copyright_notice.py index 2388c937ca..1fc7b312a6 100755 --- a/scripts/check_copyright_notice.py +++ b/scripts/check_copyright_notice.py @@ -336,13 +336,15 @@ def fix_header(check_info: Dict) -> bool: copyright_string = "# Copyright {start_year} Valory AG".format( start_year=check_info["last_modification"].year, ) - copyright_string += "\n# Copyright {start_year}{end_year} Fetch.AI Limited".format( - start_year=check_info["start_year"], - end_year=( - "-" + str(check_info["end_year"]) - if check_info["end_year"] is not None - else "" - ), + copyright_string += ( + "\n# Copyright {start_year}{end_year} Fetch.AI Limited".format( + start_year=check_info["start_year"], + end_year=( + "-" + str(check_info["end_year"]) + if check_info["end_year"] is not None + else "" + ), + ) ) is_update_needed = True else: @@ -350,9 +352,11 @@ def fix_header(check_info: Dict) -> bool: # this probably will be used only once copyright_string = f"# Copyright {CURRENT_YEAR} Valory AG" - copyright_string += "\n# Copyright {start_year}-{end_year} Fetch.AI Limited".format( - start_year=check_info["start_year"], - end_year=check_info["last_modification"].year, + copyright_string += ( + "\n# Copyright {start_year}-{end_year} Fetch.AI Limited".format( + start_year=check_info["start_year"], + end_year=check_info["last_modification"].year, + ) ) is_update_needed = True @@ -365,13 +369,15 @@ def fix_header(check_info: Dict) -> bool: start_year=check_info["start_year"], end_year=check_info["last_modification"].year, ) - copyright_string += "\n# Copyright {start_year}{end_year} Fetch.AI Limited".format( - start_year=check_info["fetchai_year_data"][0], - end_year=( - "-" + str(check_info["fetchai_year_data"][1]) - if check_info["fetchai_year_data"][1] is not None - else "" - ), + copyright_string += ( + "\n# Copyright {start_year}{end_year} Fetch.AI Limited".format( + start_year=check_info["fetchai_year_data"][0], + end_year=( + "-" + str(check_info["fetchai_year_data"][1]) + if check_info["fetchai_year_data"][1] is not None + else "" + ), + ) ) is_update_needed = True diff --git a/scripts/deploy_to_registry.py b/scripts/deploy_to_registry.py index 2d20da97b5..154e85d8de 100644 --- a/scripts/deploy_to_registry.py +++ b/scripts/deploy_to_registry.py @@ -123,7 +123,11 @@ def check_correct_author(runner: CliRunner) -> None: :param runner: the cli runner """ - result = runner.invoke(cli, [*CLI_LOG_OPTION, "init"], standalone_mode=False,) + result = runner.invoke( + cli, + [*CLI_LOG_OPTION, "init"], + standalone_mode=False, + ) if "{'author': 'fetchai'}" not in result.output: print("Log in with fetchai credentials. Stopping...") sys.exit(0) @@ -201,7 +205,9 @@ def push_package(package_id: PackageId, runner: CliRunner) -> None: finally: os.chdir(cwd) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "delete", agent_name], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "delete", agent_name], + standalone_mode=False, ) assert result.exit_code == 0 print( @@ -243,7 +249,9 @@ def publish_agent(package_id: PackageId, runner: CliRunner) -> None: assert result.exit_code == 0, "Local fetch failed." os.chdir(str(package_id.public_id.name)) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "publish", "--remote"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "publish", "--remote"], + standalone_mode=False, ) assert ( result.exit_code == 0 diff --git a/scripts/update_package_versions.py b/scripts/update_package_versions.py index 8ea3275ef9..67109290bf 100644 --- a/scripts/update_package_versions.py +++ b/scripts/update_package_versions.py @@ -254,10 +254,15 @@ def public_id_in_registry(type_: str, name: str) -> PublicId: """ runner = CliRunner() result = runner.invoke( - cli, [*CLI_LOG_OPTION, "search", type_, "--query", name], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "search", type_, "--query", name], + standalone_mode=False, ) reg = r"({}/{}:{})".format("fetchai", name, PublicId.VERSION_REGEX) - ids = re.findall(reg, result.output,) + ids = re.findall( + reg, + result.output, + ) p_ids = [] highest = PublicId.from_str("fetchai/{}:0.1.0".format(name)) for id_ in ids: @@ -427,11 +432,11 @@ def _can_disambiguate_from_context( :return: if True/False, the old string can/cannot be replaced. If None, we don't know. """ match = re.search( - fr"aea +add +(skill|protocol|connection|contract) +{old_string}", line + rf"aea +add +(skill|protocol|connection|contract) +{old_string}", line ) if match is not None: return match.group(1) == type_[:-1] - if re.search(fr"aea +fetch +{old_string}", line) is not None: + if re.search(rf"aea +fetch +{old_string}", line) is not None: return type_ == "agents" match = re.search( "(skill|SKILL|" @@ -466,7 +471,9 @@ def _ask_to_user( print("".join(above_rows)) print(line.rstrip().replace(old_string, "\033[91m" + old_string + "\033[0m")) print("".join(below_rows)) - answer = input(f"Replace for component ({type_}, {old_string})? [y/N]: ",) # nosec + answer = input( + f"Replace for component ({type_}, {old_string})? [y/N]: ", + ) # nosec return answer @@ -476,7 +483,7 @@ def replace_aea_fetch_statements( """Replace statements of the type: 'aea fetch '.""" if type_ == "agents": content = re.sub( - fr"aea +fetch +{old_string}", f"aea fetch {new_string}", content + rf"aea +fetch +{old_string}", f"aea fetch {new_string}", content ) return content @@ -487,7 +494,7 @@ def replace_aea_add_statements( """Replace statements of the type: 'aea add '.""" if type_ != "agents": content = re.sub( - fr"aea +add +{type_} +{old_string}", + rf"aea +add +{type_} +{old_string}", f"aea add {type_} {new_string}", content, ) @@ -660,7 +667,9 @@ def process_packages( ambiguous_public_ids ) print(f"Ambiguous public ids: {ambiguous_public_ids}") - print(f"Conflicts with public ids to update: {conflicts}",) + print( + f"Conflicts with public ids to update: {conflicts}", + ) print("*" * 100) print("Start processing.") @@ -751,7 +760,11 @@ def bump_package_version( (".py", ".yaml", ".md", ".sh") ): self.inplace_change( - path, current_public_id, new_public_id, type_, is_ambiguous, + path, + current_public_id, + new_public_id, + type_, + is_ambiguous, ) bump_version_in_yaml(configuration_file_path, type_, new_public_id.version) diff --git a/scripts/update_plugin_versions.py b/scripts/update_plugin_versions.py index 7161ed72b9..a421133e33 100644 --- a/scripts/update_plugin_versions.py +++ b/scripts/update_plugin_versions.py @@ -279,7 +279,9 @@ def main() -> None: print("Not updating fingerprints, since no specifier set has been updated.") else: print("Updating hashes and fingerprints.") - return_code = update_hashes(packages_dir=ROOT_DIR / "packages",) + return_code = update_hashes( + packages_dir=ROOT_DIR / "packages", + ) exit_with_message("Done!", exit_code=return_code) diff --git a/setup.py b/setup.py index 35330ccdc6..c2b109c56d 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def get_all_extras() -> Dict: cli_deps = [ - "click>=7.0.0,<8.0.0", + "click==8.0.2", "pyyaml>=4.2b1,<6.0", "jsonschema>=3.0.0,<4.0.0", "packaging>=20.3,<21.0", diff --git a/tests/conftest.py b/tests/conftest.py index 2b20e8338a..a842db33ab 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -385,9 +385,18 @@ ] protocol_specification_files = [ - os.path.join(PROTOCOL_SPECS_PREF_1, "sample.yaml",), - os.path.join(PROTOCOL_SPECS_PREF_2, "sample_specification.yaml",), - os.path.join(PROTOCOL_SPECS_PREF_2, "sample_specification_no_custom_types.yaml",), + os.path.join( + PROTOCOL_SPECS_PREF_1, + "sample.yaml", + ), + os.path.join( + PROTOCOL_SPECS_PREF_2, + "sample_specification.yaml", + ), + os.path.join( + PROTOCOL_SPECS_PREF_2, + "sample_specification_no_custom_types.yaml", + ), ] # ports for testing, call next() on to avoid assignment overlap @@ -730,7 +739,9 @@ def _ganache_context( @pytest.fixture(scope="class") @action_for_platform("Linux", skip=False) def fetchd( - fetchd_configuration, timeout: float = 2.0, max_attempts: int = 20, + fetchd_configuration, + timeout: float = 2.0, + max_attempts: int = 20, ): """Launch the Fetch ledger image.""" with _fetchd_context(fetchd_configuration, timeout, max_attempts) as fetchd: @@ -814,7 +825,9 @@ def double_escape_windows_path_separator(path): def _make_dummy_connection() -> Connection: - configuration = ConnectionConfig(connection_id=DummyConnection.connection_id,) + configuration = ConnectionConfig( + connection_id=DummyConnection.connection_id, + ) dummy_connection = DummyConnection( configuration=configuration, data_dir=MagicMock(), diff --git a/tests/data/packages/fetchai/protocols/t_protocol/protocol.yaml b/tests/data/packages/fetchai/protocols/t_protocol/protocol.yaml index 98f2f12045..58ed805406 100644 --- a/tests/data/packages/fetchai/protocols/t_protocol/protocol.yaml +++ b/tests/data/packages/fetchai/protocols/t_protocol/protocol.yaml @@ -14,7 +14,7 @@ fingerprint: message.py: QmeyVWQLk8e4k4PoJim7KLZN5W3Grbb83RtkMPyEWj7gvS serialization.py: QmUQbHJ5zeANS5ZVopjExphghLU9mdWqmUL8XwofWKJ9QN t_protocol.proto: QmedX13Z6cNgbTJ8L9LyYG3HtSKhkY8ntq6uVdtepmt2cg - t_protocol_pb2.py: QmU7uEunhccVLgth5rT4C7WWimbnRmpdrtoCmJyNZuTJR4 + t_protocol_pb2.py: QmdNqU6rGihaNUTcPeWX8nPrahcKNKJ2BBqEWqAd2yW1TQ fingerprint_ignore_patterns: [] dependencies: protobuf: {} diff --git a/tests/data/packages/fetchai/protocols/t_protocol/t_protocol_pb2.py b/tests/data/packages/fetchai/protocols/t_protocol/t_protocol_pb2.py index c5508c60b5..99f63fc980 100644 --- a/tests/data/packages/fetchai/protocols/t_protocol/t_protocol_pb2.py +++ b/tests/data/packages/fetchai/protocols/t_protocol/t_protocol_pb2.py @@ -20,90 +20,130 @@ _TPROTOCOLMESSAGE = DESCRIPTOR.message_types_by_name["TProtocolMessage"] _TPROTOCOLMESSAGE_DATAMODEL = _TPROTOCOLMESSAGE.nested_types_by_name["DataModel"] -_TPROTOCOLMESSAGE_DATAMODEL_DICTFIELDENTRY = _TPROTOCOLMESSAGE_DATAMODEL.nested_types_by_name[ - "DictFieldEntry" -] +_TPROTOCOLMESSAGE_DATAMODEL_DICTFIELDENTRY = ( + _TPROTOCOLMESSAGE_DATAMODEL.nested_types_by_name["DictFieldEntry"] +) _TPROTOCOLMESSAGE_PERFORMATIVE_CT_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ "Performative_Ct_Performative" ] _TPROTOCOLMESSAGE_PERFORMATIVE_PT_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ "Performative_Pt_Performative" ] -_TPROTOCOLMESSAGE_PERFORMATIVE_PCT_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ - "Performative_Pct_Performative" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ - "Performative_Pmt_Performative" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBYTESENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntBytesEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTINTENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntIntEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTFLOATENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntFloatEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBOOLENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntBoolEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTSTRENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntStrEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBYTESENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolBytesEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLINTENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolIntEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLFLOATENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolFloatEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBOOLENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolBoolEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLSTRENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolStrEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBYTESENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrBytesEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRINTENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrIntEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRFLOATENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrFloatEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBOOLENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrBoolEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRSTRENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrStrEntry" -] +_TPROTOCOLMESSAGE_PERFORMATIVE_PCT_PERFORMATIVE = ( + _TPROTOCOLMESSAGE.nested_types_by_name["Performative_Pct_Performative"] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE = ( + _TPROTOCOLMESSAGE.nested_types_by_name["Performative_Pmt_Performative"] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBYTESENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntBytesEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTINTENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntIntEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTFLOATENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntFloatEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBOOLENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntBoolEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTSTRENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntStrEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBYTESENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolBytesEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLINTENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolIntEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLFLOATENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolFloatEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBOOLENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolBoolEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLSTRENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolStrEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBYTESENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrBytesEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRINTENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrIntEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRFLOATENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrFloatEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBOOLENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrBoolEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRSTRENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrStrEntry" + ] +) _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ "Performative_Mt_Performative" ] -_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION1TYPEDICTOFSTRINTENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ - "ContentUnion1TypeDictOfStrIntEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFSTRINTENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ - "ContentUnion2TypeDictOfStrIntEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFINTFLOATENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ - "ContentUnion2TypeDictOfIntFloatEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFBOOLBYTESENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ - "ContentUnion2TypeDictOfBoolBytesEntry" -] +_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION1TYPEDICTOFSTRINTENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ + "ContentUnion1TypeDictOfStrIntEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFSTRINTENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ + "ContentUnion2TypeDictOfStrIntEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFINTFLOATENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ + "ContentUnion2TypeDictOfIntFloatEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFBOOLBYTESENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ + "ContentUnion2TypeDictOfBoolBytesEntry" + ] +) _TPROTOCOLMESSAGE_PERFORMATIVE_O_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ "Performative_O_Performative" ] -_TPROTOCOLMESSAGE_PERFORMATIVE_O_PERFORMATIVE_CONTENTODICTSTRINTENTRY = _TPROTOCOLMESSAGE_PERFORMATIVE_O_PERFORMATIVE.nested_types_by_name[ - "ContentODictStrIntEntry" -] -_TPROTOCOLMESSAGE_PERFORMATIVE_EMPTY_CONTENTS_PERFORMATIVE = _TPROTOCOLMESSAGE.nested_types_by_name[ - "Performative_Empty_Contents_Performative" -] +_TPROTOCOLMESSAGE_PERFORMATIVE_O_PERFORMATIVE_CONTENTODICTSTRINTENTRY = ( + _TPROTOCOLMESSAGE_PERFORMATIVE_O_PERFORMATIVE.nested_types_by_name[ + "ContentODictStrIntEntry" + ] +) +_TPROTOCOLMESSAGE_PERFORMATIVE_EMPTY_CONTENTS_PERFORMATIVE = ( + _TPROTOCOLMESSAGE.nested_types_by_name["Performative_Empty_Contents_Performative"] +) TProtocolMessage = _reflection.GeneratedProtocolMessageType( "TProtocolMessage", (_message.Message,), diff --git a/tests/data/packages/fetchai/protocols/t_protocol_no_ct/protocol.yaml b/tests/data/packages/fetchai/protocols/t_protocol_no_ct/protocol.yaml index af77c028c5..208bfda2a2 100644 --- a/tests/data/packages/fetchai/protocols/t_protocol_no_ct/protocol.yaml +++ b/tests/data/packages/fetchai/protocols/t_protocol_no_ct/protocol.yaml @@ -13,7 +13,7 @@ fingerprint: message.py: Qmf3x9wexDzCdqnNBYW4yQybQkT4FaeDM796cvQDAhiYq6 serialization.py: QmXghEnYgT3VrHvNKAe31ifJxNZ22DSQvRSBEb9Lbc5eiX t_protocol_no_ct.proto: QmSLBP518C7MttUGn1DsAmHq5FHJyY6yHprNPNkCbKqFLx - t_protocol_no_ct_pb2.py: QmfZXS3njnnQTAnGMuEvqMzaBN8QUuyfxYZJRXFf5BPnVh + t_protocol_no_ct_pb2.py: QmZq54awx2jF8QfbwTQKRPh75G11UmCP4XBd8P2u2TTHxj fingerprint_ignore_patterns: [] dependencies: protobuf: {} diff --git a/tests/data/packages/fetchai/protocols/t_protocol_no_ct/t_protocol_no_ct_pb2.py b/tests/data/packages/fetchai/protocols/t_protocol_no_ct/t_protocol_no_ct_pb2.py index 6af13bb420..c9449f8f2c 100644 --- a/tests/data/packages/fetchai/protocols/t_protocol_no_ct/t_protocol_no_ct_pb2.py +++ b/tests/data/packages/fetchai/protocols/t_protocol_no_ct/t_protocol_no_ct_pb2.py @@ -19,63 +19,93 @@ _TPROTOCOLNOCTMESSAGE = DESCRIPTOR.message_types_by_name["TProtocolNoCtMessage"] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PT_PERFORMATIVE = _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ - "Performative_Pt_Performative" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PCT_PERFORMATIVE = _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ - "Performative_Pct_Performative" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE = _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ - "Performative_Pmt_Performative" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBYTESENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntBytesEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTINTENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntIntEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTFLOATENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntFloatEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBOOLENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntBoolEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTSTRENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictIntStrEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBYTESENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolBytesEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLINTENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolIntEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLFLOATENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolFloatEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBOOLENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolBoolEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLSTRENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictBoolStrEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBYTESENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrBytesEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRINTENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrIntEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRFLOATENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrFloatEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBOOLENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrBoolEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRSTRENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ - "ContentDictStrStrEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_MT_PERFORMATIVE = _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ - "Performative_Mt_Performative" -] +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PT_PERFORMATIVE = ( + _TPROTOCOLNOCTMESSAGE.nested_types_by_name["Performative_Pt_Performative"] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PCT_PERFORMATIVE = ( + _TPROTOCOLNOCTMESSAGE.nested_types_by_name["Performative_Pct_Performative"] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE = ( + _TPROTOCOLNOCTMESSAGE.nested_types_by_name["Performative_Pmt_Performative"] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBYTESENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntBytesEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTINTENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntIntEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTFLOATENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntFloatEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTBOOLENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntBoolEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTINTSTRENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictIntStrEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBYTESENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolBytesEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLINTENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolIntEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLFLOATENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolFloatEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLBOOLENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolBoolEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTBOOLSTRENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictBoolStrEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBYTESENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrBytesEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRINTENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrIntEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRFLOATENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrFloatEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRBOOLENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrBoolEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE_CONTENTDICTSTRSTRENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_PMT_PERFORMATIVE.nested_types_by_name[ + "ContentDictStrStrEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_MT_PERFORMATIVE = ( + _TPROTOCOLNOCTMESSAGE.nested_types_by_name["Performative_Mt_Performative"] +) _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION1TYPEDICTOFSTRINTENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ "ContentUnion1TypeDictOfStrIntEntry" ] @@ -88,15 +118,19 @@ _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_MT_PERFORMATIVE_CONTENTUNION2TYPEDICTOFBOOLBYTESENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_MT_PERFORMATIVE.nested_types_by_name[ "ContentUnion2TypeDictOfBoolBytesEntry" ] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_O_PERFORMATIVE = _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ - "Performative_O_Performative" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_O_PERFORMATIVE_CONTENTODICTSTRINTENTRY = _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_O_PERFORMATIVE.nested_types_by_name[ - "ContentODictStrIntEntry" -] -_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_EMPTY_CONTENTS_PERFORMATIVE = _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ - "Performative_Empty_Contents_Performative" -] +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_O_PERFORMATIVE = ( + _TPROTOCOLNOCTMESSAGE.nested_types_by_name["Performative_O_Performative"] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_O_PERFORMATIVE_CONTENTODICTSTRINTENTRY = ( + _TPROTOCOLNOCTMESSAGE_PERFORMATIVE_O_PERFORMATIVE.nested_types_by_name[ + "ContentODictStrIntEntry" + ] +) +_TPROTOCOLNOCTMESSAGE_PERFORMATIVE_EMPTY_CONTENTS_PERFORMATIVE = ( + _TPROTOCOLNOCTMESSAGE.nested_types_by_name[ + "Performative_Empty_Contents_Performative" + ] +) TProtocolNoCtMessage = _reflection.GeneratedProtocolMessageType( "TProtocolNoCtMessage", (_message.Message,), diff --git a/tests/data/packages/hashes.csv b/tests/data/packages/hashes.csv index 4e664242bb..ace492df03 100644 --- a/tests/data/packages/hashes.csv +++ b/tests/data/packages/hashes.csv @@ -1,7 +1,7 @@ default_author/contracts/stub_0,QmeLYjfy6VxvkErTxTc5Gm1MRHH4rkP1E715aQ693PnS6y default_author/contracts/stub_1,QmbuHE98fCCPLkc2n1oaGA1yuX5QyoXfpGj145qWPbk5o3 -fetchai/protocols/t_protocol,QmNuXPYASm8LxzFYCUJejx94a4L8PjhSQCd8fXtVEcXQxU -fetchai/protocols/t_protocol_no_ct,QmULs95VgLNFgDj6DFKeP6XWhsGkMncCB6cwqAcnxjoqrB +fetchai/protocols/t_protocol,QmWYrwwCgC9iePCcaYgmJFb3d5UqDSoKfW9dLuqfibt4oB +fetchai/protocols/t_protocol_no_ct,QmPbS4U8iP7akxM6jetbZMX9QZSwanWHJ7nDQRBCRkR9RF open_aea/connections/scaffold,QmZ42VNQKHxG1pWad4GCtD4Z8pwS258xd45KbM8pTgmyFk open_aea/contracts/scaffold,QmWk6GLpbV3ZSZuhpTqejGdPd6c5iJQCGjo7g4ktW2BdMu open_aea/protocols/scaffold,QmSV8Xe9eDWvtSxRKZQquMy5d2kcR7FprJtStUD7wb5b3B diff --git a/tests/test_act_storage.py b/tests/test_act_storage.py index 5037423c6a..aad18f534a 100644 --- a/tests/test_act_storage.py +++ b/tests/test_act_storage.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -164,7 +164,11 @@ def test_storage_access_from_handler(): ) msg.to = aea.identity.address msg.sender = aea.identity.address - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) try: wait_for_condition(lambda: aea.is_running, timeout=10) @@ -245,12 +249,19 @@ def test_dialogues_dumped_and_restored_properly(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) aea.runtime.multiplexer.in_queue.put(envelope) - dialogue_storage: PersistDialoguesStorage = echo_skill.skill_context.default_dialogues._dialogues_storage + dialogue_storage: PersistDialoguesStorage = ( + echo_skill.skill_context.default_dialogues._dialogues_storage + ) wait_for_condition( - lambda: _storage_all_dialogues_labels(dialogue_storage), timeout=3, + lambda: _storage_all_dialogues_labels(dialogue_storage), + timeout=3, ) dialogues_for_check = _storage_all_dialogues_labels(dialogue_storage) finally: @@ -263,9 +274,12 @@ def test_dialogues_dumped_and_restored_properly(self): wait_for_condition(lambda: aea.is_running, timeout=10) echo_skill = aea.resources.get_skill(PUBLIC_ID) - dialogue_storage: PersistDialoguesStorage = echo_skill.skill_context.default_dialogues._dialogues_storage + dialogue_storage: PersistDialoguesStorage = ( + echo_skill.skill_context.default_dialogues._dialogues_storage + ) wait_for_condition( - lambda: _storage_all_dialogues_labels(dialogue_storage), timeout=3, + lambda: _storage_all_dialogues_labels(dialogue_storage), + timeout=3, ) assert ( _storage_all_dialogues_labels(dialogue_storage) == dialogues_for_check diff --git a/tests/test_aea.py b/tests/test_aea.py index b99442d95b..04266e2972 100644 --- a/tests/test_aea.py +++ b/tests/test_aea.py @@ -205,7 +205,11 @@ def test_react(): ) msg.to = agent.identity.address msg.sender = agent.identity.address - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) with run_in_thread(agent.start, timeout=20, on_exit=agent.stop): wait_for_condition(lambda: agent.is_running, timeout=20) @@ -274,13 +278,18 @@ def test_handle(): dummy_skill = an_aea.resources.get_skill(DUMMY_SKILL_PUBLIC_ID) dummy_handler = dummy_skill.skill_context.handlers.dummy # UNSUPPORTED PROTOCOL - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) envelope._protocol_specification_id = UNKNOWN_PROTOCOL_PUBLIC_ID # send envelope via localnode back to agent/bypass `outbox` put consistency checks assert error_handler.unsupported_protocol_count == 0 an_aea.outbox.put(envelope) wait_for_condition( - lambda: error_handler.unsupported_protocol_count == 1, timeout=2, + lambda: error_handler.unsupported_protocol_count == 1, + timeout=2, ) # DECODING ERROR @@ -293,7 +302,8 @@ def test_handle(): assert error_handler.decoding_error_count == 0 an_aea.runtime.multiplexer.put(envelope) wait_for_condition( - lambda: error_handler.decoding_error_count == 1, timeout=5, + lambda: error_handler.decoding_error_count == 1, + timeout=5, ) # UNSUPPORTED SKILL @@ -305,12 +315,17 @@ def test_handle(): ) msg.to = an_aea.identity.address msg.sender = an_aea.identity.address - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) # send envelope via localnode back to agent/bypass `outbox` put consistency checks assert error_handler.no_active_handler_count == 0 an_aea.outbox.put(envelope) wait_for_condition( - lambda: error_handler.no_active_handler_count == 1, timeout=5, + lambda: error_handler.no_active_handler_count == 1, + timeout=5, ) # DECODING OK @@ -324,7 +339,8 @@ def test_handle(): assert len(dummy_handler.handled_messages) == 0 an_aea.runtime.multiplexer.put(envelope) wait_for_condition( - lambda: len(dummy_handler.handled_messages) == 1, timeout=5, + lambda: len(dummy_handler.handled_messages) == 1, + timeout=5, ) an_aea.stop() @@ -463,7 +479,9 @@ def test_initialize_aea_programmatically_build_resources(): wait_for_condition(lambda: an_aea.is_running, timeout=10) an_aea.outbox.put( Envelope( - to=agent_name, sender=agent_name, message=expected_message, + to=agent_name, + sender=agent_name, + message=expected_message, ) ) @@ -581,14 +599,17 @@ def test_no_handlers_registered(): ) msg.to = an_aea.identity.address envelope = Envelope( - to=an_aea.identity.address, sender=an_aea.identity.address, message=msg, + to=an_aea.identity.address, + sender=an_aea.identity.address, + message=msg, ) with patch( "aea.registries.filter.Filter.get_active_handlers", new_callable=PropertyMock, ): with patch.object( - an_aea.runtime.multiplexer, "put", + an_aea.runtime.multiplexer, + "put", ): an_aea.handle_envelope(envelope) mock_logger.assert_any_call( @@ -1008,7 +1029,11 @@ def test_skill2skill_message(): ) msg.to = str(DUMMY_SKILL_PUBLIC_ID) msg.sender = "some_author/some_skill:0.1.0" - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) with run_in_thread(agent.start, timeout=20, on_exit=agent.stop): wait_for_condition(lambda: agent.is_running, timeout=20) diff --git a/tests/test_agent.py b/tests/test_agent.py index ce4133f4c2..e220afe0e7 100644 --- a/tests/test_agent.py +++ b/tests/test_agent.py @@ -104,7 +104,10 @@ def test_runtime_modes(): agent_address = "some_address" agent_public_key = "some_public_key" identity = Identity(agent_name, address=agent_address, public_key=agent_public_key) - agent = DummyAgent(identity, [],) + agent = DummyAgent( + identity, + [], + ) assert not agent.is_running assert agent.is_stopped diff --git a/tests/test_agent_loop.py b/tests/test_agent_loop.py index 61452965ce..936cc44a89 100644 --- a/tests/test_agent_loop.py +++ b/tests/test_agent_loop.py @@ -272,7 +272,8 @@ async def test_internal_messages(self): ) agent.put_internal_message("msg") await wait_for_condition_async( - lambda: agent.filter.handle_internal_message.called is True, timeout=5, + lambda: agent.filter.handle_internal_message.called is True, + timeout=5, ) agent_loop.stop() await agent_loop.wait_completed() diff --git a/tests/test_cli/test_add/test_connection.py b/tests/test_cli/test_add/test_connection.py index eb2544c4b2..8cbdf68398 100644 --- a/tests/test_cli/test_add/test_connection.py +++ b/tests/test_cli/test_add/test_connection.py @@ -539,7 +539,9 @@ def setup_class(cls): ) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "create", cls.agent_name], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "create", cls.agent_name], + standalone_mode=False, ) assert result.exit_code == 0 @@ -600,7 +602,9 @@ def setup_class(cls): assert result.exit_code == 0, result.stdout result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "create", cls.agent_name], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "create", cls.agent_name], + standalone_mode=False, ) assert result.exit_code == 0, result.stdout diff --git a/tests/test_cli/test_add/test_contract_dependency.py b/tests/test_cli/test_add/test_contract_dependency.py index c77438ce35..cf7aae9d9b 100644 --- a/tests/test_cli/test_add/test_contract_dependency.py +++ b/tests/test_cli/test_add/test_contract_dependency.py @@ -54,7 +54,8 @@ def _load_agent_config(self) -> AgentConfig: def _run_command(self, options: List, assert_exit_code: bool = True) -> Result: """Run command with default options.""" result = self.runner.invoke( - cli, ["-v", "INFO", f"--registry-path={str(REGISTRY_PATH)}", *options], + cli, + ["-v", "INFO", f"--registry-path={str(REGISTRY_PATH)}", *options], ) if assert_exit_code: assert result.exit_code == 0, result.stdout @@ -70,7 +71,8 @@ def test_run(self): self.agent_dir = temp_dir / self.agent_name self.runner = CliRunner() result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0, result.stdout result = self._run_command(["create", "--empty", "--local", self.agent_name]) @@ -116,6 +118,8 @@ def _print_patch(line: str, *args, **kwargs) -> None: assert "Contract stub_0 initialized." in outputs assert "Contract stub_1 initialized." in outputs - def teardown(self,): + def teardown( + self, + ): """Test teardown.""" os.chdir(str(ROOT_DIR)) diff --git a/tests/test_cli/test_add/test_protocol.py b/tests/test_cli/test_add/test_protocol.py index 39e5122191..626e9dfb9b 100644 --- a/tests/test_cli/test_add/test_protocol.py +++ b/tests/test_cli/test_add/test_protocol.py @@ -69,7 +69,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -134,7 +135,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -235,7 +237,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -291,7 +294,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -344,7 +348,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -413,7 +418,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_add/test_skill.py b/tests/test_cli/test_add/test_skill.py index fdee3f6957..d65b5d23d3 100644 --- a/tests/test_cli/test_add/test_skill.py +++ b/tests/test_cli/test_add/test_skill.py @@ -78,7 +78,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -165,7 +166,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -245,7 +247,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -302,7 +305,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -356,7 +360,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -428,7 +433,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_add_key.py b/tests/test_cli/test_add_key.py index fedd8916b4..058bfbfa62 100644 --- a/tests/test_cli/test_add_key.py +++ b/tests/test_cli/test_add_key.py @@ -66,7 +66,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) result = cls.runner.invoke( @@ -128,7 +129,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) result = cls.runner.invoke( @@ -190,7 +192,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) result = cls.runner.invoke( @@ -212,7 +215,8 @@ def test_add_many_keys(self, pytestconfig): """Test that the keys are added correctly.""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "add-key", FetchAICrypto.identifier], + cli, + [*CLI_LOG_OPTION, "add-key", FetchAICrypto.identifier], ) assert result.exit_code == 0 result = self.runner.invoke( @@ -266,7 +270,8 @@ def test_add_key_fails_bad_key(): ) as mock_logger_error: result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) result = runner.invoke( @@ -312,7 +317,8 @@ def test_add_key_fails_bad_ledger_id(): os.chdir(tmpdir) try: result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) result = runner.invoke(cli, [*CLI_LOG_OPTION, "create", "--local", agent_name]) diff --git a/tests/test_cli/test_create.py b/tests/test_cli/test_create.py index c33652dee6..e2386e5b0a 100644 --- a/tests/test_cli/test_create.py +++ b/tests/test_cli/test_create.py @@ -81,7 +81,8 @@ def setup_class(cls): ) cls.cli_config_patch.start() result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0, result.stdout @@ -253,7 +254,8 @@ def setup_class(cls): # create a directory with the agent name -> make 'aea create fail. os.mkdir(cls.agent_name) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -309,7 +311,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -359,7 +362,8 @@ def setup_class(cls): shutil.copytree(str(src_dir), str(tmp_dir)) os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -405,7 +409,8 @@ def setup_class(cls): cls.runner = CliRunner() cls.agent_name = "myagent" result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_delete.py b/tests/test_cli/test_delete.py index 6b517fb4a3..f29ef2ea57 100644 --- a/tests/test_cli/test_delete.py +++ b/tests/test_cli/test_delete.py @@ -47,7 +47,8 @@ def setup_class(cls): shutil.copytree(str(src_dir), str(tmp_dir)) os.chdir(cls.t) cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) cls.runner.invoke( @@ -122,7 +123,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_eject.py b/tests/test_cli/test_eject.py index cd73604dff..2b3e29fcf2 100644 --- a/tests/test_cli/test_eject.py +++ b/tests/test_cli/test_eject.py @@ -175,7 +175,10 @@ def test_error(self, *_mocks): match="The AEA configurations are not initialized. Use `aea init` before continuing.", ): self.invoke( - "eject", "--quiet", "protocol", str(DefaultMessage.protocol_id), + "eject", + "--quiet", + "protocol", + str(DefaultMessage.protocol_id), ) diff --git a/tests/test_cli/test_fetch.py b/tests/test_cli/test_fetch.py index 223dab1e22..dd717f0109 100644 --- a/tests/test_cli/test_fetch.py +++ b/tests/test_cli/test_fetch.py @@ -138,7 +138,9 @@ def setUp(self): def test_fetch_positive_mixed(self, *mocks): """Test for CLI push connection positive result.""" self.runner.invoke( - cli, [*CLI_LOG_OPTION, "fetch", "author/name:0.1.0"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "fetch", "author/name:0.1.0"], + standalone_mode=False, ) def test_fetch_positive_local(self, *mocks): @@ -233,7 +235,8 @@ class TestFetchAgentMixed(BaseAEATestCase): side_effect=click.ClickException(""), ) @mock.patch( - "aea.cli.fetch.fetch_agent_locally", side_effect=click.ClickException(""), + "aea.cli.fetch.fetch_agent_locally", + side_effect=click.ClickException(""), ) def test_fetch_mixed( self, mock_fetch_package, _mock_fetch_locally, _mock_fetch_agent_locally @@ -269,7 +272,8 @@ def test_fetch_negative(self, *_mocks) -> None: if type(self) == BaseTestFetchAgentError: pytest.skip("Base test class.") with pytest.raises( - Exception, match=self.EXPECTED_ERROR_MESSAGE, + Exception, + match=self.EXPECTED_ERROR_MESSAGE, ): self.run_cli_command( *( @@ -308,7 +312,9 @@ def test_fetch_mixed_no_local_registry(): name = "my_first_aea" runner = CliRunner() result = runner.invoke( - cli, ["fetch", "fetchai/my_first_aea"], catch_exceptions=False, + cli, + ["fetch", "fetchai/my_first_aea"], + catch_exceptions=False, ) assert result.exit_code == 0, result.stdout assert os.path.exists(name) diff --git a/tests/test_cli/test_generate/test_protocols.py b/tests/test_cli/test_generate/test_protocols.py index 2177736e5a..ce2743b255 100644 --- a/tests/test_cli/test_generate/test_protocols.py +++ b/tests/test_cli/test_generate/test_protocols.py @@ -76,7 +76,8 @@ def setup_class(cls): # create an agent os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -156,7 +157,8 @@ def setup_class(cls): # create an agent os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -195,13 +197,25 @@ def test_exit_code_equal_to_0(self): def test_resource_folder_contains_protobuf_schema_file(self): """Test that the protocol folder contains a structurally valid configuration file.""" protobuf_schema_file = Path( - self.t, self.agent_name, "protocols", "t_protocol", "t_protocol.proto", + self.t, + self.agent_name, + "protocols", + "t_protocol", + "t_protocol.proto", ) cpp_header_file = Path( - self.t, self.agent_name, "protocols", "t_protocol", "t_protocol.pb.h", + self.t, + self.agent_name, + "protocols", + "t_protocol", + "t_protocol.pb.h", ) cpp_implementation_file = Path( - self.t, self.agent_name, "protocols", "t_protocol", "t_protocol.pb.cc", + self.t, + self.agent_name, + "protocols", + "t_protocol", + "t_protocol.pb.cc", ) assert protobuf_schema_file.exists() @@ -241,7 +255,8 @@ def setup_class(cls): # create an agent os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -325,7 +340,8 @@ def setup_class(cls): # create an agent os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -419,7 +435,8 @@ def setup_class(cls): # create an agent os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -496,7 +513,8 @@ def setup_class(cls): # create an agent os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_get_wealth.py b/tests/test_cli/test_get_wealth.py index fc195f8556..1a192671d6 100644 --- a/tests/test_cli/test_get_wealth.py +++ b/tests/test_cli/test_get_wealth.py @@ -77,7 +77,8 @@ class TestGetWealth(AEATestCaseEmpty): def test_get_wealth(self, _echo_mock, password_or_none): """Run the main test.""" self.generate_private_key( - ledger_api_id=FetchAICrypto.identifier, password=password_or_none, + ledger_api_id=FetchAICrypto.identifier, + password=password_or_none, ) self.add_private_key( ledger_api_id=FetchAICrypto.identifier, diff --git a/tests/test_cli/test_init.py b/tests/test_cli/test_init.py index 73b34af60b..34d79151c2 100644 --- a/tests/test_cli/test_init.py +++ b/tests/test_cli/test_init.py @@ -55,7 +55,8 @@ def test_author_local(self): assert not os.path.exists(self.cli_config_file) result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", author], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", author], ) assert result.exit_code == 0 @@ -74,7 +75,8 @@ def _read_config(self) -> dict: def test_already_registered(self): """Test author already registered.""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", "author"], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", "author"], ) assert result.exit_code == 0 result = self.runner.invoke(cli, [*CLI_LOG_OPTION, "init", "--local"]) @@ -115,7 +117,8 @@ def test_registered(self, *mocks): def test_already_logged_in(self, *mocks): """Registered and logged in (has token).""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--author", "test_author"], + cli, + [*CLI_LOG_OPTION, "init", "--author", "test_author"], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_issue_certificates.py b/tests/test_cli/test_issue_certificates.py index d325d90878..47ccd37409 100644 --- a/tests/test_cli/test_issue_certificates.py +++ b/tests/test_cli/test_issue_certificates.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -288,6 +288,7 @@ def setup_class(cls): def test_run(self): """Run the test.""" with pytest.raises( - Exception, match="Cannot find private key with id 'bad_ledger_id'", + Exception, + match="Cannot find private key with id 'bad_ledger_id'", ): self.run_cli_command("issue-certificates", cwd=self._get_cwd()) diff --git a/tests/test_cli/test_launch.py b/tests/test_cli/test_launch.py index 0d25c38fc4..e07e1dcc07 100644 --- a/tests/test_cli/test_launch.py +++ b/tests/test_cli/test_launch.py @@ -122,7 +122,8 @@ def setup_class(cls): os.chdir(cls.t) password_option = cls.get_password_args(cls.PASSWORD) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -202,7 +203,8 @@ def test_exit_code_equal_to_zero(self): ) process_launch.control_c() process_launch.expect_all( - ["Exit cli. code: 0"], timeout=DEFAULT_EXPECT_TIMEOUT, + ["Exit cli. code: 0"], + timeout=DEFAULT_EXPECT_TIMEOUT, ) @@ -254,7 +256,8 @@ def test_exit_code_equal_to_one(self): timeout=DEFAULT_EXPECT_TIMEOUT, ) process_launch.expect( - EOF, timeout=DEFAULT_EXPECT_TIMEOUT, + EOF, + timeout=DEFAULT_EXPECT_TIMEOUT, ) process_launch.wait_to_complete(10) assert process_launch.returncode == 1 @@ -309,7 +312,8 @@ def test_exit_code_equal_to_zero(self): ) process_launch.control_c() process_launch.expect_all( - ["Exit cli. code: 0"], timeout=DEFAULT_EXPECT_TIMEOUT, + ["Exit cli. code: 0"], + timeout=DEFAULT_EXPECT_TIMEOUT, ) diff --git a/tests/test_cli/test_list.py b/tests/test_cli/test_list.py index 67667d96fe..77e7f0dce3 100644 --- a/tests/test_cli/test_list.py +++ b/tests/test_cli/test_list.py @@ -67,7 +67,9 @@ def setup_class(cls): "aea.cli.list.format_items", return_value=FORMAT_ITEMS_SAMPLE_OUTPUT ): cls.result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "list", "protocols"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "list", "protocols"], + standalone_mode=False, ) def test_exit_code_equal_to_zero(self): diff --git a/tests/test_cli/test_logout.py b/tests/test_cli/test_logout.py index 3a2d7b8698..4fc384a689 100644 --- a/tests/test_cli/test_logout.py +++ b/tests/test_cli/test_logout.py @@ -38,7 +38,9 @@ def setUp(self): def test_logout_positive(self, update_cli_config_mock, registry_logout_mock): """Test for CLI logout positive result.""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "logout"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "logout"], + standalone_mode=False, ) self.assertEqual(result.exit_code, 0) registry_logout_mock.assert_called_once() diff --git a/tests/test_cli/test_misc.py b/tests/test_cli/test_misc.py index 75ea57c3fb..067e1a49b1 100644 --- a/tests/test_cli/test_misc.py +++ b/tests/test_cli/test_misc.py @@ -54,10 +54,8 @@ def test_flag_help(): --version Show the version and exit. -v, --verbosity LVL One of NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL, OFF - -s, --skip-consistency-check Skip consistency checks of agent during command execution. - --registry-path DIRECTORY Provide a local registry directory full path. --help Show this message and exit. @@ -77,11 +75,9 @@ def test_flag_help(): generate-all-protocols Generate all protocols. generate-key Generate a private key and place it in a file. generate-wealth Generate wealth for the agent on a test network. - get-address Get the address associated with a private key of - the... - - get-multiaddress Get the multiaddress associated with a private key... - get-public-key Get the public key associated with a private key of... + get-address Get the address associated with a private key of... + get-multiaddress Get the multiaddress associated with a private... + get-public-key Get the public key associated with a private key... get-wealth Get the wealth associated with the private key of... hash Hashing utils. init Initialize your AEA configurations. @@ -103,9 +99,7 @@ def test_flag_help(): run Run the agent. scaffold Scaffold a package for the agent. search Search for packages in the registry. - transfer Transfer wealth associated with a private key of - the... - + transfer Transfer wealth associated with a private key of... upgrade Upgrade the packages of the agent. """ ) diff --git a/tests/test_cli/test_publish.py b/tests/test_cli/test_publish.py index a30f9fc394..ddd6c8e531 100644 --- a/tests/test_cli/test_publish.py +++ b/tests/test_cli/test_publish.py @@ -120,15 +120,21 @@ def setUp(self): def test_publish_positive(self, *mocks): """Test for CLI publish positive result.""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "publish", "--local"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "publish", "--local"], + standalone_mode=False, ) self.assertEqual(result.exit_code, 0) result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "publish", "--remote"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "publish", "--remote"], + standalone_mode=False, ) self.assertEqual(result.exit_code, 0) result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "publish"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "publish"], + standalone_mode=False, ) self.assertEqual(result.exit_code, 0) @@ -212,7 +218,9 @@ def setup_class(cls): cls.add_item(cls.ITEM_TYPE, str(cls.ITEM_PUBLIC_ID), local=True) cls.scaffold_item(cls.NEW_ITEM_TYPE, cls.NEW_ITEM_NAME) - def test_publish_ok_with_missing_push(self,): + def test_publish_ok_with_missing_push( + self, + ): """Test ok for missing push.""" with pytest.raises(ClickException, match=r"Dependency is missing") as e: self.invoke("publish", "--local") @@ -251,7 +259,8 @@ def test_publish_ok_with_missing_push( with pytest.raises( ClickException, match=r"Package not found in remote registry" ) as e, mock.patch( - "aea.cli.publish.get_package_meta", side_effect=ClickException("expected"), + "aea.cli.publish.get_package_meta", + side_effect=ClickException("expected"), ), mock.patch( "aea.cli.publish.get_default_remote_registry", new=lambda: REMOTE_HTTP ): diff --git a/tests/test_cli/test_push.py b/tests/test_cli/test_push.py index d032422056..9fd2f5a08e 100644 --- a/tests/test_cli/test_push.py +++ b/tests/test_cli/test_push.py @@ -62,7 +62,10 @@ def test_save_item_locally_positive( "cwd", None, "skills", item_id.name ) try_get_item_target_path_mock.assert_called_once_with( - ctx_mock.registry_path, item_id.author, item_type + "s", item_id.name, + ctx_mock.registry_path, + item_id.author, + item_type + "s", + item_id.name, ) _check_package_public_id_mock.assert_called_once_with( "source", item_type, item_id @@ -84,11 +87,15 @@ def setup_class(cls): cls.add_item(cls.ITEM_TYPE, str(cls.ITEM_PUBLIC_ID), local=True) def test_vendor_ok( - self, copy_tree_mock, + self, + copy_tree_mock, ): """Test ok for vendor's item.""" - with mock.patch("os.path.exists", side_effect=[False, True, False]): - self.invoke("push", "--local", "skill", "fetchai/echo") + + with mock.patch("click.core._"): + with mock.patch("os.path.exists", side_effect=[False, True, False]): + self.invoke("push", "--local", "skill", "fetchai/echo") + copy_tree_mock.assert_called_once() src_path, dst_path = copy_tree_mock.mock_calls[0][1] # check for correct author, type, name @@ -98,7 +105,8 @@ def test_vendor_ok( ) def test_user_ok( - self, copy_tree_mock, + self, + copy_tree_mock, ): """Test ok for users's item.""" with mock.patch( @@ -115,7 +123,8 @@ def test_user_ok( ) def test_fail_no_item( - self, *mocks, + self, + *mocks, ): """Test fail, item_not_exists .""" expected_path_pattern = ".*" + ".*".join( @@ -138,14 +147,18 @@ class CheckPackagePublicIdTestCase(TestCase): def test__check_package_public_id_positive(self, *mocks): """Test for _check_package_public_id positive result.""" check_package_public_id( - "source-path", "item-type", PublicId.from_str(f"{AUTHOR}/name:0.1.0"), + "source-path", + "item-type", + PublicId.from_str(f"{AUTHOR}/name:0.1.0"), ) def test__check_package_public_id_negative(self, *mocks): """Test for _check_package_public_id negative result.""" with self.assertRaises(ClickException): check_package_public_id( - "source-path", "item-type", PublicId.from_str(f"{AUTHOR}/name:0.1.1"), + "source-path", + "item-type", + PublicId.from_str(f"{AUTHOR}/name:0.1.1"), ) diff --git a/tests/test_cli/test_remove/test_base.py b/tests/test_cli/test_remove/test_base.py index a78605b741..e51bbbfac1 100644 --- a/tests/test_cli/test_remove/test_base.py +++ b/tests/test_cli/test_remove/test_base.py @@ -210,7 +210,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( diff --git a/tests/test_cli/test_remove/test_connection.py b/tests/test_cli/test_remove/test_connection.py index ee11940796..2233df68f1 100644 --- a/tests/test_cli/test_remove/test_connection.py +++ b/tests/test_cli/test_remove/test_connection.py @@ -60,7 +60,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -122,7 +123,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -178,7 +180,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( diff --git a/tests/test_cli/test_remove/test_protocol.py b/tests/test_cli/test_remove/test_protocol.py index b1c36ae419..37c1e81427 100644 --- a/tests/test_cli/test_remove/test_protocol.py +++ b/tests/test_cli/test_remove/test_protocol.py @@ -55,7 +55,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -117,7 +118,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -173,7 +175,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( diff --git a/tests/test_cli/test_remove/test_skill.py b/tests/test_cli/test_remove/test_skill.py index 1677d06f58..af52d7bf0a 100644 --- a/tests/test_cli/test_remove/test_skill.py +++ b/tests/test_cli/test_remove/test_skill.py @@ -57,7 +57,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -129,7 +130,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -188,7 +190,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_reset_password.py b/tests/test_cli/test_reset_password.py index dec51b4a28..3e0b5f9cce 100644 --- a/tests/test_cli/test_reset_password.py +++ b/tests/test_cli/test_reset_password.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # +# Copyright 2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +39,9 @@ def test_reset_password_positive(self, registry_reset_password_mock): """Test for CLI reset_password positive result.""" email = "email@example.com" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "reset_password", email], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "reset_password", email], + standalone_mode=False, ) self.assertEqual(result.exit_code, 0) registry_reset_password_mock.assert_called_once_with(email) diff --git a/tests/test_cli/test_run.py b/tests/test_cli/test_run.py index 7d6a3a86e1..5cdeee3e49 100644 --- a/tests/test_cli/test_run.py +++ b/tests/test_cli/test_run.py @@ -77,7 +77,8 @@ def test_run(password_or_none): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -189,7 +190,8 @@ def test_run_with_profiling(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -297,7 +299,8 @@ def test_run_with_default_connection(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -394,7 +397,8 @@ def test_run_multiple_connections(connection_ids): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -461,7 +465,8 @@ def test_run_multiple_connections(connection_ids): process.expect_all(["Start processing messages"], timeout=40) process.control_c() process.expect( - EOF, timeout=40, + EOF, + timeout=40, ) process.wait_to_complete(15) assert process.returncode == 0 @@ -485,7 +490,8 @@ def test_run_unknown_private_key(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -560,7 +566,8 @@ def test_run_fet_private_key_config(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -619,7 +626,8 @@ def test_run_ethereum_private_key_config(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -682,7 +690,8 @@ def test_run_with_install_deps(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -770,7 +779,8 @@ def test_run_with_install_deps_and_requirement_file(): os.chdir(t) result = runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -891,7 +901,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -962,7 +973,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -1018,7 +1030,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -1071,7 +1084,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -1161,7 +1175,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -1199,8 +1214,8 @@ def setup_class(cls): DEFAULT_CONNECTION_CONFIG_FILE, ) cls.connection_configuration_path.unlink() - cls.relative_connection_configuration_path = cls.connection_configuration_path.relative_to( - Path(cls.t, cls.agent_name) + cls.relative_connection_configuration_path = ( + cls.connection_configuration_path.relative_to(Path(cls.t, cls.agent_name)) ) cls.result = cls.runner.invoke( @@ -1353,7 +1368,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -1428,7 +1444,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -1585,7 +1602,8 @@ def raise_err(*args): with pytest.raises(Exception, match="^None$"): with patch("aea.cli.run.run_aea", raise_err): self.run_cli_command( - "run", cwd=self._get_cwd(), + "run", + cwd=self._get_cwd(), ) with pytest.raises(Exception, match=f"^..{self.connection2_id}..$"): with patch("aea.cli.run.run_aea", raise_err): diff --git a/tests/test_cli/test_scaffold/test_connection.py b/tests/test_cli/test_scaffold/test_connection.py index bb91dc44e3..81c6a3a330 100644 --- a/tests/test_cli/test_scaffold/test_connection.py +++ b/tests/test_cli/test_scaffold/test_connection.py @@ -68,7 +68,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -227,7 +228,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -314,7 +316,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -382,7 +385,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -456,7 +460,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -530,7 +535,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 diff --git a/tests/test_cli/test_scaffold/test_error_handler.py b/tests/test_cli/test_scaffold/test_error_handler.py index 92e5966fc0..35da09d404 100644 --- a/tests/test_cli/test_scaffold/test_error_handler.py +++ b/tests/test_cli/test_scaffold/test_error_handler.py @@ -42,7 +42,9 @@ def setUp(self): def test_scaffold_error_handler_command_positive(self, *mocks): """Test for CLI scaffold error handler command for positive result.""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "scaffold", "error-handler"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "scaffold", "error-handler"], + standalone_mode=False, ) self.assertEqual(result.exit_code, 0) diff --git a/tests/test_cli/test_scaffold/test_protocols.py b/tests/test_cli/test_scaffold/test_protocols.py index e94fc10dc5..c1cd3c5cc0 100644 --- a/tests/test_cli/test_scaffold/test_protocols.py +++ b/tests/test_cli/test_scaffold/test_protocols.py @@ -70,7 +70,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -244,7 +245,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -312,7 +314,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -387,7 +390,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -461,7 +465,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( diff --git a/tests/test_cli/test_scaffold/test_skills.py b/tests/test_cli/test_scaffold/test_skills.py index bb11520de9..e2310cc27c 100644 --- a/tests/test_cli/test_scaffold/test_skills.py +++ b/tests/test_cli/test_scaffold/test_skills.py @@ -73,7 +73,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -130,7 +131,7 @@ def test_init_module_contains_new_public_id(self): init_module_content = p.read_text() expected_public_id = f"{AUTHOR}/{self.resource_name}:{DEFAULT_VERSION}" matches = re.findall( - fr'^PUBLIC_ID = PublicId\.from_str\("{expected_public_id}"\)$', + rf'^PUBLIC_ID = PublicId\.from_str\("{expected_public_id}"\)$', init_module_content, re.MULTILINE, ) @@ -239,7 +240,7 @@ def test_init_module_contains_new_public_id(self): init_module_content = p.read_text() expected_public_id = f"{AUTHOR}/{self.resource_name}:{DEFAULT_VERSION}" matches = re.findall( - fr'^PUBLIC_ID = PublicId\.from_str\("{expected_public_id}"\)$', + rf'^PUBLIC_ID = PublicId\.from_str\("{expected_public_id}"\)$', init_module_content, re.MULTILINE, ) @@ -273,7 +274,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -340,7 +342,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -413,7 +416,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -425,7 +429,8 @@ def setup_class(cls): # change the dumping of yaml module to raise an exception. cls.patch = unittest.mock.patch( - "yaml.dump", side_effect=ValidationError("test error message"), + "yaml.dump", + side_effect=ValidationError("test error message"), ) cls.patch.start() @@ -484,7 +489,8 @@ def setup_class(cls): os.chdir(cls.t) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( diff --git a/tests/test_cli/test_search.py b/tests/test_cli/test_search.py index c61dcdd903..90378de373 100644 --- a/tests/test_cli/test_search.py +++ b/tests/test_cli/test_search.py @@ -100,7 +100,9 @@ def test_search_contracts_positive(self, *mocks): def test_search_contracts_registry_positive(self, *mocks): """Test search contracts in registry command positive result.""" result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "search", "contracts"], standalone_mode=False, + cli, + [*CLI_LOG_OPTION, "search", "contracts"], + standalone_mode=False, ) assert result.output == ( 'Searching for ""...\n' @@ -181,7 +183,8 @@ def setup_class(cls): ) cls.cli_config_patch.start() result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 result = cls.runner.invoke( @@ -352,7 +355,9 @@ def test_exit_code_equal_to_zero(self): """Test that the exit code is equal to 0 (i.e. success).""" assert self.result.exit_code == 0 - def test_correct_output(self,): + def test_correct_output( + self, + ): """Test that the command has printed the correct output..""" public_id_echo = ECHO_SKILL_PUBLIC_ID public_id_error = ERROR_SKILL_PUBLIC_ID @@ -375,7 +380,10 @@ def test_correct_output(self,): "Author: fetchai\n" "Version: {}\n" "------------------------------\n\n" - ).format(str(public_id_error), str(public_id_error.version),), + ).format( + str(public_id_error), + str(public_id_error.version), + ), ] assert [strings in self.result.output for strings in expected] @@ -409,7 +417,8 @@ def setup_class(cls): shutil.rmtree(p) result = cls.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -430,7 +439,9 @@ def test_exit_code_equal_to_zero(self): """Test that the exit code is equal to 0 (i.e. success).""" assert self.result.exit_code == 0 - def test_correct_output(self,): + def test_correct_output( + self, + ): """Test that the command has printed the correct output..""" public_id_echo = ECHO_SKILL_PUBLIC_ID public_id_error = ERROR_SKILL_PUBLIC_ID @@ -453,7 +464,10 @@ def test_correct_output(self,): "Author: fetchai\n" "Version: {}\n" "------------------------------\n\n" - ).format(str(public_id_error), str(public_id_error.version),), + ).format( + str(public_id_error), + str(public_id_error.version), + ), ] assert [strings in self.result.output for strings in expected] diff --git a/tests/test_cli/test_utils/test_config.py b/tests/test_cli/test_utils/test_config.py index bdce91139e..704cb7f057 100644 --- a/tests/test_cli/test_utils/test_config.py +++ b/tests/test_cli/test_utils/test_config.py @@ -49,7 +49,8 @@ def test_validate_item_config_positive(self, *mocks): validate_item_config(item_type="agent", package_path="file/path") @mock.patch( - "aea.cli.utils.config.load_item_config", return_value=FaultyAgentConfigMock(), + "aea.cli.utils.config.load_item_config", + return_value=FaultyAgentConfigMock(), ) @mock.patch( "aea.cli.utils.config.ConfigLoaders.from_package_type", diff --git a/tests/test_cli/tools_for_testing.py b/tests/test_cli/tools_for_testing.py index a3bbabf756..5bf63340b0 100644 --- a/tests/test_cli/tools_for_testing.py +++ b/tests/test_cli/tools_for_testing.py @@ -126,7 +126,9 @@ def package_version(self) -> PackageVersion: """Get package version.""" return PackageVersion(self.version) - def without_hash(self,) -> "PublicIdMock": + def without_hash( + self, + ) -> "PublicIdMock": """Returns the mock object.""" return self diff --git a/tests/test_configurations/test_schema.py b/tests/test_configurations/test_schema.py index c9aa14acbb..7b1ea15f8c 100644 --- a/tests/test_configurations/test_schema.py +++ b/tests/test_configurations/test_schema.py @@ -139,7 +139,8 @@ def test_config_validation(schema_file_path, config_file_path): # TODO a bit inefficient to load each schema everytime; consider making the validators as fixtures. schema = json.load(open(schema_file_path)) resolver = jsonschema.RefResolver( - make_jsonschema_base_uri(Path(CONFIGURATION_SCHEMA_DIR).absolute()), schema, + make_jsonschema_base_uri(Path(CONFIGURATION_SCHEMA_DIR).absolute()), + schema, ) validator = Draft4Validator(schema, resolver=resolver) config_data = list(yaml.safe_load_all(open(config_file_path))) diff --git a/tests/test_configurations/test_utils.py b/tests/test_configurations/test_utils.py index 0b34580e0a..bb75998a6a 100644 --- a/tests/test_configurations/test_utils.py +++ b/tests/test_configurations/test_utils.py @@ -223,7 +223,9 @@ def setup_class(cls): cls.expected_custom_component_configuration = dict(foo="bar") cls.skill_config = SkillConfig( - name="skill_name", author="author", version="0.1.0", + name="skill_name", + author="author", + version="0.1.0", ) cls.skill_config.protocols = {cls.old_protocol_id} diff --git a/tests/test_contracts/test_base.py b/tests/test_contracts/test_base.py index 9fa64bce94..36338916f8 100644 --- a/tests/test_contracts/test_base.py +++ b/tests/test_contracts/test_base.py @@ -136,7 +136,8 @@ def dummy_contract(request): def test_get_instance_no_address_ethereum(dummy_contract): """Tests get instance method with no address for ethereum.""" ledger_api = ledger_apis_registry.make( - EthereumCrypto.identifier, address=ETHEREUM_DEFAULT_ADDRESS, + EthereumCrypto.identifier, + address=ETHEREUM_DEFAULT_ADDRESS, ) instance = dummy_contract.get_instance(ledger_api) assert type(instance) == web3._utils.datatypes.PropertyCheckingFactory @@ -165,7 +166,8 @@ def test_get_deploy_transaction_ethereum( def test_get_instance_no_address_cosmwasm(dummy_contract): """Tests get instance method with no address for fetchai.""" ledger_api = ledger_apis_registry.make( - FetchAICrypto.identifier, address=FETCHAI_DEFAULT_ADDRESS, + FetchAICrypto.identifier, + address=FETCHAI_DEFAULT_ADDRESS, ) instance = dummy_contract.get_instance(ledger_api) assert instance is None @@ -175,7 +177,8 @@ def test_get_deploy_transaction_cosmwasm(dummy_contract): """Tests the deploy transaction classmethod for fetchai.""" aea_ledger_fetchai = crypto_registry.make(FetchAICrypto.identifier) ledger_api = ledger_apis_registry.make( - FetchAICrypto.identifier, address=FETCHAI_DEFAULT_ADDRESS, + FetchAICrypto.identifier, + address=FETCHAI_DEFAULT_ADDRESS, ) deploy_tx = dummy_contract.get_deploy_transaction( ledger_api, aea_ledger_fetchai.address, account_number=1, sequence=0 @@ -202,7 +205,8 @@ def test_contract_method_call(): os.path.join(ROOT_DIR, "tests", "data", "dummy_contract") ) ledger_api = ledger_apis_registry.make( - FetchAICrypto.identifier, address=FETCHAI_DEFAULT_ADDRESS, + FetchAICrypto.identifier, + address=FETCHAI_DEFAULT_ADDRESS, ) with pytest.raises(NotImplementedError): contract.contract_method_call(ledger_api, "dummy_method") @@ -225,7 +229,8 @@ def test_build_transaction(): os.path.join(ROOT_DIR, "tests", "data", "dummy_contract") ) ledger_api = ledger_apis_registry.make( - FetchAICrypto.identifier, address=FETCHAI_DEFAULT_ADDRESS, + FetchAICrypto.identifier, + address=FETCHAI_DEFAULT_ADDRESS, ) with pytest.raises(NotImplementedError): contract.build_transaction(ledger_api, "dummy_method", {}, {}) @@ -248,7 +253,8 @@ def test_get_transaction_transfer_logs(): os.path.join(ROOT_DIR, "tests", "data", "dummy_contract") ) ledger_api = ledger_apis_registry.make( - FetchAICrypto.identifier, address=FETCHAI_DEFAULT_ADDRESS, + FetchAICrypto.identifier, + address=FETCHAI_DEFAULT_ADDRESS, ) with pytest.raises(NotImplementedError): contract.get_transaction_transfer_logs(ledger_api, "dummy_hash") diff --git a/tests/test_crypto/test_ledger_apis.py b/tests/test_crypto/test_ledger_apis.py index ceb380eaea..62efd285c6 100644 --- a/tests/test_crypto/test_ledger_apis.py +++ b/tests/test_crypto/test_ledger_apis.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -94,7 +94,8 @@ def test_send_signed_transaction(self): return_value="mock_transaction_digest", ): tx_digest = self.ledger_apis.send_signed_transaction( - identifier=CosmosCrypto.identifier, tx_signed="signed_transaction", + identifier=CosmosCrypto.identifier, + tx_signed="signed_transaction", ) assert tx_digest == "mock_transaction_digest" @@ -105,7 +106,8 @@ def test_get_transaction_receipt(self): return_value="mock_transaction_receipt", ): tx_receipt = self.ledger_apis.get_transaction_receipt( - identifier=CosmosCrypto.identifier, tx_digest="tx_digest", + identifier=CosmosCrypto.identifier, + tx_digest="tx_digest", ) assert tx_receipt == "mock_transaction_receipt" @@ -116,24 +118,28 @@ def test_get_transaction(self): return_value="mock_transaction", ): tx = self.ledger_apis.get_transaction( - identifier=CosmosCrypto.identifier, tx_digest="tx_digest", + identifier=CosmosCrypto.identifier, + tx_digest="tx_digest", ) assert tx == "mock_transaction" def test_is_transaction_settled(self): """Test the is_transaction_settled.""" with mock.patch( - "aea_ledger_cosmos.CosmosApi.is_transaction_settled", return_value=True, + "aea_ledger_cosmos.CosmosApi.is_transaction_settled", + return_value=True, ): is_settled = self.ledger_apis.is_transaction_settled( - identifier=CosmosCrypto.identifier, tx_receipt="tx_receipt", + identifier=CosmosCrypto.identifier, + tx_receipt="tx_receipt", ) assert is_settled def test_is_transaction_valid(self): """Test the is_transaction_valid.""" with mock.patch( - "aea_ledger_cosmos.CosmosApi.is_transaction_valid", return_value=True, + "aea_ledger_cosmos.CosmosApi.is_transaction_valid", + return_value=True, ): is_valid = self.ledger_apis.is_transaction_valid( identifier=CosmosCrypto.identifier, @@ -163,10 +169,12 @@ def test_get_hash(self): """Test the get_hash.""" expected_hash = "hash" with mock.patch( - "aea_ledger_cosmos.CosmosApi.get_hash", return_value=expected_hash, + "aea_ledger_cosmos.CosmosApi.get_hash", + return_value=expected_hash, ): hash_ = self.ledger_apis.get_hash( - identifier=CosmosCrypto.identifier, message=b"message", + identifier=CosmosCrypto.identifier, + message=b"message", ) assert hash_ == expected_hash @@ -178,7 +186,8 @@ def test_get_contract_address(self): return_value=expected_address, ): address_ = self.ledger_apis.get_contract_address( - identifier=CosmosCrypto.identifier, tx_receipt={}, + identifier=CosmosCrypto.identifier, + tx_receipt={}, ) assert address_ == expected_address diff --git a/tests/test_crypto/test_password_end2end.py b/tests/test_crypto/test_password_end2end.py index d8c252fad3..ffaac646f0 100644 --- a/tests/test_crypto/test_password_end2end.py +++ b/tests/test_crypto/test_password_end2end.py @@ -72,5 +72,10 @@ def test_crypto_plugin(self, ledger_name): ) assert r.exit_code == 0 - r = self.invoke("get-address", ledger_name, "--password", password,) + r = self.invoke( + "get-address", + ledger_name, + "--password", + password, + ) assert r.exit_code == 0 diff --git a/tests/test_crypto/test_registry/test_misc.py b/tests/test_crypto/test_registry/test_misc.py index 4b3e90147e..f31b214b07 100644 --- a/tests/test_crypto/test_registry/test_misc.py +++ b/tests/test_crypto/test_registry/test_misc.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # +# Copyright 2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -53,6 +54,6 @@ def test_validation_item_id(current_id, is_valid): else: with pytest.raises( AEAException, - match=fr"Malformed ItemId: '{current_id}'\. It must be of the form .*\.", + match=rf"Malformed ItemId: '{current_id}'\. It must be of the form .*\.", ): registry.register(current_id, entry_point=entrypoint) diff --git a/tests/test_examples/test_http_client_connection_to_aries_cloud_agent.py b/tests/test_examples/test_http_client_connection_to_aries_cloud_agent.py index 1c861a034b..c7a2c0fec8 100644 --- a/tests/test_examples/test_http_client_connection_to_aries_cloud_agent.py +++ b/tests/test_examples/test_http_client_connection_to_aries_cloud_agent.py @@ -132,7 +132,9 @@ async def test_connecting_to_aca(self): ) request_http_message.to = "ACA" request_envelope = Envelope( - to="ACA", sender="AEA", message=request_http_message, + to="ACA", + sender="AEA", + message=request_http_message, ) try: @@ -184,7 +186,9 @@ async def test_end_to_end_aea_aca(self): connection_id=HTTPClientConnection.connection_id, ) http_client_connection = HTTPClientConnection( - configuration=configuration, data_dir=MagicMock(), identity=identity, + configuration=configuration, + data_dir=MagicMock(), + identity=identity, ) resources = Resources() resources.add_connection(http_client_connection) @@ -226,7 +230,9 @@ async def test_end_to_end_aea_aca(self): ) request_http_message.to = "ACA" request_envelope = Envelope( - to="ACA", sender="AEA", message=request_http_message, + to="ACA", + sender="AEA", + message=request_http_message, ) # add a simple skill with handler diff --git a/tests/test_helpers/test_async_utils.py b/tests/test_helpers/test_async_utils.py index 97b6a30236..0bec04b940 100644 --- a/tests/test_helpers/test_async_utils.py +++ b/tests/test_helpers/test_async_utils.py @@ -222,7 +222,9 @@ class TestRunnable: def test_no_loop_and_threded(self): """Test runnable fails on threaded mode and loop provided..""" - with pytest.raises(ValueError,): + with pytest.raises( + ValueError, + ): RunAndExit(loop=asyncio.get_event_loop(), threaded=True) def test_task_cancel_not_set(self): diff --git a/tests/test_helpers/test_env_vars.py b/tests/test_helpers/test_env_vars.py index 6cfdcefa8e..33491c5669 100644 --- a/tests/test_helpers/test_env_vars.py +++ b/tests/test_helpers/test_env_vars.py @@ -55,7 +55,8 @@ def test_replace_with_env_var(): assert replace_with_env_var("${var}", {}, default_value=100) == 100 with pytest.raises( - ValueError, match=r"`var` not found in env variables and no default value set!", + ValueError, + match=r"`var` not found in env variables and no default value set!", ): replace_with_env_var("${var}", {}) diff --git a/tests/test_helpers/test_ipfs/test_base.py b/tests/test_helpers/test_ipfs/test_base.py index 33f62806ba..b2766804fc 100644 --- a/tests/test_helpers/test_ipfs/test_base.py +++ b/tests/test_helpers/test_ipfs/test_base.py @@ -52,13 +52,17 @@ def test_hash_for_big_file(): class TestDirectoryHashing: """Test recursive directory hashing.""" - def setup(self,) -> None: + def setup( + self, + ) -> None: """Setup test.""" self.hash_tool = IPFSHashOnly() self.ipfs_tool = IPFSTool(addr="/ip4/127.0.0.1/tcp/5001") - def test_depth_0(self,) -> None: + def test_depth_0( + self, + ) -> None: """Test directory with only one file and no child directories.""" with TemporaryDirectory() as temp_dir: @@ -71,7 +75,9 @@ def test_depth_0(self,) -> None: hash_daemon == hash_local ), f"Hash from daemon {hash_daemon} does not match calculated hash {hash_local}\n{d}" - def test_depth_1(self,) -> None: + def test_depth_1( + self, + ) -> None: """Test directory with only one file and a child directory.""" with TemporaryDirectory() as temp_dir: @@ -86,7 +92,9 @@ def test_depth_1(self,) -> None: hash_daemon == hash_local ), f"Hash from daemon {hash_daemon} does not match calculated hash {hash_local}\n{d}" - def test_depth_multi(self,) -> None: + def test_depth_multi( + self, + ) -> None: """Test directory with only one file and a child directory.""" with TemporaryDirectory() as temp_dir: diff --git a/tests/test_helpers/test_profiling.py b/tests/test_helpers/test_profiling.py index 17f98c028f..00b661f0d5 100644 --- a/tests/test_helpers/test_profiling.py +++ b/tests/test_helpers/test_profiling.py @@ -171,7 +171,11 @@ def test_profiling_cross_reference(): global result result = "" - p = Profiling([Message, MessageContainer], 1, output_function=output_function,) + p = Profiling( + [Message, MessageContainer], + 1, + output_function=output_function, + ) p.start() wait_for_condition(lambda: p.is_running, timeout=20) @@ -205,14 +209,16 @@ def test_profiling_counts_not_equal(): result = "" p = Profiling( - [Message, MessageContainer, DummyClass], 1, output_function=output_function, + [Message, MessageContainer, DummyClass], + 1, + output_function=output_function, ) p.start() wait_for_condition(lambda: p.is_running, timeout=20) # Generate some dummy classes to check that they appear in the gc counter - dummy_classes_to_count = [ # noqa: F841 we need to store the objects so they appear in the gc + _ = [ # noqa: F841 we need to store the objects so they appear in the gc DummyClass() for _ in range(1000) ] diff --git a/tests/test_mail/test_base.py b/tests/test_mail/test_base.py index 865ecf5eb8..db5649a279 100644 --- a/tests/test_mail/test_base.py +++ b/tests/test_mail/test_base.py @@ -70,7 +70,11 @@ def test_envelope_initialisation(): ) msg.to = receiver_address - envelope = Envelope(to=receiver_address, sender=agent_address, message=msg,) + envelope = Envelope( + to=receiver_address, + sender=agent_address, + message=msg, + ) assert envelope, "Cannot generate a new envelope" @@ -102,7 +106,11 @@ def test_inbox_nowait(): ) msg.to = receiver_address multiplexer = Multiplexer([_make_dummy_connection()]) - envelope = Envelope(to=receiver_address, sender=agent_address, message=msg,) + envelope = Envelope( + to=receiver_address, + sender=agent_address, + message=msg, + ) multiplexer.in_queue.put(envelope) inbox = InBox(multiplexer) assert ( @@ -119,7 +127,11 @@ def test_inbox_get(): ) msg.to = receiver_address multiplexer = Multiplexer([_make_dummy_connection()]) - envelope = Envelope(to=receiver_address, sender=agent_address, message=msg,) + envelope = Envelope( + to=receiver_address, + sender=agent_address, + message=msg, + ) multiplexer.in_queue.put(envelope) inbox = InBox(multiplexer) @@ -167,7 +179,11 @@ def test_outbox_put(): wait_for_condition( lambda: dummy_connection.is_connected, 15, "Connection is not connected" ) - envelope = Envelope(to=receiver_address, sender=agent_address, message=msg,) + envelope = Envelope( + to=receiver_address, + sender=agent_address, + message=msg, + ) outbox.put(envelope) wait_for_condition( lambda: inbox.empty(), 15, "Inbox must not be empty after putting an envelope" @@ -274,7 +290,11 @@ def test_envelope_serialization(): def test_envelope_message_bytes(): """Test the property Envelope.message_bytes.""" message = DefaultMessage(DefaultMessage.Performative.BYTES, content=b"message") - envelope = Envelope(to="to", sender="sender", message=message,) + envelope = Envelope( + to="to", + sender="sender", + message=message, + ) expected_message_bytes = message.encode() actual_message_bytes = envelope.message_bytes diff --git a/tests/test_manager/test_manager.py b/tests/test_manager/test_manager.py index 6adb1cea8e..e4bc6ed110 100644 --- a/tests/test_manager/test_manager.py +++ b/tests/test_manager/test_manager.py @@ -261,7 +261,8 @@ def test_add_agent(self, *args): with pytest.raises(ValueError, match="already exists"): self.manager.add_agent( - self.project_public_id, self.agent_name, + self.project_public_id, + self.agent_name, ) def test_set_overrides(self, *args): @@ -349,7 +350,8 @@ def add_agent(self, agent_name: str, project_id: PublicId) -> None: self.manager.add_project(project_id, local=True) self.manager.add_agent( - project_id, agent_name, + project_id, + agent_name, ) agent_alias = self.manager.get_agent_alias(agent_name) diff --git a/tests/test_multiplexer.py b/tests/test_multiplexer.py index f158cb862f..9536e60e6f 100644 --- a/tests/test_multiplexer.py +++ b/tests/test_multiplexer.py @@ -542,10 +542,17 @@ async def test_inbox_outbox(): connection_1 = _make_dummy_connection() connections = [connection_1] multiplexer = AsyncMultiplexer(connections, loop=asyncio.get_event_loop()) - msg = DefaultMessage(performative=DefaultMessage.Performative.BYTES, content=b"",) + msg = DefaultMessage( + performative=DefaultMessage.Performative.BYTES, + content=b"", + ) msg.to = "to" msg.sender = "sender" - envelope = Envelope(to="to", sender="sender", message=msg,) + envelope = Envelope( + to="to", + sender="sender", + message=msg, + ) try: await multiplexer.connect() inbox = InBox(multiplexer) @@ -576,7 +583,10 @@ async def test_threaded_mode(): connection_1 = _make_dummy_connection() connections = [connection_1] multiplexer = AsyncMultiplexer(connections, threaded=True) - msg = DefaultMessage(performative=DefaultMessage.Performative.BYTES, content=b"",) + msg = DefaultMessage( + performative=DefaultMessage.Performative.BYTES, + content=b"", + ) msg.to = "to" msg.sender = "sender" envelope = Envelope(to="to", sender="sender", message=msg) @@ -611,7 +621,10 @@ async def test_outbox_negative(): connection_1 = _make_dummy_connection() connections = [connection_1] multiplexer = AsyncMultiplexer(connections, loop=asyncio.get_event_loop()) - msg = DefaultMessage(performative=DefaultMessage.Performative.BYTES, content=b"",) + msg = DefaultMessage( + performative=DefaultMessage.Performative.BYTES, + content=b"", + ) context = EnvelopeContext(connection_id=connection_1.connection_id) envelope = Envelope( to="to", @@ -884,7 +897,8 @@ def setup(self): self.conn_key_path = os.path.join(self.t, "conn_private_key.txt") result = self.runner.invoke( - cli, [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], + cli, + [*CLI_LOG_OPTION, "init", "--local", "--author", AUTHOR], ) assert result.exit_code == 0 @@ -975,7 +989,8 @@ def test_multiplexer_disconnected_on_termination_after_connected_no_connection( ) self.proc.expect_all( - ["Start processing messages..."], timeout=20, + ["Start processing messages..."], + timeout=20, ) self.proc.control_c() self.proc.expect_all( @@ -1003,7 +1018,8 @@ def test_multiplexer_disconnected_on_termination_after_connected_one_connection( ) self.proc.expect_all( - ["Start processing messages..."], timeout=20, + ["Start processing messages..."], + timeout=20, ) self.proc.control_c() self.proc.expect_all( diff --git a/tests/test_packages/test_connections/test_gym/test_gym.py b/tests/test_packages/test_connections/test_gym/test_gym.py index e98a1ffd7c..ca303a6b07 100644 --- a/tests/test_packages/test_connections/test_gym/test_gym.py +++ b/tests/test_packages/test_connections/test_gym/test_gym.py @@ -124,9 +124,14 @@ async def test_decode_envelope_error(self): async def test_send_connection_error(self): """Test send connection error.""" msg, sending_dialogue = self.dialogues.create( - counterparty=self.gym_address, performative=GymMessage.Performative.RESET, + counterparty=self.gym_address, + performative=GymMessage.Performative.RESET, + ) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, ) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) with pytest.raises(ConnectionError): await self.gym_con.send(envelope) @@ -141,7 +146,11 @@ async def test_send_act(self): action=GymMessage.AnyObject("any_action"), step_id=1, ) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) await self.gym_con.connect() observation = 1 @@ -176,8 +185,14 @@ async def test_send_close(self): """Test send close message.""" sending_dialogue = await self.send_reset() assert sending_dialogue.last_message is not None - msg = sending_dialogue.reply(performative=GymMessage.Performative.CLOSE,) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + msg = sending_dialogue.reply( + performative=GymMessage.Performative.CLOSE, + ) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) await self.gym_con.connect() with patch.object(self.env, "close") as mock: @@ -213,10 +228,15 @@ async def test_send_close_negative(self): async def send_reset(self) -> GymDialogue: """Send a reset.""" msg, sending_dialogue = self.dialogues.create( - counterparty=self.gym_address, performative=GymMessage.Performative.RESET, + counterparty=self.gym_address, + performative=GymMessage.Performative.RESET, ) assert sending_dialogue is not None - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) await self.gym_con.connect() with patch.object(self.env, "reset") as mock: diff --git a/tests/test_packages/test_connections/test_http_client/test_http_client.py b/tests/test_packages/test_connections/test_http_client/test_http_client.py index 9fd07a840b..91dfed008e 100644 --- a/tests/test_packages/test_connections/test_http_client/test_http_client.py +++ b/tests/test_packages/test_connections/test_http_client/test_http_client.py @@ -226,7 +226,9 @@ async def test_channel_cancel_tasks_on_disconnect(self): response_mock.read.return_value = asyncio.Future() with patch.object( - aiohttp.ClientSession, "request", return_value=_MockRequest(response_mock), + aiohttp.ClientSession, + "request", + return_value=_MockRequest(response_mock), ): await self.http_client_connection.send(envelope=request_envelope) @@ -271,7 +273,9 @@ async def test_http_send_ok(self): response_mock.read.return_value.set_result("") with patch.object( - aiohttp.ClientSession, "request", return_value=_MockRequest(response_mock), + aiohttp.ClientSession, + "request", + return_value=_MockRequest(response_mock), ): await self.http_client_connection.send(envelope=request_envelope) # TODO: Consider returning the response from the server in order to be able to assert that the message send! diff --git a/tests/test_packages/test_connections/test_http_server/test_http_server.py b/tests/test_packages/test_connections/test_http_server/test_http_server.py index 16e84c94ff..9d782e359e 100644 --- a/tests/test_packages/test_connections/test_http_server/test_http_server.py +++ b/tests/test_packages/test_connections/test_http_server/test_http_server.py @@ -172,7 +172,10 @@ async def test_get_200(self): ) await self.http_connection.send(response_envelope) - response = await asyncio.wait_for(request_task, timeout=20,) + response = await asyncio.wait_for( + request_task, + timeout=20, + ) assert ( response.status == 200 @@ -205,7 +208,10 @@ async def test_header_content_type(self): ) await self.http_connection.send(response_envelope) - response = await asyncio.wait_for(request_task, timeout=20,) + response = await asyncio.wait_for( + request_task, + timeout=20, + ) assert ( response.status == 200 and response.reason == "Success" @@ -299,7 +305,12 @@ async def test_late_message_get_timeout_error(self): @pytest.mark.asyncio async def test_post_201(self): """Test send get request w/ 200 response.""" - request_task = self.loop.create_task(self.request("post", "/pets",)) + request_task = self.loop.create_task( + self.request( + "post", + "/pets", + ) + ) envelope = await asyncio.wait_for(self.http_connection.receive(), timeout=20) assert envelope incoming_message, dialogue = self._get_message_and_dialogue(envelope) @@ -320,7 +331,10 @@ async def test_post_201(self): await self.http_connection.send(response_envelope) - response = await asyncio.wait_for(request_task, timeout=20,) + response = await asyncio.wait_for( + request_task, + timeout=20, + ) assert ( response.status == 201 and response.reason == "Created" @@ -396,7 +410,11 @@ async def test_send_connection_drop(self): ) message.to = str(HTTPServerConnection.connection_id) message.sender = self.target_skill_id - envelope = Envelope(to=message.to, sender=message.sender, message=message,) + envelope = Envelope( + to=message.to, + sender=message.sender, + message=message, + ) await self.http_connection.send(envelope) @pytest.mark.asyncio @@ -422,7 +440,12 @@ async def test_fail_connect(self): @pytest.mark.asyncio async def test_server_error_on_send_response(self): """Test exception raised on response sending to the client.""" - request_task = self.loop.create_task(self.request("post", "/pets",)) + request_task = self.loop.create_task( + self.request( + "post", + "/pets", + ) + ) envelope = await asyncio.wait_for(self.http_connection.receive(), timeout=20) assert envelope incoming_message, dialogue = self._get_message_and_dialogue(envelope) @@ -444,7 +467,10 @@ async def test_server_error_on_send_response(self): with patch.object(Response, "from_message", side_effect=Exception("expected")): await self.http_connection.send(response_envelope) - response = await asyncio.wait_for(request_task, timeout=20,) + response = await asyncio.wait_for( + request_task, + timeout=20, + ) assert response and response.status == 500 and response.reason == "Server Error" @@ -549,7 +575,10 @@ async def test_get_200(self): ) await self.http_connection.send(response_envelope) - response = await asyncio.wait_for(request_task, timeout=20,) + response = await asyncio.wait_for( + request_task, + timeout=20, + ) assert ( response.status == 200 diff --git a/tests/test_packages/test_connections/test_ledger/test_contract_api.py b/tests/test_packages/test_connections/test_ledger/test_contract_api.py index 638d6fc526..68b24b9cda 100644 --- a/tests/test_packages/test_connections/test_ledger/test_contract_api.py +++ b/tests/test_packages/test_connections/test_ledger/test_contract_api.py @@ -94,7 +94,11 @@ async def test_erc1155_get_deploy_transaction(erc1155_contract, ledger_apis_conn callable="get_deploy_transaction", kwargs=ContractApiMessage.Kwargs({"deployer_address": ETHEREUM_ADDRESS_ONE}), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) @@ -140,7 +144,11 @@ async def test_erc1155_get_raw_transaction( } ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) @@ -187,7 +195,11 @@ async def test_erc1155_get_raw_message(erc1155_contract, ledger_apis_connection) } ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) @@ -225,7 +237,11 @@ async def test_erc1155_get_state(erc1155_contract, ledger_apis_connection): {"agent_address": ETHEREUM_ADDRESS_ONE, "token_id": token_id} ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) @@ -309,7 +325,11 @@ async def test_callable_wrong_number_of_arguments_api_and_contract_address( {"agent_address": ETHEREUM_ADDRESS_ONE, "token_id": token_id} ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) with unittest.mock.patch( "inspect.getfullargspec", return_value=unittest.mock.MagicMock(args=[None]) @@ -353,7 +373,11 @@ async def test_callable_wrong_number_of_arguments_apis( callable="get_deploy_transaction", kwargs=ContractApiMessage.Kwargs({}), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) with unittest.mock.patch( "inspect.getfullargspec", return_value=unittest.mock.MagicMock(args=[]) @@ -401,7 +425,11 @@ async def test_callable_wrong_number_of_arguments_apis_method_call( callable="get_deploy_transaction", kwargs=ContractApiMessage.Kwargs({}), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) with unittest.mock.patch.object( ledger_apis_connection._contract_dispatcher, "_call_stub", return_value=None @@ -440,7 +468,11 @@ async def test_callable_generic_error(erc1155_contract, ledger_apis_connection): {"agent_address": ETHEREUM_ADDRESS_ONE, "token_id": token_id} ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) with unittest.mock.patch( "inspect.getfullargspec", side_effect=Exception("Generic error") @@ -479,7 +511,11 @@ async def test_callable_cannot_find(erc1155_contract, ledger_apis_connection, ca {"agent_address": ETHEREUM_ADDRESS_ONE, "token_id": token_id} ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) with caplog.at_level(logging.DEBUG, "aea.packages.fetchai.connections.ledger"): await ledger_apis_connection.send(envelope) diff --git a/tests/test_packages/test_connections/test_ledger/test_ledger_api.py b/tests/test_packages/test_connections/test_ledger/test_ledger_api.py index c807faa3d3..7fca4dc584 100644 --- a/tests/test_packages/test_connections/test_ledger/test_ledger_api.py +++ b/tests/test_packages/test_connections/test_ledger/test_ledger_api.py @@ -155,7 +155,11 @@ async def test_get_balance( ledger_id=ledger_id, address=address, ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) @@ -209,7 +213,11 @@ async def test_get_state( args=args, kwargs=kwargs, ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) @@ -270,7 +278,11 @@ async def test_send_signed_transaction_ethereum( ), ) request = cast(LedgerApiMessage, request) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) response = await ledger_apis_connection.receive() @@ -297,7 +309,11 @@ async def test_send_signed_transaction_ethereum( ), ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) response = await ledger_apis_connection.receive() @@ -330,7 +346,11 @@ async def test_send_signed_transaction_ethereum( transaction_digest=response_message.transaction_digest, ), ) - envelope = Envelope(to=request.to, sender=request.sender, message=request,) + envelope = Envelope( + to=request.to, + sender=request.sender, + message=request, + ) await ledger_apis_connection.send(envelope) await asyncio.sleep(0.01) response = await ledger_apis_connection.receive() diff --git a/tests/test_packages/test_connections/test_local/test_misc.py b/tests/test_packages/test_connections/test_local/test_misc.py index 662615d141..14ffd9d97e 100644 --- a/tests/test_packages/test_connections/test_local/test_misc.py +++ b/tests/test_packages/test_connections/test_local/test_misc.py @@ -69,7 +69,11 @@ async def test_connection_twice_return_none(): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - expected_envelope = Envelope(to=address, sender=address, message=message,) + expected_envelope = Envelope( + to=address, + sender=address, + message=message, + ) await connection.send(expected_envelope) actual_envelope = await connection.receive() @@ -128,7 +132,11 @@ def test_communication(): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to="multiplexer2", sender="multiplexer1", message=msg,) + envelope = Envelope( + to="multiplexer2", + sender="multiplexer1", + message=msg, + ) multiplexer1.put(envelope) msg = FipaMessage( @@ -138,7 +146,11 @@ def test_communication(): target=0, query=Query([Constraint("something", ConstraintType(">", 1))]), ) - envelope = Envelope(to="multiplexer2", sender="multiplexer1", message=msg,) + envelope = Envelope( + to="multiplexer2", + sender="multiplexer1", + message=msg, + ) multiplexer1.put(envelope) msg = FipaMessage( @@ -149,7 +161,11 @@ def test_communication(): proposal=Description({}), ) - envelope = Envelope(to="multiplexer2", sender="multiplexer1", message=msg,) + envelope = Envelope( + to="multiplexer2", + sender="multiplexer1", + message=msg, + ) multiplexer1.put(envelope) msg = FipaMessage( @@ -158,7 +174,11 @@ def test_communication(): message_id=1, target=0, ) - envelope = Envelope(to="multiplexer2", sender="multiplexer1", message=msg,) + envelope = Envelope( + to="multiplexer2", + sender="multiplexer1", + message=msg, + ) multiplexer1.put(envelope) msg = FipaMessage( @@ -167,7 +187,11 @@ def test_communication(): message_id=1, target=0, ) - envelope = Envelope(to="multiplexer2", sender="multiplexer1", message=msg,) + envelope = Envelope( + to="multiplexer2", + sender="multiplexer1", + message=msg, + ) multiplexer1.put(envelope) envelope = multiplexer2.get(block=True, timeout=1.0) diff --git a/tests/test_packages/test_connections/test_local/test_search_services.py b/tests/test_packages/test_connections/test_local/test_search_services.py index c5ca5994ff..b3beda85f9 100644 --- a/tests/test_packages/test_connections/test_local/test_search_services.py +++ b/tests/test_packages/test_connections/test_local/test_search_services.py @@ -96,7 +96,9 @@ def setup_class(cls): cls.address_1 = "address_1" cls.public_key_1 = "public_key_1" cls.connection = _make_local_connection( - cls.address_1, cls.public_key_1, cls.node, + cls.address_1, + cls.public_key_1, + cls.node, ) cls.multiplexer = Multiplexer([cls.connection]) @@ -157,7 +159,13 @@ def setup_class(cls): cls.address_1 = "address_1" cls.public_key_1 = "public_key_1" cls.multiplexer = Multiplexer( - [_make_local_connection(cls.address_1, cls.public_key_1, cls.node,)] + [ + _make_local_connection( + cls.address_1, + cls.public_key_1, + cls.node, + ) + ] ) cls.multiplexer.connect() @@ -207,7 +215,13 @@ def setup(self): self.address_1 = "address" self.public_key_1 = "public_key_1" self.multiplexer = Multiplexer( - [_make_local_connection(self.address_1, self.public_key_1, self.node,)] + [ + _make_local_connection( + self.address_1, + self.public_key_1, + self.node, + ) + ] ) self.multiplexer.connect() @@ -281,12 +295,24 @@ def setup_class(cls): cls.address_1 = "address_1" cls.public_key_1 = "public_key_1" cls.multiplexer1 = Multiplexer( - [_make_local_connection(cls.address_1, cls.public_key_1, cls.node,)] + [ + _make_local_connection( + cls.address_1, + cls.public_key_1, + cls.node, + ) + ] ) cls.address_2 = "address_2" cls.public_key_2 = "public_key_2" cls.multiplexer2 = Multiplexer( - [_make_local_connection(cls.address_2, cls.public_key_2, cls.node,)] + [ + _make_local_connection( + cls.address_2, + cls.public_key_2, + cls.node, + ) + ] ) cls.multiplexer1.connect() cls.multiplexer2.connect() @@ -415,7 +441,13 @@ def setup_class(cls): cls.address_1 = "address_1" cls.public_key_1 = "public_key_1" cls.multiplexer1 = Multiplexer( - [_make_local_connection(cls.address_1, cls.public_key_1, cls.node,)] + [ + _make_local_connection( + cls.address_1, + cls.public_key_1, + cls.node, + ) + ] ) def role_from_first_message( # pylint: disable=unused-argument @@ -447,7 +479,9 @@ async def test_messages(self): ) with pytest.raises(ConnectionError): await _make_local_connection( - self.address_1, self.public_key_1, self.node, + self.address_1, + self.public_key_1, + self.node, ).send(envelope) self.multiplexer1.connect() @@ -456,7 +490,11 @@ async def test_messages(self): performative=FipaMessage.Performative.CFP, query=Query([Constraint("something", ConstraintType(">", 1))]), ) - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) self.multiplexer1.put(envelope) # check the result @@ -490,10 +528,22 @@ def setup_class(cls): cls.address_2 = "multiplexer2" cls.public_key_2 = "public_key_2" cls.multiplexer1 = Multiplexer( - [_make_local_connection(cls.address_1, cls.public_key_1, cls.node,)] + [ + _make_local_connection( + cls.address_1, + cls.public_key_1, + cls.node, + ) + ] ) cls.multiplexer2 = Multiplexer( - [_make_local_connection(cls.address_2, cls.public_key_2, cls.node,)] + [ + _make_local_connection( + cls.address_2, + cls.public_key_2, + cls.node, + ) + ] ) cls.multiplexer1.connect() cls.multiplexer2.connect() diff --git a/tests/test_packages/test_connections/test_p2p_libp2p/test_build.py b/tests/test_packages/test_connections/test_p2p_libp2p/test_build.py index 1e9ea372dc..3ef06c0916 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p/test_build.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p/test_build.py @@ -60,7 +60,9 @@ def test_check_versions_negative_binary_not_found(): def test_check_versions_negative_version_too_low(): """Test check_versions - negative case, version too low.""" with mock.patch.object( - check_dependencies, "get_version", return_value=(0, 0, 0), + check_dependencies, + "get_version", + return_value=(0, 0, 0), ): with pytest.raises( AEAException, diff --git a/tests/test_packages/test_connections/test_p2p_libp2p/test_communication.py b/tests/test_packages/test_connections/test_p2p_libp2p/test_communication.py index eb26df796d..5cc5960cd9 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p/test_communication.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p/test_communication.py @@ -176,7 +176,11 @@ def test_envelope_routed(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) self.multiplexer1.put(envelope) delivered_envelope = self.multiplexer2.get(block=True, timeout=20) @@ -205,7 +209,11 @@ def test_envelope_echoed_back(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - original_envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + original_envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) self.multiplexer1.put(original_envelope) delivered_envelope = self.multiplexer2.get(block=True, timeout=10) @@ -308,7 +316,9 @@ def test_star_routing_connectivity(self): content=b"hello", ) envelope = Envelope( - to=addrs[destination], sender=addrs[source], message=msg, + to=addrs[destination], + sender=addrs[source], + message=msg, ) self.multiplexers[source].put(envelope) @@ -370,7 +380,9 @@ def setup_class(cls): temp_dir_1 = os.path.join(cls.t, "temp_dir_1") os.mkdir(temp_dir_1) cls.connection1 = _make_libp2p_connection( - data_dir=temp_dir_1, relay=False, entry_peers=[relay_peer], + data_dir=temp_dir_1, + relay=False, + entry_peers=[relay_peer], ) cls.multiplexer1 = Multiplexer( [cls.connection1], protocols=[MockDefaultMessageProtocol] @@ -412,7 +424,11 @@ def test_envelope_routed(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) self.multiplexer1.put(envelope) delivered_envelope = self.multiplexer2.get(block=True, timeout=20) @@ -442,7 +458,11 @@ def test_envelope_echoed_back(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - original_envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + original_envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) self.multiplexer1.put(original_envelope) delivered_envelope = self.multiplexer2.get(block=True, timeout=10) @@ -524,7 +544,9 @@ def setup_class(cls): temp_dir = os.path.join(cls.t, f"temp_dir_conn_{i}_1") os.mkdir(temp_dir) conn = _make_libp2p_connection( - data_dir=temp_dir, relay=False, entry_peers=[relay_peer_1], + data_dir=temp_dir, + relay=False, + entry_peers=[relay_peer_1], ) mux = Multiplexer([conn]) cls.connections.append(conn) @@ -536,7 +558,9 @@ def setup_class(cls): temp_dir = os.path.join(cls.t, f"temp_dir_conn_{i}_2") os.mkdir(temp_dir) conn = _make_libp2p_connection( - data_dir=temp_dir, relay=False, entry_peers=[relay_peer_2], + data_dir=temp_dir, + relay=False, + entry_peers=[relay_peer_2], ) mux = Multiplexer([conn]) cls.connections.append(conn) @@ -570,7 +594,9 @@ def test_star_routing_connectivity(self): content=b"hello", ) envelope = Envelope( - to=addrs[destination], sender=addrs[source], message=msg, + to=addrs[destination], + sender=addrs[source], + message=msg, ) self.multiplexers[source].put(envelope) @@ -752,7 +778,11 @@ def test_envelope_routed(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) # make the send to fail # note: we don't mock the genesis peer. @@ -797,7 +827,11 @@ def test_envelope_routed(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) # make the receive to fail with mock.patch.object( diff --git a/tests/test_packages/test_connections/test_p2p_libp2p/test_integration.py b/tests/test_packages/test_connections/test_p2p_libp2p/test_integration.py index 04b63f14b2..45b28d43e9 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p/test_integration.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p/test_integration.py @@ -206,7 +206,11 @@ def send_message(self, from_name: str, to_name: str) -> None: performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=to_addr, sender=from_addr, message=msg,) + envelope = Envelope( + to=to_addr, + sender=from_addr, + message=msg, + ) from_multiplexer.put(envelope) diff --git a/tests/test_packages/test_connections/test_p2p_libp2p/test_public_dht.py b/tests/test_packages/test_connections/test_p2p_libp2p/test_public_dht.py index a6c27edc8c..b79f77c448 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p/test_public_dht.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p/test_public_dht.py @@ -119,7 +119,9 @@ def test_connectivity(self, maddrs): temp_dir = os.path.join(self.t, f"dir_{i}") os.mkdir(temp_dir) connection = _make_libp2p_connection( - relay=False, entry_peers=[maddr], data_dir=temp_dir, + relay=False, + entry_peers=[maddr], + data_dir=temp_dir, ) multiplexer = Multiplexer([connection]) self.log_files.append(connection.node.log_file) @@ -146,7 +148,9 @@ def test_communication_direct(self, maddrs): temp_dir_1 = os.path.join(self.t, f"dir_{i}_1") os.mkdir(temp_dir_1) connection1 = _make_libp2p_connection( - relay=False, entry_peers=[maddr], data_dir=temp_dir_1, + relay=False, + entry_peers=[maddr], + data_dir=temp_dir_1, ) multiplexer1 = Multiplexer([connection1]) self.log_files.append(connection1.node.log_file) @@ -156,7 +160,9 @@ def test_communication_direct(self, maddrs): temp_dir_2 = os.path.join(self.t, f"dir_{i}_2") os.mkdir(temp_dir_2) connection2 = _make_libp2p_connection( - relay=False, entry_peers=[maddr], data_dir=temp_dir_2, + relay=False, + entry_peers=[maddr], + data_dir=temp_dir_2, ) multiplexer2 = Multiplexer([connection2]) self.log_files.append(connection2.node.log_file) @@ -173,7 +179,11 @@ def test_communication_direct(self, maddrs): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) multiplexer1.put(envelope) delivered_envelope = multiplexer2.get(block=True, timeout=30) @@ -210,7 +220,9 @@ def test_communication_indirect(self, maddrs): temp_dir_1 = os.path.join(self.t, f"dir_{i}__") os.mkdir(temp_dir_1) connection1 = _make_libp2p_connection( - relay=False, entry_peers=[maddrs[i]], data_dir=temp_dir_1, + relay=False, + entry_peers=[maddrs[i]], + data_dir=temp_dir_1, ) multiplexer1 = Multiplexer([connection1]) self.log_files.append(connection1.node.log_file) @@ -225,7 +237,9 @@ def test_communication_indirect(self, maddrs): temp_dir_2 = os.path.join(self.t, f"dir_{i}_{j}") os.mkdir(temp_dir_2) connection2 = _make_libp2p_connection( - relay=False, entry_peers=[maddrs[j]], data_dir=temp_dir_2, + relay=False, + entry_peers=[maddrs[j]], + data_dir=temp_dir_2, ) multiplexer2 = Multiplexer([connection2]) self.log_files.append(connection2.node.log_file) @@ -241,7 +255,11 @@ def test_communication_indirect(self, maddrs): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) multiplexer1.put(envelope) delivered_envelope = multiplexer2.get(block=True, timeout=30) @@ -360,7 +378,11 @@ def test_communication_direct(self, delegate_uris_public_keys): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) multiplexer1.put(envelope) delivered_envelope = multiplexer2.get(block=True, timeout=20) @@ -435,7 +457,11 @@ def test_communication_indirect(self, delegate_uris_public_keys): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - envelope = Envelope(to=addr_2, sender=addr_1, message=msg,) + envelope = Envelope( + to=addr_2, + sender=addr_1, + message=msg, + ) multiplexer1.put(envelope) delivered_envelope = multiplexer2.get(block=True, timeout=20) diff --git a/tests/test_packages/test_connections/test_p2p_libp2p/test_slow_queue.py b/tests/test_packages/test_connections/test_p2p_libp2p/test_slow_queue.py index 34ac9ac228..4742ea2967 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p/test_slow_queue.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p/test_slow_queue.py @@ -119,7 +119,11 @@ def _make_envelope(addr): content=b"hello", ) - envelope = Envelope(to=addr, sender=self.conn.node.address, message=msg,) + envelope = Envelope( + to=addr, + sender=self.conn.node.address, + message=msg, + ) return envelope try: diff --git a/tests/test_packages/test_connections/test_p2p_libp2p_client/test_communication.py b/tests/test_packages/test_connections/test_p2p_libp2p_client/test_communication.py index 20fa704da1..264f51302b 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p_client/test_communication.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p_client/test_communication.py @@ -124,7 +124,9 @@ def setup_class(cls): temp_dir = os.path.join(cls.t, "temp_dir_node") os.mkdir(temp_dir) cls.connection_node = _make_libp2p_connection( - data_dir=temp_dir, delegate=True, delegate_port=cls.delegate_port, + data_dir=temp_dir, + delegate=True, + delegate_port=cls.delegate_port, ) cls.multiplexer_node = Multiplexer( [cls.connection_node], protocols=[MockDefaultMessageProtocol] @@ -310,7 +312,9 @@ def setup_class(cls): temp_dir_node_1 = os.path.join(cls.t, "temp_dir_node_1") os.mkdir(temp_dir_node_1) cls.connection_node_1 = _make_libp2p_connection( - data_dir=temp_dir_node_1, delegate_port=cls.ports[0], delegate=True, + data_dir=temp_dir_node_1, + delegate_port=cls.ports[0], + delegate=True, ) cls.multiplexer_node_1 = Multiplexer( [cls.connection_node_1], protocols=[MockDefaultMessageProtocol] @@ -518,7 +522,9 @@ def setup_class(cls): temp_dir_node_1 = os.path.join(cls.t, "temp_dir_node_1") os.mkdir(temp_dir_node_1) cls.connection_node_1 = _make_libp2p_connection( - data_dir=temp_dir_node_1, delegate_port=cls.ports[0], delegate=True, + data_dir=temp_dir_node_1, + delegate_port=cls.ports[0], + delegate=True, ) cls.multiplexer_node_1 = Multiplexer( [cls.connection_node_1], protocols=[MockDefaultMessageProtocol] @@ -664,7 +670,9 @@ def setup_class(cls): temp_dir = os.path.join(cls.t, "temp_dir_node") os.mkdir(temp_dir) cls.connection_node = _make_libp2p_connection( - data_dir=temp_dir, delegate=True, delegate_port=cls.delegate_port, + data_dir=temp_dir, + delegate=True, + delegate_port=cls.delegate_port, ) cls.multiplexer_node = Multiplexer( [cls.connection_node], protocols=[MockDefaultMessageProtocol] diff --git a/tests/test_packages/test_connections/test_p2p_libp2p_client/test_errors.py b/tests/test_packages/test_connections/test_p2p_libp2p_client/test_errors.py index a9189a2d67..aa7042a4a7 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p_client/test_errors.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p_client/test_errors.py @@ -120,7 +120,9 @@ def test_empty_nodes(self): ) with pytest.raises(Exception): P2PLibp2pClientConnection( - configuration=configuration, data_dir=self.t, identity=self.identity, + configuration=configuration, + data_dir=self.t, + identity=self.identity, ) @classmethod @@ -152,7 +154,9 @@ def setup_class(cls): os.mkdir(temp_node_dir) try: cls.connection_node = _make_libp2p_connection( - data_dir=temp_node_dir, delegate=True, delegate_port=cls.delegate_port, + data_dir=temp_node_dir, + delegate=True, + delegate_port=cls.delegate_port, ) cls.multiplexer_node = Multiplexer([cls.connection_node]) cls.log_files.append(cls.connection_node.node.log_file) @@ -291,7 +295,9 @@ def setup_class(cls): temp_dir = os.path.join(cls.t, "temp_dir_node") os.mkdir(temp_dir) cls.connection_node = _make_libp2p_connection( - data_dir=temp_dir, delegate_port=cls.delegate_port, delegate=True, + data_dir=temp_dir, + delegate_port=cls.delegate_port, + delegate=True, ) temp_dir_client = os.path.join(cls.t, "temp_dir_client") os.mkdir(temp_dir_client) diff --git a/tests/test_packages/test_connections/test_p2p_libp2p_mailbox/test_errors.py b/tests/test_packages/test_connections/test_p2p_libp2p_mailbox/test_errors.py index 3861841ac5..f540b4808a 100644 --- a/tests/test_packages/test_connections/test_p2p_libp2p_mailbox/test_errors.py +++ b/tests/test_packages/test_connections/test_p2p_libp2p_mailbox/test_errors.py @@ -119,7 +119,9 @@ def test_empty_nodes(self): ) with pytest.raises(Exception): P2PLibp2pMailboxConnection( - configuration=configuration, data_dir=self.t, identity=self.identity, + configuration=configuration, + data_dir=self.t, + identity=self.identity, ) @classmethod diff --git a/tests/test_packages/test_connections/test_stub/test_stub.py b/tests/test_packages/test_connections/test_stub/test_stub.py index 2f50bc0fcd..9b548d1ace 100644 --- a/tests/test_packages/test_connections/test_stub/test_stub.py +++ b/tests/test_packages/test_connections/test_stub/test_stub.py @@ -61,7 +61,11 @@ def make_test_envelope() -> Envelope: content=b"hello", ) msg.to = "any" - envelope = Envelope(to="any", sender="any", message=msg,) + envelope = Envelope( + to="any", + sender="any", + message=msg, + ) return envelope @@ -93,7 +97,11 @@ def test_reception_a(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - expected_envelope = Envelope(to="any", sender="anys", message=msg,) + expected_envelope = Envelope( + to="any", + sender="anys", + message=msg, + ) with open(self.input_file_path, "ab+") as f: write_envelope(expected_envelope, f) @@ -219,7 +227,11 @@ def test_send_message(self): performative=DefaultMessage.Performative.BYTES, content=b"hello", ) - expected_envelope = Envelope(to="any", sender="anys", message=msg,) + expected_envelope = Envelope( + to="any", + sender="anys", + message=msg, + ) self.multiplexer.put(expected_envelope) time.sleep(0.1) diff --git a/tests/test_packages/test_contracts/test_erc1155/test_contract.py b/tests/test_packages/test_contracts/test_erc1155/test_contract.py index 6bf6f38c12..458ee66773 100644 --- a/tests/test_packages/test_contracts/test_erc1155/test_contract.py +++ b/tests/test_packages/test_contracts/test_erc1155/test_contract.py @@ -193,14 +193,16 @@ def test_validate_mint_quantities(self): """Test the validate_mint_quantities method of the ERC1155 contract.""" # Valid NFTs self.contract.validate_mint_quantities( - token_ids=self.token_ids_a, mint_quantities=[1] * len(self.token_ids_a), + token_ids=self.token_ids_a, + mint_quantities=[1] * len(self.token_ids_a), ) # Valid FTs token_id = 680564733841876926926749214863536422912 mint_quantity = 1 self.contract.validate_mint_quantities( - token_ids=[token_id], mint_quantities=[mint_quantity], + token_ids=[token_id], + mint_quantities=[mint_quantity], ) # Invalid NFTs @@ -213,7 +215,8 @@ def test_validate_mint_quantities(self): ), ): self.contract.validate_mint_quantities( - token_ids=[token_id], mint_quantities=[mint_quantity], + token_ids=[token_id], + mint_quantities=[mint_quantity], ) # Invalid: neither NFT nor FT @@ -226,7 +229,8 @@ def test_validate_mint_quantities(self): ), ): self.contract.validate_mint_quantities( - token_ids=[token_id], mint_quantities=[mint_quantity], + token_ids=[token_id], + mint_quantities=[mint_quantity], ) def test_decode_id(self): diff --git a/tests/test_packages/test_protocols/test_acn.py b/tests/test_packages/test_protocols/test_acn.py index 7f06601e38..7c2da5a563 100644 --- a/tests/test_packages/test_protocols/test_acn.py +++ b/tests/test_packages/test_protocols/test_acn.py @@ -145,7 +145,8 @@ def test_acn_message_str_values(): def test_encoding_unknown_performative(): """Test that we raise an exception when the performative is unknown during encoding.""" msg = AcnMessage( - performative=AcnMessage.Performative.LOOKUP_REQUEST, agent_address="address", + performative=AcnMessage.Performative.LOOKUP_REQUEST, + agent_address="address", ) with pytest.raises(ValueError, match="Performative not valid:"): diff --git a/tests/test_packages/test_protocols/test_contract_api.py b/tests/test_packages/test_protocols/test_contract_api.py index 8e337e618d..1616f90e26 100644 --- a/tests/test_packages/test_protocols/test_contract_api.py +++ b/tests/test_packages/test_protocols/test_contract_api.py @@ -65,7 +65,11 @@ def test_get_deploy_transaction_serialization(): kwargs=kwargs_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -100,7 +104,11 @@ def test_get_raw_transaction_serialization(): kwargs=kwargs_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -135,7 +143,11 @@ def test_get_raw_message_serialization(): kwargs=kwargs_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -170,7 +182,11 @@ def test_get_state_serialization(): kwargs=kwargs_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -201,7 +217,11 @@ def test_state_serialization(): state=state_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -233,7 +253,11 @@ def test_raw_transaction_serialization(): raw_transaction=raw_transaction_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -261,7 +285,11 @@ def test_raw_message_serialization(): raw_message=raw_message_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -290,7 +318,11 @@ def test_error_serialization(): data=b"some_error_data", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) diff --git a/tests/test_packages/test_protocols/test_fipa.py b/tests/test_packages/test_protocols/test_fipa.py index cbf91c8fd0..1ca1b4407f 100644 --- a/tests/test_packages/test_protocols/test_fipa.py +++ b/tests/test_packages/test_protocols/test_fipa.py @@ -59,7 +59,11 @@ def test_cfp_serialization(): query=Query([Constraint("something", ConstraintType(">", 1))]), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -89,7 +93,11 @@ def test_propose_serialization(): proposal=Description({"foo1": 1, "bar1": 2}), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -118,7 +126,11 @@ def test_accept_serialization(): performative=FipaMessage.Performative.ACCEPT, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -147,7 +159,11 @@ def test_decline_serialization(): performative=FipaMessage.Performative.DECLINE, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -176,7 +192,11 @@ def test_match_accept_serialization(): performative=FipaMessage.Performative.MATCH_ACCEPT, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -206,7 +226,11 @@ def test_accept_with_inform_serialization(): info={"address": "dummy_address"}, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -236,7 +260,11 @@ def test_match_accept_with_inform_serialization(): info={"address": "dummy_address", "signature": "my_signature"}, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -266,7 +294,11 @@ def test_inform_serialization(): info={"foo": "bar"}, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -295,7 +327,11 @@ def test_end_serialization(): performative=FipaMessage.Performative.END, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -343,7 +379,9 @@ def test_performative_string_value(): def test_encoding_unknown_performative(): """Test that we raise an exception when the performative is unknown during encoding.""" - msg = FipaMessage(performative=FipaMessage.Performative.ACCEPT,) + msg = FipaMessage( + performative=FipaMessage.Performative.ACCEPT, + ) with pytest.raises(ValueError, match="Performative not valid:"): with mock.patch.object(FipaMessage.Performative, "__eq__", return_value=False): @@ -352,7 +390,9 @@ def test_encoding_unknown_performative(): def test_decoding_unknown_performative(): """Test that we raise an exception when the performative is unknown during decoding.""" - msg = FipaMessage(performative=FipaMessage.Performative.ACCEPT,) + msg = FipaMessage( + performative=FipaMessage.Performative.ACCEPT, + ) encoded_msg = FipaMessage.serializer.encode(msg) with pytest.raises(ValueError, match="Performative not valid:"): diff --git a/tests/test_packages/test_protocols/test_gym.py b/tests/test_packages/test_protocols/test_gym.py index bcc90d1990..a7a9379cf6 100644 --- a/tests/test_packages/test_protocols/test_gym.py +++ b/tests/test_packages/test_protocols/test_gym.py @@ -55,7 +55,11 @@ def test_act_serialization(): step_id=1, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -89,7 +93,11 @@ def test_percept_serialization(): info=GymMessage.AnyObject("some_info"), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -123,7 +131,11 @@ def test_status_serialization(): content=content_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -152,7 +164,11 @@ def test_reset_serialization(): performative=GymMessage.Performative.RESET, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -181,7 +197,11 @@ def test_close_serialization(): performative=GymMessage.Performative.CLOSE, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) diff --git a/tests/test_packages/test_protocols/test_http.py b/tests/test_packages/test_protocols/test_http.py index 2f919f2adf..152b4a5d1a 100644 --- a/tests/test_packages/test_protocols/test_http.py +++ b/tests/test_packages/test_protocols/test_http.py @@ -57,7 +57,11 @@ def test_request_serialization(): body=b"some_body", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -90,7 +94,11 @@ def test_response_serialization(): body=b"some_body", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) diff --git a/tests/test_packages/test_protocols/test_ledger_api.py b/tests/test_packages/test_protocols/test_ledger_api.py index 44766861f3..e49b4156ca 100644 --- a/tests/test_packages/test_protocols/test_ledger_api.py +++ b/tests/test_packages/test_protocols/test_ledger_api.py @@ -59,7 +59,11 @@ def test_get_balance_serialization(): address="some_address", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -95,7 +99,11 @@ def test_get_state_serialization(): kwargs=kwargs, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -135,7 +143,11 @@ def test_get_raw_transaction_serialization(): terms=terms_arg, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -166,7 +178,11 @@ def test_send_signed_transaction_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -197,7 +213,11 @@ def test_get_transaction_receipt_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -227,7 +247,11 @@ def test_balance_serialization(): balance=125, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -261,7 +285,11 @@ def test_state_serialization(): state=state, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -292,7 +320,11 @@ def test_raw_transaction_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -323,7 +355,11 @@ def test_transaction_digest_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -354,7 +390,11 @@ def test_transaction_receipt_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -383,7 +423,11 @@ def test_error_serialization(): data=b"some_error_data", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) diff --git a/tests/test_packages/test_protocols/test_oef_search.py b/tests/test_packages/test_protocols/test_oef_search.py index 4bb242e834..702f4769c2 100644 --- a/tests/test_packages/test_protocols/test_oef_search.py +++ b/tests/test_packages/test_protocols/test_oef_search.py @@ -57,7 +57,11 @@ def test_register_service_serialization(): service_description=Description({"foo1": 1, "bar1": 2}), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -86,7 +90,11 @@ def test_unregister_service_serialization(): service_description=Description({"foo1": 1, "bar1": 2}), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -113,7 +121,11 @@ def test_search_services_serialization(): query=Query([Constraint("something", ConstraintType(">", 1))]), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -146,7 +158,11 @@ def test_search_result_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -178,7 +194,11 @@ def test_success_serialization(): ), ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -205,7 +225,11 @@ def test_oef_error_serialization(): oef_error_operation=OefSearchMessage.OefErrorOperation.OTHER, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) diff --git a/tests/test_packages/test_protocols/test_signing.py b/tests/test_packages/test_protocols/test_signing.py index 8860bf981f..61d28ea04b 100644 --- a/tests/test_packages/test_protocols/test_signing.py +++ b/tests/test_packages/test_protocols/test_signing.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -131,7 +131,9 @@ def test_error_message(self): def test_consistency_check_negative(): """Test the consistency check, negative case.""" - tx_msg = SigningMessage(performative=SigningMessage.Performative.SIGN_TRANSACTION,) + tx_msg = SigningMessage( + performative=SigningMessage.Performative.SIGN_TRANSACTION, + ) assert not tx_msg._is_consistent() diff --git a/tests/test_packages/test_protocols/test_state_update.py b/tests/test_packages/test_protocols/test_state_update.py index 7646d838f2..a1a0f398d8 100644 --- a/tests/test_packages/test_protocols/test_state_update.py +++ b/tests/test_packages/test_protocols/test_state_update.py @@ -63,7 +63,9 @@ def test_message_consistency(self): ) assert stum._is_consistent() assert len(stum.valid_performatives) == 3 - stum = StateUpdateMessage(performative=StateUpdateMessage.Performative.END,) + stum = StateUpdateMessage( + performative=StateUpdateMessage.Performative.END, + ) assert stum._is_consistent() def test_message_inconsistency(self): @@ -120,7 +122,9 @@ def test_serialization_apply(self): def test_serialization_end(self): """Test serialization of end message.""" - msg = StateUpdateMessage(performative=StateUpdateMessage.Performative.END,) + msg = StateUpdateMessage( + performative=StateUpdateMessage.Performative.END, + ) assert msg._is_consistent() assert len(msg.valid_performatives) == 3 encoded_msg = msg.serializer.encode(msg) diff --git a/tests/test_packages/test_protocols/test_tac.py b/tests/test_packages/test_protocols/test_tac.py index 9bb065a7c4..e626760f48 100644 --- a/tests/test_packages/test_protocols/test_tac.py +++ b/tests/test_packages/test_protocols/test_tac.py @@ -93,10 +93,15 @@ def test_tac_message_instantiation(): def test_register_serialization(): """Test the serialization for 'register' speech-act works.""" msg = TacMessage( - performative=TacMessage.Performative.REGISTER, agent_name="some_agent_name", + performative=TacMessage.Performative.REGISTER, + agent_name="some_agent_name", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -119,10 +124,16 @@ def test_register_serialization(): def test_unregister_serialization(): """Test the serialization for 'unregister' speech-act works.""" msg = TacMessage( - message_id=2, target=1, performative=TacMessage.Performative.UNREGISTER, + message_id=2, + target=1, + performative=TacMessage.Performative.UNREGISTER, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -158,7 +169,11 @@ def test_transaction_serialization(): counterparty_signature="some_counterparty_signature", ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -180,9 +195,15 @@ def test_transaction_serialization(): def test_cancelled_serialization(): """Test the serialization for 'cancelled' speech-act works.""" - msg = TacMessage(performative=TacMessage.Performative.CANCELLED,) + msg = TacMessage( + performative=TacMessage.Performative.CANCELLED, + ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -218,7 +239,11 @@ def test_game_data_serialization(): info={"key_1": "value_1", "key_2": "value_2"}, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -247,7 +272,11 @@ def test_transaction_confirmation_serialization(): quantities_by_good_id={"key_1": 1, "key_2": 2}, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -275,7 +304,11 @@ def test_tac_error_serialization(): info={"key_1": "value_1", "key_2": "value_2"}, ) msg.to = "receiver" - envelope = Envelope(to=msg.to, sender="sender", message=msg,) + envelope = Envelope( + to=msg.to, + sender="sender", + message=msg, + ) envelope_bytes = envelope.encode() actual_envelope = Envelope.decode(envelope_bytes) @@ -360,7 +393,9 @@ def test_error_code_to_msg(): def test_encoding_unknown_performative(): """Test that we raise an exception when the performative is unknown during encoding.""" - msg = TacMessage(performative=TacMessage.Performative.CANCELLED,) + msg = TacMessage( + performative=TacMessage.Performative.CANCELLED, + ) with pytest.raises(ValueError, match="Performative not valid:"): with mock.patch.object(TacMessage.Performative, "__eq__", return_value=False): @@ -369,7 +404,9 @@ def test_encoding_unknown_performative(): def test_decoding_unknown_performative(): """Test that we raise an exception when the performative is unknown during decoding.""" - msg = TacMessage(performative=TacMessage.Performative.CANCELLED,) + msg = TacMessage( + performative=TacMessage.Performative.CANCELLED, + ) encoded_msg = TacMessage.serializer.encode(msg) with pytest.raises(ValueError, match="Performative not valid:"): @@ -385,7 +422,9 @@ def test_decoding_unknown_performative(): def test_incorrect_message(mocked_enforce): """Test that we raise an exception when the message is incorrect.""" with mock.patch.object(tac_message_logger, "error") as mock_logger: - TacMessage(performative=TacMessage.Performative.CANCELLED,) + TacMessage( + performative=TacMessage.Performative.CANCELLED, + ) mock_logger.assert_any_call("some error") diff --git a/tests/test_packages/test_protocols/test_tendermint.py b/tests/test_packages/test_protocols/test_tendermint.py index b35eb7f97b..a1cd71f93f 100644 --- a/tests/test_packages/test_protocols/test_tendermint.py +++ b/tests/test_packages/test_protocols/test_tendermint.py @@ -69,7 +69,8 @@ def test_performative_name_value_matching(): @pytest.mark.parametrize( - "performative, kwargs", zip(PERFORMATIVE, PERFORMATIVE_TEST_KWARGS), + "performative, kwargs", + zip(PERFORMATIVE, PERFORMATIVE_TEST_KWARGS), ) def test_serialization(performative, kwargs): """Test that the serialization for the 'tendermint' protocol works.""" diff --git a/tests/test_packages/test_skills/test_echo/test_handlers.py b/tests/test_packages/test_skills/test_echo/test_handlers.py index ca3a39f343..bd95293206 100644 --- a/tests/test_packages/test_skills/test_echo/test_handlers.py +++ b/tests/test_packages/test_skills/test_echo/test_handlers.py @@ -93,7 +93,8 @@ def test_handle_error(self): """Test the _handle_error method of the oef_search handler.""" # setup default_dialogue = self.prepare_skill_dialogue( - dialogues=self.default_dialogues, messages=self.list_of_messages[:1], + dialogues=self.default_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=default_dialogue, @@ -117,7 +118,8 @@ def test_handle_bytes(self): """Test the _handle_error method of the oef_search handler.""" # setup default_dialogue = self.prepare_skill_dialogue( - dialogues=self.default_dialogues, messages=self.list_of_messages[:1], + dialogues=self.default_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = cast( DefaultMessage, @@ -156,12 +158,14 @@ def test_handle_invalid(self): """Test the _handle_invalid method of the echo handler.""" # setup default_dialogue = self.prepare_skill_dialogue( - dialogues=self.default_dialogues, messages=self.list_of_messages[:1], + dialogues=self.default_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = cast( DefaultMessage, self.build_incoming_message_for_skill_dialogue( - dialogue=default_dialogue, performative=DefaultMessage.Performative.END, + dialogue=default_dialogue, + performative=DefaultMessage.Performative.END, ), ) diff --git a/tests/test_packages/test_skills/test_erc1155_client/test_handlers.py b/tests/test_packages/test_skills/test_erc1155_client/test_handlers.py index 7cfe606f60..d722e25f69 100644 --- a/tests/test_packages/test_skills/test_erc1155_client/test_handlers.py +++ b/tests/test_packages/test_skills/test_erc1155_client/test_handlers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -74,7 +74,8 @@ def test_handle_unidentified_dialogue(self): # after mock_logger.assert_any_call( - logging.INFO, f"unidentified dialogue for message={incoming_message}.", + logging.INFO, + f"unidentified dialogue for message={incoming_message}.", ) self.assert_quantity_in_outbox(1) @@ -96,7 +97,8 @@ def test_handle_propose_i(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_fipa_messages[:1], + dialogues=self.fipa_dialogues, + messages=self.list_of_fipa_messages[:1], ), ) incoming_message = cast( @@ -166,7 +168,8 @@ def test_handle_propose_i(self): assert contract_api_dialogue.associated_fipa_dialogue == fipa_dialogue mock_logger.assert_any_call( - logging.INFO, "requesting single hash message from contract api...", + logging.INFO, + "requesting single hash message from contract api...", ) def test_handle_propose_ii(self): @@ -177,7 +180,8 @@ def test_handle_propose_ii(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_fipa_messages[:1], + dialogues=self.fipa_dialogues, + messages=self.list_of_fipa_messages[:1], ), ) incoming_message = cast( @@ -205,13 +209,15 @@ def test_handle_invalid(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_fipa_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_fipa_messages[:2], ), ) incoming_message = cast( FipaMessage, self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.ACCEPT, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.ACCEPT, ), ) @@ -598,7 +604,9 @@ def test_handle_unidentified_dialogue(self): f"received invalid signing message={incoming_message}, unidentified dialogue.", ) - def test_handle_signed_message(self,): + def test_handle_signed_message( + self, + ): """Test the _handle_signed_message method of the signing handler.""" # setup signing_counterparty = self.skill.skill_context.decision_maker_address @@ -636,7 +644,8 @@ def test_handle_signed_message(self,): dialogue=signing_dialogue, performative=SigningMessage.Performative.SIGNED_MESSAGE, signed_message=SigningMessage.SignedMessage( - self.ledger_id, "some_body", + self.ledger_id, + "some_body", ), ), ) diff --git a/tests/test_packages/test_skills/test_erc1155_client/test_strategy.py b/tests/test_packages/test_skills/test_erc1155_client/test_strategy.py index 2a9e83365c..9cf203f1c5 100644 --- a/tests/test_packages/test_skills/test_erc1155_client/test_strategy.py +++ b/tests/test_packages/test_skills/test_erc1155_client/test_strategy.py @@ -58,7 +58,8 @@ def test_get_location_and_service_query(self): service_key_constraint = Constraint( self.search_query["search_key"], ConstraintType( - self.search_query["constraint_type"], self.search_query["search_value"], + self.search_query["constraint_type"], + self.search_query["search_value"], ), ) assert query.constraints[1] == service_key_constraint @@ -75,7 +76,8 @@ def test_get_service_query(self): service_key_constraint = Constraint( self.search_query["search_key"], ConstraintType( - self.search_query["constraint_type"], self.search_query["search_value"], + self.search_query["constraint_type"], + self.search_query["search_value"], ), ) assert query.constraints[0] == service_key_constraint diff --git a/tests/test_packages/test_skills/test_erc1155_deploy/test_handlers.py b/tests/test_packages/test_skills/test_erc1155_deploy/test_handlers.py index 05e2550e36..aefaa3e555 100644 --- a/tests/test_packages/test_skills/test_erc1155_deploy/test_handlers.py +++ b/tests/test_packages/test_skills/test_erc1155_deploy/test_handlers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,7 +75,8 @@ def test_handle_unidentified_dialogue(self): # after mock_logger.assert_any_call( - logging.INFO, f"unidentified dialogue for message={incoming_message}.", + logging.INFO, + f"unidentified dialogue for message={incoming_message}.", ) self.assert_quantity_in_outbox(1) @@ -114,7 +115,8 @@ def test_handle_cfp_i(self): # after mock_logger.assert_any_call( - logging.INFO, f"received CFP from sender={COUNTERPARTY_AGENT_ADDRESS[-5:]}", + logging.INFO, + f"received CFP from sender={COUNTERPARTY_AGENT_ADDRESS[-5:]}", ) mock_prop.assert_called_once() @@ -156,11 +158,13 @@ def test_handle_cfp_ii(self): # after mock_logger.assert_any_call( - logging.INFO, f"received CFP from sender={COUNTERPARTY_AGENT_ADDRESS[-5:]}", + logging.INFO, + f"received CFP from sender={COUNTERPARTY_AGENT_ADDRESS[-5:]}", ) mock_logger.assert_any_call( - logging.INFO, "Contract items not minted yet. Try again later.", + logging.INFO, + "Contract items not minted yet. Try again later.", ) self.assert_quantity_in_outbox(0) @@ -173,7 +177,8 @@ def test_handle_accept_w_inform_i(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_fipa_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_fipa_messages[:2], ), ) fipa_dialogue.proposal = self.mocked_proposal @@ -233,7 +238,8 @@ def test_handle_accept_w_inform_i(self): assert contract_api_dialogue.terms == self.mocked_terms mock_logger.assert_any_call( - logging.INFO, "requesting single atomic swap transaction...", + logging.INFO, + "requesting single atomic swap transaction...", ) def test_handle_accept_w_inform_ii(self): @@ -243,7 +249,8 @@ def test_handle_accept_w_inform_ii(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_fipa_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_fipa_messages[:2], ), ) fipa_dialogue.proposal = self.mocked_proposal @@ -272,13 +279,15 @@ def test_handle_invalid(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_fipa_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_fipa_messages[:2], ), ) incoming_message = cast( FipaMessage, self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.ACCEPT, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.ACCEPT, ), ) @@ -407,7 +416,8 @@ def test_handle_transaction_digest(self): assert has_attributes, error_str mock_logger.assert_any_call( - logging.INFO, "requesting transaction receipt.", + logging.INFO, + "requesting transaction receipt.", ) def test_handle_transaction_receipt_i(self): @@ -837,7 +847,9 @@ def test_handle_unidentified_dialogue(self): f"received invalid signing message={incoming_message}, unidentified dialogue.", ) - def test_handle_signed_transaction(self,): + def test_handle_signed_transaction( + self, + ): """Test the _handle_signed_transaction method of the signing handler.""" # setup signing_dialogue = cast( @@ -1021,7 +1033,8 @@ def test_handle_success_i(self): # operation with patch.object(self.oef_search_handler.context.logger, "log") as mock_logger: with patch.object( - self.registration_behaviour, "register_service", + self.registration_behaviour, + "register_service", ) as mock_reg: self.oef_search_handler.handle(incoming_message) @@ -1048,7 +1061,8 @@ def test_handle_success_ii(self): # operation with patch.object(self.oef_search_handler.context.logger, "log") as mock_logger: with patch.object( - self.registration_behaviour, "register_genus", + self.registration_behaviour, + "register_genus", ) as mock_reg: self.oef_search_handler.handle(incoming_message) @@ -1075,7 +1089,8 @@ def test_handle_success_iii(self): # operation with patch.object(self.oef_search_handler.context.logger, "log") as mock_logger: with patch.object( - self.registration_behaviour, "register_classification", + self.registration_behaviour, + "register_classification", ) as mock_reg: self.oef_search_handler.handle(incoming_message) diff --git a/tests/test_packages/test_skills/test_generic_buyer/test_behaviours.py b/tests/test_packages/test_skills/test_generic_buyer/test_behaviours.py index 13feee910f..e757482507 100644 --- a/tests/test_packages/test_skills/test_generic_buyer/test_behaviours.py +++ b/tests/test_packages/test_skills/test_generic_buyer/test_behaviours.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -234,7 +234,8 @@ def _setup_fipa_ledger_api_dialogues( fipa_dialogue = cast( FipaDialogue, self_.prepare_skill_dialogue( - dialogues=self_.fipa_dialogues, messages=self_.list_of_messages, + dialogues=self_.fipa_dialogues, + messages=self_.list_of_messages, ), ) fipa_dialogue.terms = "terms" # type: ignore diff --git a/tests/test_packages/test_skills/test_generic_buyer/test_handlers.py b/tests/test_packages/test_skills/test_generic_buyer/test_handlers.py index 606892cb95..10d57b512e 100644 --- a/tests/test_packages/test_skills/test_generic_buyer/test_handlers.py +++ b/tests/test_packages/test_skills/test_generic_buyer/test_handlers.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -149,7 +149,8 @@ def test_handle_propose_is_affordable_and_is_acceptable(self): } ) fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:1], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=fipa_dialogue, @@ -159,10 +160,14 @@ def test_handle_propose_is_affordable_and_is_acceptable(self): # operation with patch.object( - self.strategy, "is_acceptable_proposal", return_value=True, + self.strategy, + "is_acceptable_proposal", + return_value=True, ): with patch.object( - self.strategy, "is_affordable_proposal", return_value=True, + self.strategy, + "is_affordable_proposal", + return_value=True, ): with patch.object( self.fipa_handler.context.logger, "log" @@ -205,7 +210,8 @@ def test_handle_propose_not_is_affordable_or_not_is_acceptable(self): } ) fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:1], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=fipa_dialogue, @@ -215,10 +221,14 @@ def test_handle_propose_not_is_affordable_or_not_is_acceptable(self): # operation with patch.object( - self.strategy, "is_acceptable_proposal", return_value=False, + self.strategy, + "is_acceptable_proposal", + return_value=False, ): with patch.object( - self.strategy, "is_affordable_proposal", return_value=False, + self.strategy, + "is_affordable_proposal", + return_value=False, ): with patch.object( self.fipa_handler.context.logger, "log" @@ -251,10 +261,12 @@ def test_handle_decline_decline_cfp(self): """Test the _handle_decline method of the fipa handler where the end state is decline_cfp.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:1], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.DECLINE, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.DECLINE, ) # before @@ -294,10 +306,12 @@ def test_handle_decline_decline_accept(self): """Test the _handle_decline method of the fipa handler where the end state is decline_accept.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:3], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:3], ) incoming_message = self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.DECLINE, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.DECLINE, ) # before @@ -335,7 +349,8 @@ def test_handle_match_accept_is_ledger_tx(self): self.strategy._is_ledger_tx = True fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:3], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:3], ) fipa_dialogue.terms = Terms( "some_ledger_id", @@ -389,7 +404,8 @@ def test_handle_match_accept_not_is_ledger_tx(self): self.strategy._is_ledger_tx = False fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:3], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:3], ) incoming_message = cast( FipaMessage, @@ -431,7 +447,8 @@ def test_handle_inform_with_data(self): """Test the _handle_inform method of the fipa handler where info has data.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:4], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:4], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=fipa_dialogue, @@ -475,7 +492,8 @@ def test_handle_inform_without_data(self): """Test the _handle_inform method of the fipa handler where info has NO data.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:4], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:4], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=fipa_dialogue, @@ -502,10 +520,12 @@ def test_handle_invalid(self): """Test the _handle_invalid method of the fipa handler.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:2], ) incoming_message = self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.ACCEPT, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.ACCEPT, ) # operation @@ -576,7 +596,8 @@ def test_handle_error(self): """Test the _handle_error method of the oef_search handler.""" # setup oef_dialogue = self.prepare_skill_dialogue( - dialogues=self.oef_dialogues, messages=self.list_of_messages[:1], + dialogues=self.oef_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=oef_dialogue, @@ -598,7 +619,8 @@ def test_handle_search_zero_agents(self): """Test the _handle_search method of the oef_search handler.""" # setup oef_dialogue = self.prepare_skill_dialogue( - dialogues=self.oef_dialogues, messages=self.list_of_messages[:1], + dialogues=self.oef_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=oef_dialogue, @@ -625,7 +647,8 @@ def test_handle_search_i(self): self.strategy._is_searching = True oef_dialogue = self.prepare_skill_dialogue( - dialogues=self.oef_dialogues, messages=self.list_of_messages[:1], + dialogues=self.oef_dialogues, + messages=self.list_of_messages[:1], ) agents = ("agnt1", "agnt2") incoming_message = self.build_incoming_message_for_skill_dialogue( @@ -670,7 +693,8 @@ def test_handle_search_ii(self): self.strategy._is_searching = True oef_dialogue = self.prepare_skill_dialogue( - dialogues=self.oef_dialogues, messages=self.list_of_messages[:1], + dialogues=self.oef_dialogues, + messages=self.list_of_messages[:1], ) agents = ("agnt1", "agnt2") incoming_message = self.build_incoming_message_for_skill_dialogue( @@ -710,7 +734,8 @@ def test_handle_search_more_than_max_negotiation(self): # setup self.strategy._max_negotiations = 1 oef_dialogue = self.prepare_skill_dialogue( - dialogues=self.oef_dialogues, messages=self.list_of_messages[:1], + dialogues=self.oef_dialogues, + messages=self.list_of_messages[:1], ) agents = ("agnt1", "agnt2") incoming_message = self.build_incoming_message_for_skill_dialogue( @@ -867,7 +892,9 @@ def test_handle_unidentified_dialogue(self): f"received invalid signing message={incoming_message}, unidentified dialogue.", ) - def test_handle_signed_transaction_last_ledger_api_message_is_none(self,): + def test_handle_signed_transaction_last_ledger_api_message_is_none( + self, + ): """Test the _handle_signed_transaction method of the signing handler.""" # setup signing_dialogue = cast( @@ -906,7 +933,9 @@ def test_handle_signed_transaction_last_ledger_api_message_is_none(self,): # after mock_logger.assert_any_call(logging.INFO, "transaction signing was successful.") - def test_handle_signed_transaction_last_ledger_api_message_is_not_none(self,): + def test_handle_signed_transaction_last_ledger_api_message_is_not_none( + self, + ): """Test the _handle_signed_transaction method of the signing handler where the last ledger_api message is not None.""" # setup signing_counterparty = self.skill.skill_context.decision_maker_address @@ -1345,7 +1374,8 @@ def test_handle_transaction_digest(self): assert has_attributes, error_str mock_logger.assert_any_call( - logging.INFO, "checking transaction is settled.", + logging.INFO, + "checking transaction is settled.", ) def test_handle_transaction_receipt_i(self): diff --git a/tests/test_packages/test_skills/test_generic_buyer/test_models.py b/tests/test_packages/test_skills/test_generic_buyer/test_models.py index f506968121..7095f38d98 100644 --- a/tests/test_packages/test_skills/test_generic_buyer/test_models.py +++ b/tests/test_packages/test_skills/test_generic_buyer/test_models.py @@ -110,7 +110,8 @@ def test_get_location_and_service_query(self): service_key_constraint = Constraint( self.search_query["search_key"], ConstraintType( - self.search_query["constraint_type"], self.search_query["search_value"], + self.search_query["constraint_type"], + self.search_query["search_value"], ), ) assert query.constraints[1] == service_key_constraint @@ -127,7 +128,8 @@ def test_get_service_query(self): service_key_constraint = Constraint( self.search_query["search_key"], ConstraintType( - self.search_query["constraint_type"], self.search_query["search_value"], + self.search_query["constraint_type"], + self.search_query["search_value"], ), ) assert query.constraints[0] == service_key_constraint diff --git a/tests/test_packages/test_skills/test_generic_seller/test_handlers.py b/tests/test_packages/test_skills/test_generic_seller/test_handlers.py index b5ef6f39aa..0f5253387d 100644 --- a/tests/test_packages/test_skills/test_generic_seller/test_handlers.py +++ b/tests/test_packages/test_skills/test_generic_seller/test_handlers.py @@ -154,7 +154,9 @@ def test_handle_cfp_is_matching_supply(self): # operation with patch.object( - self.strategy, "is_matching_supply", return_value=True, + self.strategy, + "is_matching_supply", + return_value=True, ): with patch.object( self.strategy, @@ -228,10 +230,12 @@ def test_handle_decline(self): """Test the _handle_decline method of the fipa handler.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:2], ) incoming_message = self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.DECLINE, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.DECLINE, ) # before @@ -273,7 +277,8 @@ def test_handle_accept(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:2], ), ) fipa_dialogue.terms = Terms( @@ -285,7 +290,8 @@ def test_handle_accept(self): "some_nonce", ) incoming_message = self.build_incoming_message_for_skill_dialogue( - dialogue=fipa_dialogue, performative=FipaMessage.Performative.ACCEPT, + dialogue=fipa_dialogue, + performative=FipaMessage.Performative.ACCEPT, ) info = {"address": fipa_dialogue.terms.sender_address} @@ -322,7 +328,8 @@ def test_handle_inform_is_ledger_tx_and_with_tx_digest(self): ledger_id = "some_ledger_id" fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:4], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:4], ) fipa_dialogue.terms = Terms( ledger_id, @@ -371,7 +378,8 @@ def test_handle_inform_is_ledger_tx_and_no_tx_digest(self): self.strategy._is_ledger_tx = True fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:4], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:4], ) fipa_dialogue.terms = Terms( "some_ledger_id", @@ -413,7 +421,8 @@ def test_handle_inform_not_is_ledger_tx_and_with_done(self): fipa_dialogue = cast( FipaDialogue, self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:4], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:4], ), ) fipa_dialogue.data_for_sale = data @@ -482,7 +491,8 @@ def test_handle_inform_not_is_ledger_tx_and_nothin_in_info(self): self.strategy._is_ledger_tx = False fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:4], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:4], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=fipa_dialogue, @@ -508,7 +518,8 @@ def test_handle_invalid(self): """Test the _handle_invalid method of the fipa handler.""" # setup fipa_dialogue = self.prepare_skill_dialogue( - dialogues=self.fipa_dialogues, messages=self.list_of_messages[:2], + dialogues=self.fipa_dialogues, + messages=self.list_of_messages[:2], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=fipa_dialogue, @@ -794,7 +805,9 @@ def test_handle_transaction_receipt_is_settled_and_is_valid(self): f"transaction confirmed, sending data={fipa_dialogue.data_for_sale} to buyer={COUNTERPARTY_AGENT_ADDRESS[-5:]}.", ) - def test_handle_transaction_receipt_not_is_settled_or_not_is_valid(self,): + def test_handle_transaction_receipt_not_is_settled_or_not_is_valid( + self, + ): """Test the _handle_transaction_receipt method of the ledger_api handler where is_settled or is_valid is False.""" # setup ledger_api_dialogue = cast( @@ -1050,7 +1063,8 @@ def test_handle_success_i(self): # operation with patch.object(self.oef_search_handler.context.logger, "log") as mock_logger: with patch.object( - self.service_registration_behaviour, "register_service", + self.service_registration_behaviour, + "register_service", ) as mock_reg: self.oef_search_handler.handle(incoming_message) @@ -1077,7 +1091,8 @@ def test_handle_success_ii(self): # operation with patch.object(self.oef_search_handler.context.logger, "log") as mock_logger: with patch.object( - self.service_registration_behaviour, "register_genus", + self.service_registration_behaviour, + "register_genus", ) as mock_reg: self.oef_search_handler.handle(incoming_message) @@ -1104,7 +1119,8 @@ def test_handle_success_iii(self): # operation with patch.object(self.oef_search_handler.context.logger, "log") as mock_logger: with patch.object( - self.service_registration_behaviour, "register_classification", + self.service_registration_behaviour, + "register_classification", ) as mock_reg: self.oef_search_handler.handle(incoming_message) @@ -1202,7 +1218,8 @@ def test_handle_error_ii(self): """Test the _handle_error method of the oef_search handler where the oef error does NOT target register_service.""" # setup oef_dialogue = self.prepare_skill_dialogue( - dialogues=self.oef_dialogues, messages=self.list_of_messages_unregister[:1], + dialogues=self.oef_dialogues, + messages=self.list_of_messages_unregister[:1], ) incoming_message = self.build_incoming_message_for_skill_dialogue( dialogue=oef_dialogue, diff --git a/tests/test_packages/test_skills/test_generic_seller/test_models.py b/tests/test_packages/test_skills/test_generic_seller/test_models.py index 9aeb98bbbb..e27ddf4084 100644 --- a/tests/test_packages/test_skills/test_generic_seller/test_models.py +++ b/tests/test_packages/test_skills/test_generic_seller/test_models.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -163,7 +163,9 @@ def test_generate_proposal_terms_and_data(self): total_price = len(self.data_for_sale) * self.unit_price sale_quantity = len(self.data_for_sale) tx_nonce = LedgerApis.generate_tx_nonce( - identifier=self.ledger_id, seller=seller, client=COUNTERPARTY_AGENT_ADDRESS, + identifier=self.ledger_id, + seller=seller, + client=COUNTERPARTY_AGENT_ADDRESS, ) query = Query( [Constraint("seller_service", ConstraintType("==", "some_service"))] diff --git a/tests/test_packages/test_skills/test_gym/intermediate_class.py b/tests/test_packages/test_skills/test_gym/intermediate_class.py index 225c263fd8..ecc6a08591 100644 --- a/tests/test_packages/test_skills/test_gym/intermediate_class.py +++ b/tests/test_packages/test_skills/test_gym/intermediate_class.py @@ -67,7 +67,8 @@ def setup(cls): # models cls.task = GymTask( - skill_context=cls._skill.skill_context, nb_steps=cls.nb_steps, + skill_context=cls._skill.skill_context, + nb_steps=cls.nb_steps, ) cls.task_manager = cast(TaskManager, cls._skill.skill_context.task_manager) diff --git a/tests/test_packages/test_skills/test_gym/test_handlers.py b/tests/test_packages/test_skills/test_gym/test_handlers.py index 1af06001e9..1fd29f4dad 100644 --- a/tests/test_packages/test_skills/test_gym/test_handlers.py +++ b/tests/test_packages/test_skills/test_gym/test_handlers.py @@ -52,7 +52,8 @@ def test_setup(self): self.assert_quantity_in_outbox(0) mock_logger.assert_any_call( - logging.INFO, "Gym handler: setup method called.", + logging.INFO, + "Gym handler: setup method called.", ) mocked_enqueue_task.assert_any_call(self.gym_handler.task) assert self.gym_handler._task_id == self.mocked_task_id @@ -98,7 +99,8 @@ def test_handle_percept_i(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:3], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:3], ), ) incoming_message = cast( @@ -117,7 +119,10 @@ def test_handle_percept_i(self): self.gym_handler.task.proxy_env._active_dialogue = gym_dialogue # operation - with patch.object(self.gym_handler.task.proxy_env_queue, "put",) as mocked_put: + with patch.object( + self.gym_handler.task.proxy_env_queue, + "put", + ) as mocked_put: self.gym_handler.handle(incoming_message) # after @@ -129,7 +134,8 @@ def test_handle_percept_ii(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:3], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:3], ), ) incoming_message = cast( @@ -148,7 +154,8 @@ def test_handle_percept_ii(self): gym_dialogue_ii = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:1], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:1], ), ) self.gym_handler.task.proxy_env._active_dialogue = gym_dialogue_ii @@ -159,7 +166,8 @@ def test_handle_percept_ii(self): # after mock_logger.assert_any_call( - logging.WARNING, "gym dialogue not active dialogue.", + logging.WARNING, + "gym dialogue not active dialogue.", ) def test_handle_status_i(self): @@ -168,7 +176,8 @@ def test_handle_status_i(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:1], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:1], ), ) incoming_message = cast( @@ -183,7 +192,10 @@ def test_handle_status_i(self): self.gym_handler.task.proxy_env._active_dialogue = gym_dialogue # operation - with patch.object(self.gym_handler.task.proxy_env_queue, "put",) as mocked_put: + with patch.object( + self.gym_handler.task.proxy_env_queue, + "put", + ) as mocked_put: self.gym_handler.handle(incoming_message) # after @@ -195,7 +207,8 @@ def test_handle_status_ii(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:1], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:1], ), ) incoming_message = cast( @@ -210,7 +223,8 @@ def test_handle_status_ii(self): gym_dialogue_ii = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:1], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:1], ), ) self.gym_handler.task.proxy_env._active_dialogue = gym_dialogue_ii @@ -221,14 +235,16 @@ def test_handle_status_ii(self): # after mock_logger.assert_any_call( - logging.WARNING, "gym dialogue not active dialogue.", + logging.WARNING, + "gym dialogue not active dialogue.", ) def test_handle_invalid(self): """Test the _handle_invalid method of the gym handler.""" # setup incoming_message = self.build_incoming_message( - message_type=GymMessage, performative=GymMessage.Performative.RESET, + message_type=GymMessage, + performative=GymMessage.Performative.RESET, ) # operation @@ -267,10 +283,12 @@ def test_teardown(self): self.assert_quantity_in_outbox(0) mock_logger.assert_any_call( - logging.INFO, "Gym handler: teardown method called.", + logging.INFO, + "Gym handler: teardown method called.", ) mocked_gym_task_teardown.assert_called_once() mocked_get_result.assert_any_call(self.mocked_task_id) mock_logger.assert_any_call( - logging.WARNING, "Task not successful!", + logging.WARNING, + "Task not successful!", ) diff --git a/tests/test_packages/test_skills/test_gym/test_helpers.py b/tests/test_packages/test_skills/test_gym/test_helpers.py index 47ee137c54..10c360314b 100644 --- a/tests/test_packages/test_skills/test_gym/test_helpers.py +++ b/tests/test_packages/test_skills/test_gym/test_helpers.py @@ -60,7 +60,8 @@ def test_step_i(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:2], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:2], ), ) self.proxy_env._active_dialogue = gym_dialogue @@ -116,12 +117,14 @@ def test_step_ii(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:2], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:2], ), ) self.proxy_env._active_dialogue = gym_dialogue invalid_percept_msg = self.build_incoming_message( - message_type=GymMessage, performative=GymMessage.Performative.RESET, + message_type=GymMessage, + performative=GymMessage.Performative.RESET, ) # operation @@ -160,7 +163,8 @@ def test_step_iii(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:2], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:2], ), ) self.proxy_env._active_dialogue = gym_dialogue @@ -240,7 +244,8 @@ def test_reset_ii(self): """Test the reset method of the ProxyEnv class where performative is NOT status.""" # setup invalid_msg = self.build_incoming_message( - message_type=GymMessage, performative=GymMessage.Performative.RESET, + message_type=GymMessage, + performative=GymMessage.Performative.RESET, ) # operation @@ -278,7 +283,8 @@ def test_close_i(self): gym_dialogue = cast( GymDialogue, self.prepare_skill_dialogue( - dialogues=self.gym_dialogues, messages=self.list_of_gym_messages[:4], + dialogues=self.gym_dialogues, + messages=self.list_of_gym_messages[:4], ), ) self.proxy_env._active_dialogue = gym_dialogue diff --git a/tests/test_packages/test_skills/test_http_echo/test_handlers.py b/tests/test_packages/test_skills/test_http_echo/test_handlers.py index eaf918b1d3..af84762d45 100644 --- a/tests/test_packages/test_skills/test_http_echo/test_handlers.py +++ b/tests/test_packages/test_skills/test_http_echo/test_handlers.py @@ -175,7 +175,8 @@ def test_handle_request_get(self): assert has_attributes, error_str mock_logger.assert_any_call( - logging.INFO, f"responding with: {message}", + logging.INFO, + f"responding with: {message}", ) def test_handle_request_post(self): @@ -227,14 +228,16 @@ def test_handle_request_post(self): assert has_attributes, error_str mock_logger.assert_any_call( - logging.INFO, f"responding with: {message}", + logging.INFO, + f"responding with: {message}", ) def test_handle_invalid(self): """Test the _handle_invalid method of the http_echo handler.""" # setup http_dialogue = self.prepare_skill_dialogue( - dialogues=self.http_dialogues, messages=self.list_of_messages[:1], + dialogues=self.http_dialogues, + messages=self.list_of_messages[:1], ) incoming_message = cast( HttpMessage, diff --git a/tests/test_protocols/test_dialogue/test_base.py b/tests/test_protocols/test_dialogue/test_base.py index f844f2ff7a..fadcae5563 100644 --- a/tests/test_protocols/test_dialogue/test_base.py +++ b/tests/test_protocols/test_dialogue/test_base.py @@ -1239,7 +1239,8 @@ def test_update_positive_existing_dialogue_2(self): opponent_dialogue_1 = self.opponent_dialogues.update(msg_1) msg_2 = dialogue.reply( - performative=DefaultMessage.Performative.BYTES, content=b"Hello again", + performative=DefaultMessage.Performative.BYTES, + content=b"Hello again", ) opponent_dialogue_2 = self.opponent_dialogues.update(msg_2) @@ -1424,7 +1425,9 @@ def test_update_negative_existing_dialogue_non_nonexistent(self): == b"Hello" ) - def test_complete_dialogue_reference_positive(self,): + def test_complete_dialogue_reference_positive( + self, + ): """Positive test for the '_complete_dialogue_reference' method.""" msg, dialogue = self.own_dialogues.create( self.opponent_address, DefaultMessage.Performative.BYTES, content=b"Hello" @@ -1452,7 +1455,9 @@ def test_complete_dialogue_reference_positive(self,): == valid_message_2_by_other.dialogue_reference ) - def test_complete_dialogue_reference_negative_incorrect_reference(self,): + def test_complete_dialogue_reference_negative_incorrect_reference( + self, + ): """Negative test for the '_complete_dialogue_reference' method: the input message has invalid dialogue reference.""" msg, dialogue = self.own_dialogues.create( self.opponent_address, DefaultMessage.Performative.BYTES, content=b"Hello" diff --git a/tests/test_protocols/test_generator/test_common.py b/tests/test_protocols/test_generator/test_common.py index bbdc2db694..ef0ddb4fc9 100644 --- a/tests/test_protocols/test_generator/test_common.py +++ b/tests/test_protocols/test_generator/test_common.py @@ -107,7 +107,9 @@ def test_camel_case_to_snake_case(self): output_1 = _camel_case_to_snake_case(input_text_1) assert output_1 == expected_1 - def test_match_brackets(self,): + def test_match_brackets( + self, + ): """Positive test the '_match_brackets' method.""" text_1 = "[so[met[hi]]ng]" assert _match_brackets(text_1, 0) == 14 @@ -121,7 +123,8 @@ def test_match_brackets(self,): self.assertEqual( str(cm.exception), "Index {} in 'text' is not an open bracket '['. It is {}".format( - index_2, text_2[index_2], + index_2, + text_2[index_2], ), ) @@ -131,7 +134,8 @@ def test_match_brackets(self,): self.assertEqual( str(cm.exception), "Index {} in 'text' is not an open bracket '['. It is {}".format( - index_3, text_2[index_3], + index_3, + text_2[index_3], ), ) @@ -144,7 +148,9 @@ def test_match_brackets(self,): + str(index_4), ) - def test_has_matched_brackets(self,): + def test_has_matched_brackets( + self, + ): """Positive test the '_has_matched_brackets' method.""" valid_text_1 = "[so[met[hi]]ng]" assert _has_matched_brackets(valid_text_1) is True @@ -167,7 +173,9 @@ def test_has_matched_brackets(self,): invalid_text_4 = "[[]" assert _has_matched_brackets(invalid_text_4) is False - def test_get_sub_types_of_compositional_types_positive(self,): + def test_get_sub_types_of_compositional_types_positive( + self, + ): """Positive test the '_get_sub_types_of_compositional_types' method.""" composition_type_1 = "pt:set[pt:int, integer, bool]" expected_1 = ("pt:int", "integer", "bool") @@ -244,7 +252,9 @@ def test_get_sub_types_of_compositional_types_positive(self,): ) assert _get_sub_types_of_compositional_types(composition_type_11) == expected_11 - def test_get_sub_types_of_compositional_types_negative(self,): + def test_get_sub_types_of_compositional_types_negative( + self, + ): """Negative test the '_get_sub_types_of_compositional_types' method""" composition_type_1 = "pt:int" with self.assertRaises(SyntaxError) as cm: @@ -270,7 +280,9 @@ def test_get_sub_types_of_compositional_types_negative(self,): "Bad formatting. No matching close bracket ']' for the open bracket at pt:set[", ) - def test_union_sub_type_to_protobuf_variable_name(self,): + def test_union_sub_type_to_protobuf_variable_name( + self, + ): """Test the '_union_sub_type_to_protobuf_variable_name' method""" content_name = "proposal" @@ -304,7 +316,9 @@ def test_union_sub_type_to_protobuf_variable_name(self,): == "proposal_type_DataModel" ) - def test_python_pt_or_ct_type_to_proto_type(self,): + def test_python_pt_or_ct_type_to_proto_type( + self, + ): """Test the '_python_pt_or_ct_type_to_proto_type' method""" content_type_bytes = "bytes" assert _python_pt_or_ct_type_to_proto_type(content_type_bytes) == "bytes" @@ -324,7 +338,9 @@ def test_python_pt_or_ct_type_to_proto_type(self,): content_type_ct = "Query" assert _python_pt_or_ct_type_to_proto_type(content_type_ct) == "Query" - def test_includes_custom_type(self,): + def test_includes_custom_type( + self, + ): """Test the '_includes_custom_type' method""" content_type_includes_1 = "Optional[DataModel]" assert _includes_custom_type(content_type_includes_1) is True @@ -394,7 +410,8 @@ def test_check_prerequisites_negative_isort_is_not_installed( check_prerequisites() @mock.patch( - "aea.protocols.generator.common.subprocess.call", return_value=1, + "aea.protocols.generator.common.subprocess.call", + return_value=1, ) def test_check_prerequisites_negative_protolint_is_not_installed( self, mocked_is_installed @@ -414,7 +431,9 @@ def test_check_prerequisites_negative_protoc_is_not_installed( with self.assertRaises(FileNotFoundError): check_prerequisites() - def test_load_protocol_specification(self,): + def test_load_protocol_specification( + self, + ): """Test the 'load_protocol_specification' method""" spec = load_protocol_specification(PATH_TO_T_PROTOCOL_SPECIFICATION) assert spec.name == T_PROTOCOL_NAME @@ -426,7 +445,9 @@ def test_load_protocol_specification(self,): assert spec.speech_acts is not None assert spec.protobuf_snippets is not None and spec.protobuf_snippets != "" - def test_create_protocol_file(self,): + def test_create_protocol_file( + self, + ): """Test the '_create_protocol_file' method""" file_name = "temp_file" file_content = "this is a temporary file" diff --git a/tests/test_protocols/test_generator/test_generator.py b/tests/test_protocols/test_generator/test_generator.py index 5fc9d64938..aeffaf8adb 100644 --- a/tests/test_protocols/test_generator/test_generator.py +++ b/tests/test_protocols/test_generator/test_generator.py @@ -93,7 +93,10 @@ def test_compare_latest_generator_output_with_test_protocol(self): # compare __init__.py init_file_generated = Path(self.t, T_PROTOCOL_NAME, "__init__.py") - init_file_original = Path(PATH_TO_T_PROTOCOL, "__init__.py",) + init_file_original = Path( + PATH_TO_T_PROTOCOL, + "__init__.py", + ) is_matched, diff = match_files(init_file_generated, init_file_original) assert ( @@ -102,13 +105,19 @@ def test_compare_latest_generator_output_with_test_protocol(self): # compare message.py message_file_generated = Path(self.t, T_PROTOCOL_NAME, "message.py") - message_file_original = Path(PATH_TO_T_PROTOCOL, "message.py",) + message_file_original = Path( + PATH_TO_T_PROTOCOL, + "message.py", + ) is_matched, diff = match_files(message_file_generated, message_file_original) assert is_matched, f"Difference Found between message.py files:\n{diff}" # compare serialization.py serialization_file_generated = Path(self.t, T_PROTOCOL_NAME, "serialization.py") - serialization_file_original = Path(PATH_TO_T_PROTOCOL, "serialization.py",) + serialization_file_original = Path( + PATH_TO_T_PROTOCOL, + "serialization.py", + ) is_matched, diff = match_files( serialization_file_generated, serialization_file_original ) @@ -116,7 +125,10 @@ def test_compare_latest_generator_output_with_test_protocol(self): # compare dialogues.py dialogue_file_generated = Path(self.t, T_PROTOCOL_NAME, "dialogues.py") - dialogue_file_original = Path(PATH_TO_T_PROTOCOL, "dialogues.py",) + dialogue_file_original = Path( + PATH_TO_T_PROTOCOL, + "dialogues.py", + ) is_matched, diff = match_files(dialogue_file_generated, dialogue_file_original) assert is_matched, f"Difference Found between dialogues.py files:\n{diff}" @@ -125,7 +137,8 @@ def test_compare_latest_generator_output_with_test_protocol(self): self.t, T_PROTOCOL_NAME, "{}.proto".format(T_PROTOCOL_NAME) ) proto_file_original = Path( - PATH_TO_T_PROTOCOL, "{}.proto".format(T_PROTOCOL_NAME), + PATH_TO_T_PROTOCOL, + "{}.proto".format(T_PROTOCOL_NAME), ) is_matched, diff = match_files(proto_file_generated, proto_file_original) assert is_matched, f"Difference Found between .proto files:\n{diff}" @@ -197,7 +210,10 @@ def test_compare_latest_generator_output_with_test_protocol(self): # compare __init__.py init_file_generated = Path(self.t, protocol_name, "__init__.py") - init_file_original = Path(path_to_protocol, "__init__.py",) + init_file_original = Path( + path_to_protocol, + "__init__.py", + ) is_matched, diff = match_files(init_file_generated, init_file_original) assert ( is_matched or len(diff) == 194 @@ -205,13 +221,19 @@ def test_compare_latest_generator_output_with_test_protocol(self): # compare message.py message_file_generated = Path(self.t, protocol_name, "message.py") - message_file_original = Path(path_to_protocol, "message.py",) + message_file_original = Path( + path_to_protocol, + "message.py", + ) is_matched, diff = match_files(message_file_generated, message_file_original) assert is_matched, f"Difference Found between message.py files:\n{diff}" # compare serialization.py serialization_file_generated = Path(self.t, protocol_name, "serialization.py") - serialization_file_original = Path(path_to_protocol, "serialization.py",) + serialization_file_original = Path( + path_to_protocol, + "serialization.py", + ) is_matched, diff = match_files( serialization_file_generated, serialization_file_original ) @@ -219,7 +241,10 @@ def test_compare_latest_generator_output_with_test_protocol(self): # compare dialogues.py dialogue_file_generated = Path(self.t, protocol_name, "dialogues.py") - dialogue_file_original = Path(path_to_protocol, "dialogues.py",) + dialogue_file_original = Path( + path_to_protocol, + "dialogues.py", + ) is_matched, diff = match_files(dialogue_file_generated, dialogue_file_original) assert is_matched, f"Difference Found between dialogues.py files:\n{diff}" @@ -227,7 +252,10 @@ def test_compare_latest_generator_output_with_test_protocol(self): proto_file_generated = Path( self.t, protocol_name, "{}.proto".format(protocol_name) ) - proto_file_original = Path(path_to_protocol, "{}.proto".format(protocol_name),) + proto_file_original = Path( + path_to_protocol, + "{}.proto".format(protocol_name), + ) is_matched, diff = match_files(proto_file_generated, proto_file_original) assert is_matched, f"Difference Found between .proto files:\n{diff}" @@ -1153,7 +1181,8 @@ def test_init_negative_extracting_specification_fails(self, mocked_extract): assert str(cm.exception) == expected_msg @mock.patch( - "aea.protocols.generator.base.validate", return_value=(False, "Some error!"), + "aea.protocols.generator.base.validate", + return_value=(False, "Some error!"), ) def test_extract_negative_invalid_specification(self, mocked_validate): """Negative test the 'extract' method: invalid protocol specification""" diff --git a/tests/test_protocols/test_generator/test_validate.py b/tests/test_protocols/test_generator/test_validate.py index df5df9fc75..796db01646 100644 --- a/tests/test_protocols/test_generator/test_validate.py +++ b/tests/test_protocols/test_generator/test_validate.py @@ -801,7 +801,8 @@ def test_validate_content_name(self): assert ( invalid_msg_6 == "Invalid name for content '{}' of performative '{}'. This name is reserved.".format( - invalid_content_type_6, performative, + invalid_content_type_6, + performative, ) ) @@ -813,7 +814,8 @@ def test_validate_content_name(self): assert ( invalid_msg_7 == "Invalid name for content '{}' of performative '{}'. This name is reserved.".format( - invalid_content_type_7, performative, + invalid_content_type_7, + performative, ) ) @@ -927,7 +929,8 @@ def test_validate_content_type(self): assert ( invalid_msg_1 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) @@ -939,7 +942,8 @@ def test_validate_content_type(self): assert ( invalid_msg_2 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) @@ -951,7 +955,8 @@ def test_validate_content_type(self): assert ( invalid_msg_3 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) @@ -963,7 +968,8 @@ def test_validate_content_type(self): assert ( invalid_msg_4 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) @@ -975,7 +981,8 @@ def test_validate_content_type(self): assert ( invalid_msg_5 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) @@ -987,7 +994,8 @@ def test_validate_content_type(self): assert ( invalid_msg_6 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) @@ -999,11 +1007,14 @@ def test_validate_content_type(self): assert ( invalid_msg_7 == "Invalid type for content '{}' of performative '{}'. See documentation for the correct format of specification types.".format( - content_name, performative, + content_name, + performative, ) ) - @mock.patch("aea.configurations.base.ProtocolSpecification",) + @mock.patch( + "aea.configurations.base.ProtocolSpecification", + ) def test_validate_speech_acts_section(self, mocked_spec): """Test for the '_validate_speech_acts_section' method.""" valid_speech_act_content_config_1 = SpeechActContentConfig( @@ -1073,7 +1084,8 @@ def test_validate_speech_acts_section(self, mocked_spec): assert ( invalid_msg_2 == "Invalid name for content '{}' of performative '{}'. This name is reserved.".format( - "target", valid_perm, + "target", + valid_perm, ) ) assert invalid_all_per_2 is None @@ -1163,7 +1175,9 @@ def test_validate_speech_acts_section(self, mocked_spec): assert invalid_all_per_6 is None assert invalid_all_content_6 is None - @mock.patch("aea.configurations.base.ProtocolSpecification",) + @mock.patch( + "aea.configurations.base.ProtocolSpecification", + ) def test_validate_protocol_buffer_schema_code_snippets(self, mocked_spec): """Test for the '_validate_protocol_buffer_schema_code_snippets' method.""" valid_protobuf_snippet_1 = { @@ -1252,9 +1266,10 @@ def test_validate_field_existence(self): "keep_terminal_state_dialogues": True, } - valid_result_1, valid_msg_1, = _validate_field_existence( - valid_dialogue_config_1 - ) + ( + valid_result_1, + valid_msg_1, + ) = _validate_field_existence(valid_dialogue_config_1) assert valid_result_1 is True assert valid_msg_1 == "Dialogue section has all the required fields." @@ -1263,9 +1278,10 @@ def test_validate_field_existence(self): invalid_dialogue_config_1 = valid_dialogue_config_1.copy() invalid_dialogue_config_1.pop("initiation") - invalid_result_1, invalid_msg_1, = _validate_field_existence( - invalid_dialogue_config_1 - ) + ( + invalid_result_1, + invalid_msg_1, + ) = _validate_field_existence(invalid_dialogue_config_1) assert invalid_result_1 is False assert ( invalid_msg_1 @@ -1275,9 +1291,10 @@ def test_validate_field_existence(self): invalid_dialogue_config_2 = valid_dialogue_config_1.copy() invalid_dialogue_config_2.pop("reply") - invalid_result_2, invalid_msg_2, = _validate_field_existence( - invalid_dialogue_config_2 - ) + ( + invalid_result_2, + invalid_msg_2, + ) = _validate_field_existence(invalid_dialogue_config_2) assert invalid_result_2 is False assert ( invalid_msg_2 @@ -1664,7 +1681,9 @@ def test_validate_keep_terminal(self): == f"Invalid type for keep_terminal_state_dialogues. Expected bool. Found {type(invalid_keep_terminal_state_dialogues_1)}." ) - @mock.patch("aea.configurations.base.ProtocolSpecification",) + @mock.patch( + "aea.configurations.base.ProtocolSpecification", + ) def test_validate_dialogue_section(self, mocked_spec): """Test for the '_validate_dialogue_section' method.""" valid_dialogue_config_1 = { @@ -1694,9 +1713,10 @@ def test_validate_dialogue_section(self, mocked_spec): } mocked_spec.dialogue_config = valid_dialogue_config_1 - valid_result_1, valid_msg_1, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + valid_result_1, + valid_msg_1, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert valid_result_1 is True assert valid_msg_1 == "Dialogue section of the protocol specification is valid." @@ -1707,9 +1727,10 @@ def test_validate_dialogue_section(self, mocked_spec): mocked_spec.dialogue_config = invalid_dialogue_config_1 - invalid_result_1, invalid_msg_1, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_1, + invalid_msg_1, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_1 is False assert ( invalid_msg_1 @@ -1728,9 +1749,10 @@ def test_validate_dialogue_section(self, mocked_spec): mocked_spec.dialogue_config = invalid_dialogue_config_2 - invalid_result_2, invalid_msg_2, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_2, + invalid_msg_2, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_2 is False assert ( invalid_msg_2 @@ -1744,9 +1766,10 @@ def test_validate_dialogue_section(self, mocked_spec): mocked_spec.dialogue_config = invalid_dialogue_config_3 - invalid_result_3, invalid_msg_3, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_3, + invalid_msg_3, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_3 is False assert ( invalid_msg_3 @@ -1762,9 +1785,10 @@ def test_validate_dialogue_section(self, mocked_spec): mocked_spec.dialogue_config = invalid_dialogue_config_4 - invalid_result_4, invalid_msg_4, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_4, + invalid_msg_4, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_4 is False assert ( invalid_msg_4 @@ -1776,9 +1800,10 @@ def test_validate_dialogue_section(self, mocked_spec): mocked_spec.dialogue_config = invalid_dialogue_config_5 - invalid_result_5, invalid_msg_5, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_5, + invalid_msg_5, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_5 is False assert ( invalid_msg_5 @@ -1791,9 +1816,10 @@ def test_validate_dialogue_section(self, mocked_spec): invalid_dialogue_config_6.pop("termination") mocked_spec.dialogue_config = invalid_dialogue_config_6 - invalid_result_6, invalid_msg_6, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_6, + invalid_msg_6, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_6 is False assert ( invalid_msg_6 @@ -1805,9 +1831,10 @@ def test_validate_dialogue_section(self, mocked_spec): invalid_dialogue_config_7["keep_terminal_state_dialogues"] = invalid_value mocked_spec.dialogue_config = invalid_dialogue_config_7 - invalid_result_7, invalid_msg_7, = _validate_dialogue_section( - mocked_spec, valid_performatives_set_1 - ) + ( + invalid_result_7, + invalid_msg_7, + ) = _validate_dialogue_section(mocked_spec, valid_performatives_set_1) assert invalid_result_7 is False assert ( invalid_msg_7 @@ -1835,7 +1862,10 @@ def test_validate_positive( macked_validate_dialogue, ): """Positive test for the 'validate' method: invalid dialogue section.""" - valid_result_1, valid_msg_1, = validate(mocked_spec) + ( + valid_result_1, + valid_msg_1, + ) = validate(mocked_spec) assert valid_result_1 is True assert valid_msg_1 == "Protocol specification is valid." @@ -1848,7 +1878,10 @@ def test_validate_negative_invalid_speech_acts( self, mocked_spec, macked_validate_speech_acts ): """Negative test for the 'validate' method: invalid speech_acts.""" - invalid_result_1, invalid_msg_1, = validate(mocked_spec) + ( + invalid_result_1, + invalid_msg_1, + ) = validate(mocked_spec) assert invalid_result_1 is False assert invalid_msg_1 == "Some error on speech_acts." @@ -1865,7 +1898,10 @@ def test_validate_negative_invalid_protobuf_snippets( self, mocked_spec, macked_validate_speech_acts, macked_validate_protobuf ): """Negative test for the 'validate' method: invalid protobuf snippets.""" - invalid_result_1, invalid_msg_1, = validate(mocked_spec) + ( + invalid_result_1, + invalid_msg_1, + ) = validate(mocked_spec) assert invalid_result_1 is False assert invalid_msg_1 == "Some error on protobuf snippets." @@ -1890,6 +1926,9 @@ def test_validate_negative_invalid_dialogue_section( macked_validate_dialogue, ): """Negative test for the 'validate' method: invalid dialogue section.""" - invalid_result_1, invalid_msg_1, = validate(mocked_spec) + ( + invalid_result_1, + invalid_msg_1, + ) = validate(mocked_spec) assert invalid_result_1 is False assert invalid_msg_1 == "Some error on dialogue section." diff --git a/tests/test_registries/test_base.py b/tests/test_registries/test_base.py index ab0c3b7ed4..5bd960d1fc 100644 --- a/tests/test_registries/test_base.py +++ b/tests/test_registries/test_base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -755,7 +755,9 @@ def test_register_and_unregister_dynamically(self): is_dynamically_added=True, ) assert len(self.registry._dynamically_added) == 1 - self.registry.unregister((PublicId.from_str("author/name:0.1.0"), "name"),) + self.registry.unregister( + (PublicId.from_str("author/name:0.1.0"), "name"), + ) assert len(self.registry._dynamically_added) == 0 def test_register_and_teardown_dynamically(self): diff --git a/tests/test_skills/test_base.py b/tests/test_skills/test_base.py index 17b4023394..a8024a6905 100644 --- a/tests/test_skills/test_base.py +++ b/tests/test_skills/test_base.py @@ -129,7 +129,8 @@ def test_decision_maker_message_queue(self): def test_decision_maker_handler_context(self): """Test the decision_maker_handler_context.""" assert isinstance( - self.skill_context.decision_maker_handler_context, SimpleNamespace, + self.skill_context.decision_maker_handler_context, + SimpleNamespace, ) def test_storage(self): diff --git a/tests/test_skills/test_error.py b/tests/test_skills/test_error.py index 0764408e52..96ad8cc698 100644 --- a/tests/test_skills/test_error.py +++ b/tests/test_skills/test_error.py @@ -132,7 +132,11 @@ def test_error_skill_unsupported_protocol(self): performative=FipaMessage.Performative.ACCEPT, ) msg.to = self.address - envelope = Envelope(to=msg.to, sender=self.address, message=msg,) + envelope = Envelope( + to=msg.to, + sender=self.address, + message=msg, + ) self.my_error_handler.send_unsupported_protocol(envelope) @@ -152,7 +156,11 @@ def test_error_decoding_error(self): performative=FipaMessage.Performative.ACCEPT, ) msg.to = self.address - envelope = Envelope(to=msg.to, sender=self.address, message=msg,) + envelope = Envelope( + to=msg.to, + sender=self.address, + message=msg, + ) self.my_error_handler.send_decoding_error(envelope) wait_for_condition(lambda: len(self.my_aea._inbox._history) >= 1, timeout=5) @@ -172,7 +180,11 @@ def test_error_unsupported_skill(self): ) msg.to = self.address msg.sender = self.address - envelope = Envelope(to=msg.to, sender=msg.sender, message=msg,) + envelope = Envelope( + to=msg.to, + sender=msg.sender, + message=msg, + ) self.my_error_handler.send_unsupported_skill(envelope=envelope) @@ -187,7 +199,10 @@ def test_error_unsupported_skill_when_skill_id_is_none(self): """Test the 'send_unsupported_skill' when the skill id in the envelope is None.""" protocol_id = PublicId.from_str("author/name:0.1.0") envelope = Envelope( - to="", sender="", protocol_specification_id=protocol_id, message=b"", + to="", + sender="", + protocol_specification_id=protocol_id, + message=b"", ) with unittest.mock.patch.object(self.skill_context.outbox, "put_message"): with unittest.mock.patch.object( diff --git a/tests/test_test_tools/test_test_skill.py b/tests/test_test_tools/test_test_skill.py index e7d807ab7e..41c27049eb 100644 --- a/tests/test_test_tools/test_test_skill.py +++ b/tests/test_test_tools/test_test_skill.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2021 Valory AG +# Copyright 2021-2022 Valory AG # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -409,7 +409,9 @@ def test_positive_build_incoming_message_for_skill_dialogue(self): performative = FipaMessage.Performative.PROPOSE proposal = "some_proposal" incoming_message = self.build_incoming_message_for_skill_dialogue( - dialogue=dialogue, performative=performative, proposal=proposal, + dialogue=dialogue, + performative=performative, + proposal=proposal, ) assert type(incoming_message) == FipaMessage @@ -432,7 +434,9 @@ def test_negative_build_incoming_message_for_skill_dialogue_dialogue_is_none(sel with pytest.raises(AEAEnforceError, match="dialogue cannot be None."): self.build_incoming_message_for_skill_dialogue( - dialogue=None, performative=performative, proposal=proposal, + dialogue=None, + performative=performative, + proposal=proposal, ) def test_negative_build_incoming_message_for_skill_dialogue_dialogue_is_empty(self): @@ -451,7 +455,9 @@ def test_negative_build_incoming_message_for_skill_dialogue_dialogue_is_empty(se with pytest.raises(AEAEnforceError, match="dialogue cannot be empty."): self.build_incoming_message_for_skill_dialogue( - dialogue=dialogue, performative=performative, proposal=proposal, + dialogue=dialogue, + performative=performative, + proposal=proposal, ) def test_provide_unspecified_fields(self): @@ -559,7 +565,9 @@ def test_prepare_skill_dialogue_valid_self_initiated(self): ), ) dialogue = self.prepare_skill_dialogue( - fipa_dialogues, dialogue_messages, "counterparty", + fipa_dialogues, + dialogue_messages, + "counterparty", ) assert type(dialogue) == FipaDialogue @@ -603,7 +611,9 @@ def test_prepare_skill_dialogue_valid_opponent_initiated(self): ), ) dialogue = self.prepare_skill_dialogue( - fipa_dialogues, dialogue_messages, "counterparty", + fipa_dialogues, + dialogue_messages, + "counterparty", ) assert type(dialogue) == FipaDialogue @@ -647,7 +657,9 @@ def test_negative_prepare_skill_dialogue_invalid_opponent_initiated(self): AEAEnforceError, match="Cannot update the dialogue with message number 1" ): self.prepare_skill_dialogue( - fipa_dialogues, dialogue_messages, "counterparty", + fipa_dialogues, + dialogue_messages, + "counterparty", ) def test_negative_prepare_skill_dialogue_empty_messages(self): @@ -661,7 +673,9 @@ def test_negative_prepare_skill_dialogue_empty_messages(self): AEAEnforceError, match="the list of messages must be positive." ): self.prepare_skill_dialogue( - fipa_dialogues, dialogue_messages, "counterparty", + fipa_dialogues, + dialogue_messages, + "counterparty", ) def test_negative_prepare_skill_dialogue_invalid(self): @@ -682,7 +696,9 @@ def test_negative_prepare_skill_dialogue_invalid(self): AEAEnforceError, match="Cannot update the dialogue with message number .*" ): self.prepare_skill_dialogue( - fipa_dialogues, dialogue_messages, "counterparty", + fipa_dialogues, + dialogue_messages, + "counterparty", ) diff --git a/tox.ini b/tox.ini index 95aecfa8bf..132210ef7d 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ passenv = * extras = all deps = aiohttp==3.7.4.post0 - black==19.10b0 + black==22.1.0 defusedxml==0.6.0 docker==4.2.0 gym==0.15.6 @@ -105,16 +105,16 @@ commands = bandit -r aea benchmark examples packages \ skipsdist = True skip_install = True deps = - black==19.10b0 - click==8.0.4 + black==22.1.0 + click==8.0.2 commands = black aea benchmark examples packages plugins scripts tests [testenv:black-check] skipsdist = True skip_install = True deps = - black==19.10b0 - click==8.0.4 + black==22.1.0 + click==8.0.2 commands =black aea benchmark examples packages plugins scripts tests --check --verbose [testenv:isort] @@ -169,7 +169,7 @@ skipsdist = True skip_install = True deps = bs4==0.0.1 - click==8.0.4 + click==8.0.2 markdown==3.2.1 mkdocs==1.3.0 mkdocs-material==8.2.8 @@ -278,8 +278,8 @@ skipsdist = True usedevelop = True deps = ipfshttpclient==0.8.0a2 - black==19.10b0 - click==8.0.4 + black==22.1.0 + click==8.0.2 isort==5.7.0 commands = python -m aea.cli generate-all-protocols --check-clean @@ -318,7 +318,7 @@ passenv = * extras = all deps = aiohttp==3.7.4.post0 - black==19.10b0 + black==22.1.0 defusedxml==0.6.0 docker==4.2.0 gym==0.15.6