diff --git a/aries_cloudagent/admin/base_server.py b/aries_cloudagent/admin/base_server.py index 2222af3702..b44c9b6f27 100644 --- a/aries_cloudagent/admin/base_server.py +++ b/aries_cloudagent/admin/base_server.py @@ -1,6 +1,5 @@ """Abstract admin server interface.""" - from abc import ABC, abstractmethod diff --git a/aries_cloudagent/anoncreds/base.py b/aries_cloudagent/anoncreds/base.py index 402895357a..8df37dabc4 100644 --- a/aries_cloudagent/anoncreds/base.py +++ b/aries_cloudagent/anoncreds/base.py @@ -1,4 +1,5 @@ """Base Registry.""" + from abc import ABC, abstractmethod from typing import Generic, Optional, Pattern, Sequence, TypeVar diff --git a/aries_cloudagent/anoncreds/default/did_indy/registry.py b/aries_cloudagent/anoncreds/default/did_indy/registry.py index f42cd5137c..e67bd17da0 100644 --- a/aries_cloudagent/anoncreds/default/did_indy/registry.py +++ b/aries_cloudagent/anoncreds/default/did_indy/registry.py @@ -1,4 +1,5 @@ """DID Indy Registry.""" + import logging import re from typing import Optional, Pattern, Sequence diff --git a/aries_cloudagent/anoncreds/default/did_web/registry.py b/aries_cloudagent/anoncreds/default/did_web/registry.py index 70730cfd21..84a9494f45 100644 --- a/aries_cloudagent/anoncreds/default/did_web/registry.py +++ b/aries_cloudagent/anoncreds/default/did_web/registry.py @@ -1,4 +1,5 @@ """DID Web Registry.""" + import re from typing import Optional, Pattern, Sequence diff --git a/aries_cloudagent/anoncreds/default/legacy_indy/registry.py b/aries_cloudagent/anoncreds/default/legacy_indy/registry.py index e3168c8974..227a090999 100644 --- a/aries_cloudagent/anoncreds/default/legacy_indy/registry.py +++ b/aries_cloudagent/anoncreds/default/legacy_indy/registry.py @@ -1,4 +1,5 @@ """Legacy Indy Registry.""" + import json import logging import re @@ -649,11 +650,13 @@ async def register_revocation_list( revocation_list=rev_list, ), registration_metadata={}, - revocation_list_metadata={} - if seq_no is None - else { - "seqNo": seq_no, - }, + revocation_list_metadata=( + {} + if seq_no is None + else { + "seqNo": seq_no, + } + ), ) async def update_revocation_list( diff --git a/aries_cloudagent/anoncreds/models/anoncreds_cred_def.py b/aries_cloudagent/anoncreds/models/anoncreds_cred_def.py index 70dc3619c5..b9e038ea9d 100644 --- a/aries_cloudagent/anoncreds/models/anoncreds_cred_def.py +++ b/aries_cloudagent/anoncreds/models/anoncreds_cred_def.py @@ -1,4 +1,5 @@ """Anoncreds cred def OpenAPI validators.""" + from typing import Optional from anoncreds import CredentialDefinition diff --git a/aries_cloudagent/anoncreds/models/anoncreds_revocation.py b/aries_cloudagent/anoncreds/models/anoncreds_revocation.py index 3adde8bfa6..b60eefafa2 100644 --- a/aries_cloudagent/anoncreds/models/anoncreds_revocation.py +++ b/aries_cloudagent/anoncreds/models/anoncreds_revocation.py @@ -1,4 +1,5 @@ """Anoncreds cred def OpenAPI validators.""" + from typing import Any, Dict, List, Optional from anoncreds import RevocationRegistryDefinition, RevocationStatusList diff --git a/aries_cloudagent/anoncreds/registry.py b/aries_cloudagent/anoncreds/registry.py index e205bc0150..920b465741 100644 --- a/aries_cloudagent/anoncreds/registry.py +++ b/aries_cloudagent/anoncreds/registry.py @@ -1,4 +1,5 @@ """AnonCreds Registry.""" + import logging from typing import List, Optional, Sequence diff --git a/aries_cloudagent/anoncreds/revocation.py b/aries_cloudagent/anoncreds/revocation.py index c1d794f7ec..0b2f330046 100644 --- a/aries_cloudagent/anoncreds/revocation.py +++ b/aries_cloudagent/anoncreds/revocation.py @@ -394,13 +394,17 @@ async def create_and_register_revocation_list( if not rev_reg_def_entry or not rev_reg_def_private_entry: raise AnonCredsRevocationError( - "Missing required revocation registry data: " - "revocation registry definition" - if not rev_reg_def_entry - else "", - "revocation registry private definition" - if not rev_reg_def_private_entry - else "", + ( + "Missing required revocation registry data: " + "revocation registry definition" + if not rev_reg_def_entry + else "" + ), + ( + "revocation registry private definition" + if not rev_reg_def_private_entry + else "" + ), ) try: @@ -1114,14 +1118,18 @@ async def revoke_pending_credentials( or not rev_reg_def_private_entry ): raise AnonCredsRevocationError( - "Missing required revocation registry data: " - "revocation registry definition" - if not rev_reg_def_entry - else "", + ( + "Missing required revocation registry data: " + "revocation registry definition" + if not rev_reg_def_entry + else "" + ), "revocation list" if not rev_list_entry else "", - "revocation registry private definition" - if not rev_reg_def_private_entry - else "", + ( + "revocation registry private definition" + if not rev_reg_def_private_entry + else "" + ), ) try: diff --git a/aries_cloudagent/anoncreds/routes.py b/aries_cloudagent/anoncreds/routes.py index 2320515e10..23f82eb458 100644 --- a/aries_cloudagent/anoncreds/routes.py +++ b/aries_cloudagent/anoncreds/routes.py @@ -1,4 +1,5 @@ """Anoncreds admin routes.""" + import logging from asyncio import shield diff --git a/aries_cloudagent/anoncreds/util.py b/aries_cloudagent/anoncreds/util.py index 480e2f9652..d565f9d407 100644 --- a/aries_cloudagent/anoncreds/util.py +++ b/aries_cloudagent/anoncreds/util.py @@ -23,11 +23,11 @@ def indy_client_dir(subpath: str = None, create: bool = False) -> str: home = Path.home() target_dir = join( home, - "Documents" - if isdir(join(home, "Documents")) - else getenv("EXTERNAL_STORAGE", "") - if system() == "Linux" - else "", + ( + "Documents" + if isdir(join(home, "Documents")) + else getenv("EXTERNAL_STORAGE", "") if system() == "Linux" else "" + ), ".indy_client", subpath if subpath else "", "", # set trailing separator diff --git a/aries_cloudagent/commands/upgrade.py b/aries_cloudagent/commands/upgrade.py index 5d81db13fe..bb0053e50e 100644 --- a/aries_cloudagent/commands/upgrade.py +++ b/aries_cloudagent/commands/upgrade.py @@ -106,9 +106,9 @@ def setup_version_upgrade_config(self, path: str): except KeyError: pass if "explicit_upgrade" in provided_config: - tagged_config_dict[config_id][ - "explicit_upgrade" - ] = provided_config.get("explicit_upgrade") + tagged_config_dict[config_id]["explicit_upgrade"] = ( + provided_config.get("explicit_upgrade") + ) try: config_key_set.remove("explicit_upgrade") except KeyError: diff --git a/aries_cloudagent/config/argparse.py b/aries_cloudagent/config/argparse.py index c8485c1bfb..296f286eef 100644 --- a/aries_cloudagent/config/argparse.py +++ b/aries_cloudagent/config/argparse.py @@ -783,13 +783,13 @@ def get_settings(self, args: Namespace) -> dict: if args.notify_revocation: settings["revocation.notify"] = args.notify_revocation if args.monitor_revocation_notification: - settings[ - "revocation.monitor_notification" - ] = args.monitor_revocation_notification + settings["revocation.monitor_notification"] = ( + args.monitor_revocation_notification + ) if args.anoncreds_legacy_revocation: - settings[ - "revocation.anoncreds_legacy_support" - ] = args.anoncreds_legacy_revocation + settings["revocation.anoncreds_legacy_support"] = ( + args.anoncreds_legacy_revocation + ) return settings @@ -1818,9 +1818,9 @@ def get_settings(self, args: Namespace): ) if multitenancy_config.get("key_derivation_method"): - settings[ - "multitenant.key_derivation_method" - ] = multitenancy_config.get("key_derivation_method") + settings["multitenant.key_derivation_method"] = ( + multitenancy_config.get("key_derivation_method") + ) else: for value_str in args.multitenancy_config: @@ -1968,9 +1968,9 @@ def get_settings(self, args: Namespace): if args.endorser_endorse_with_did: if settings["endorser.endorser"]: - settings[ - "endorser.endorser_endorse_with_did" - ] = args.endorser_endorse_with_did + settings["endorser.endorser_endorse_with_did"] = ( + args.endorser_endorse_with_did + ) else: raise ArgsParseError( "Parameter --endorser-endorse-with-did should only be set for " diff --git a/aries_cloudagent/config/banner.py b/aries_cloudagent/config/banner.py index 79d1f38278..aed73be28f 100644 --- a/aries_cloudagent/config/banner.py +++ b/aries_cloudagent/config/banner.py @@ -1,6 +1,5 @@ """Module to contain logic to generate the banner for ACA-py.""" - from contextlib import contextmanager from enum import Enum, auto import sys diff --git a/aries_cloudagent/config/logging.py b/aries_cloudagent/config/logging.py index 8d60899cc1..fa1a0db419 100644 --- a/aries_cloudagent/config/logging.py +++ b/aries_cloudagent/config/logging.py @@ -1,4 +1,5 @@ """Utilities related to logging.""" + import configparser import io import logging diff --git a/aries_cloudagent/connections/models/conn_record.py b/aries_cloudagent/connections/models/conn_record.py index 09d8b0f228..99eeaac55f 100644 --- a/aries_cloudagent/connections/models/conn_record.py +++ b/aries_cloudagent/connections/models/conn_record.py @@ -232,9 +232,7 @@ def __init__( self.their_role = ( ConnRecord.Role.get(their_role).rfc160 if isinstance(their_role, str) - else None - if their_role is None - else their_role.rfc160 + else None if their_role is None else their_role.rfc160 ) self.invitation_key = invitation_key self.invitation_msg_id = invitation_msg_id diff --git a/aries_cloudagent/connections/models/diddoc/diddoc.py b/aries_cloudagent/connections/models/diddoc/diddoc.py index e4ced90108..855bddcea4 100644 --- a/aries_cloudagent/connections/models/diddoc/diddoc.py +++ b/aries_cloudagent/connections/models/diddoc/diddoc.py @@ -16,7 +16,6 @@ limitations under the License. """ - import json import logging @@ -130,9 +129,11 @@ def _normalize_routing_keys(service: dict) -> dict: routing_keys = service.get("routingKeys") if routing_keys: routing_keys = [ - DIDKey.from_did(key).public_key_b58 - if key.startswith("did:key:") - else key + ( + DIDKey.from_did(key).public_key_b58 + if key.startswith("did:key:") + else key + ) for key in routing_keys ] service["routingKeys"] = routing_keys diff --git a/aries_cloudagent/connections/models/diddoc/publickey.py b/aries_cloudagent/connections/models/diddoc/publickey.py index 03492b3a0a..7390e2f0ba 100644 --- a/aries_cloudagent/connections/models/diddoc/publickey.py +++ b/aries_cloudagent/connections/models/diddoc/publickey.py @@ -16,7 +16,6 @@ limitations under the License. """ - from collections import namedtuple from enum import Enum diff --git a/aries_cloudagent/connections/models/diddoc/service.py b/aries_cloudagent/connections/models/diddoc/service.py index c9d2a8f7a0..330d08782d 100644 --- a/aries_cloudagent/connections/models/diddoc/service.py +++ b/aries_cloudagent/connections/models/diddoc/service.py @@ -16,7 +16,6 @@ limitations under the License. """ - from typing import List, Sequence, Union from .util import canon_did, canon_ref @@ -65,9 +64,7 @@ def __init__( self._recip_keys = ( [recip_keys] if isinstance(recip_keys, PublicKey) - else list(recip_keys) - if recip_keys - else None + else list(recip_keys) if recip_keys else None ) self._routing_keys = routing_keys or [] self._endpoint = endpoint diff --git a/aries_cloudagent/connections/models/diddoc/tests/test_diddoc.py b/aries_cloudagent/connections/models/diddoc/tests/test_diddoc.py index d9d45bc271..9b8e8d3d6b 100644 --- a/aries_cloudagent/connections/models/diddoc/tests/test_diddoc.py +++ b/aries_cloudagent/connections/models/diddoc/tests/test_diddoc.py @@ -15,7 +15,6 @@ limitations under the License. """ - from unittest import IsolatedAsyncioTestCase from .. import DIDDoc, PublicKey, PublicKeyType, Service diff --git a/aries_cloudagent/connections/models/diddoc/util.py b/aries_cloudagent/connections/models/diddoc/util.py index e79456ca00..26ce9352de 100644 --- a/aries_cloudagent/connections/models/diddoc/util.py +++ b/aries_cloudagent/connections/models/diddoc/util.py @@ -16,7 +16,6 @@ limitations under the License. """ - from base58 import b58decode from urllib.parse import urlparse diff --git a/aries_cloudagent/core/in_memory/profile.py b/aries_cloudagent/core/in_memory/profile.py index 42b2ad6374..28e5712bdd 100644 --- a/aries_cloudagent/core/in_memory/profile.py +++ b/aries_cloudagent/core/in_memory/profile.py @@ -1,4 +1,5 @@ """Manage in-memory profile interaction.""" + from collections import OrderedDict from typing import Any, Mapping, Type from weakref import ref diff --git a/aries_cloudagent/indy/models/tests/test_pres_preview.py b/aries_cloudagent/indy/models/tests/test_pres_preview.py index 85efec79f9..8f1d94614d 100644 --- a/aries_cloudagent/indy/models/tests/test_pres_preview.py +++ b/aries_cloudagent/indy/models/tests/test_pres_preview.py @@ -420,14 +420,14 @@ async def test_to_indy_proof_request_revo_default_interval(self): for uuid, attr_spec in indy_proof_req_revo["requested_attributes"].items(): assert set(attr_spec.get("non_revoked", {}).keys()) == {"from", "to"} - copy_indy_proof_req["requested_attributes"][uuid][ - "non_revoked" - ] = attr_spec["non_revoked"] + copy_indy_proof_req["requested_attributes"][uuid]["non_revoked"] = ( + attr_spec["non_revoked"] + ) for uuid, pred_spec in indy_proof_req_revo["requested_predicates"].items(): assert set(pred_spec.get("non_revoked", {}).keys()) == {"from", "to"} - copy_indy_proof_req["requested_predicates"][uuid][ - "non_revoked" - ] = pred_spec["non_revoked"] + copy_indy_proof_req["requested_predicates"][uuid]["non_revoked"] = ( + pred_spec["non_revoked"] + ) assert copy_indy_proof_req == indy_proof_req_revo @@ -471,14 +471,14 @@ async def test_to_indy_proof_request_revo(self): for uuid, attr_spec in indy_proof_req_revo["requested_attributes"].items(): assert set(attr_spec.get("non_revoked", {}).keys()) == {"from", "to"} - copy_indy_proof_req["requested_attributes"][uuid][ - "non_revoked" - ] = attr_spec["non_revoked"] + copy_indy_proof_req["requested_attributes"][uuid]["non_revoked"] = ( + attr_spec["non_revoked"] + ) for uuid, pred_spec in indy_proof_req_revo["requested_predicates"].items(): assert set(pred_spec.get("non_revoked", {}).keys()) == {"from", "to"} - copy_indy_proof_req["requested_predicates"][uuid][ - "non_revoked" - ] = pred_spec["non_revoked"] + copy_indy_proof_req["requested_predicates"][uuid]["non_revoked"] = ( + pred_spec["non_revoked"] + ) assert copy_indy_proof_req == indy_proof_req_revo diff --git a/aries_cloudagent/indy/sdk/tests/test_verifier.py b/aries_cloudagent/indy/sdk/tests/test_verifier.py index 964514c0c9..17eed7044d 100644 --- a/aries_cloudagent/indy/sdk/tests/test_verifier.py +++ b/aries_cloudagent/indy/sdk/tests/test_verifier.py @@ -572,9 +572,9 @@ async def test_check_pred_names_tamper_pred_req_attr(self, mock_verify): @mock.patch("indy.anoncreds.verifier_verify_proof") async def test_check_pred_names_tamper_attr_groups(self, mock_verify): INDY_PROOF_X = deepcopy(INDY_PROOF_PRED_NAMES) - INDY_PROOF_X["requested_proof"]["revealed_attr_groups"][ - "x_uuid" - ] = INDY_PROOF_X["requested_proof"]["revealed_attr_groups"].pop("18_uuid") + INDY_PROOF_X["requested_proof"]["revealed_attr_groups"]["x_uuid"] = ( + INDY_PROOF_X["requested_proof"]["revealed_attr_groups"].pop("18_uuid") + ) with mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: diff --git a/aries_cloudagent/indy/util.py b/aries_cloudagent/indy/util.py index 480e2f9652..d565f9d407 100644 --- a/aries_cloudagent/indy/util.py +++ b/aries_cloudagent/indy/util.py @@ -23,11 +23,11 @@ def indy_client_dir(subpath: str = None, create: bool = False) -> str: home = Path.home() target_dir = join( home, - "Documents" - if isdir(join(home, "Documents")) - else getenv("EXTERNAL_STORAGE", "") - if system() == "Linux" - else "", + ( + "Documents" + if isdir(join(home, "Documents")) + else getenv("EXTERNAL_STORAGE", "") if system() == "Linux" else "" + ), ".indy_client", subpath if subpath else "", "", # set trailing separator diff --git a/aries_cloudagent/ledger/merkel_validation/constants.py b/aries_cloudagent/ledger/merkel_validation/constants.py index 0b7489eb8c..73c5885222 100644 --- a/aries_cloudagent/ledger/merkel_validation/constants.py +++ b/aries_cloudagent/ledger/merkel_validation/constants.py @@ -1,4 +1,5 @@ """Constants for State Proof and LeafHash Inclusion Verification.""" + ALL_ATR_KEYS = ["raw", "enc", "hash"] LAST_SEQ_NO = "lsn" VALUE = "value" diff --git a/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py b/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py index 8a338659c6..5756bdf418 100644 --- a/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py +++ b/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py @@ -1,4 +1,5 @@ """Utilities for Processing Replies to Domain Read Requests.""" + import base58 import base64 import hashlib diff --git a/aries_cloudagent/ledger/merkel_validation/hasher.py b/aries_cloudagent/ledger/merkel_validation/hasher.py index bd9abf361c..8d036f3b38 100644 --- a/aries_cloudagent/ledger/merkel_validation/hasher.py +++ b/aries_cloudagent/ledger/merkel_validation/hasher.py @@ -1,4 +1,5 @@ """Merkle tree hasher for leaf and children nodes.""" + import hashlib from binascii import hexlify, unhexlify diff --git a/aries_cloudagent/ledger/merkel_validation/merkel_verifier.py b/aries_cloudagent/ledger/merkel_validation/merkel_verifier.py index c6e0dbb42a..244082a597 100644 --- a/aries_cloudagent/ledger/merkel_validation/merkel_verifier.py +++ b/aries_cloudagent/ledger/merkel_validation/merkel_verifier.py @@ -1,4 +1,5 @@ """Verify Leaf Inclusion.""" + from .hasher import TreeHasher diff --git a/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py b/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py index 4b1933e317..a6a8e3b439 100644 --- a/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py +++ b/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py @@ -1,4 +1,5 @@ """Tests for Domain Txn Handling Utils.""" + import base58 import json diff --git a/aries_cloudagent/ledger/merkel_validation/trie.py b/aries_cloudagent/ledger/merkel_validation/trie.py index 08eb958140..3c4ef18c6b 100644 --- a/aries_cloudagent/ledger/merkel_validation/trie.py +++ b/aries_cloudagent/ledger/merkel_validation/trie.py @@ -1,4 +1,5 @@ """Validates State Proof.""" + import json from collections import ( diff --git a/aries_cloudagent/ledger/merkel_validation/utils.py b/aries_cloudagent/ledger/merkel_validation/utils.py index c3240b36a5..75885bedbf 100644 --- a/aries_cloudagent/ledger/merkel_validation/utils.py +++ b/aries_cloudagent/ledger/merkel_validation/utils.py @@ -1,4 +1,5 @@ """Merkel Validation Utils.""" + from binascii import hexlify import hashlib diff --git a/aries_cloudagent/ledger/multiple_ledger/indy_manager.py b/aries_cloudagent/ledger/multiple_ledger/indy_manager.py index cf379b7913..786ffa926d 100644 --- a/aries_cloudagent/ledger/multiple_ledger/indy_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/indy_manager.py @@ -1,4 +1,5 @@ """Multiple IndySdkLedger Manager.""" + import asyncio import concurrent.futures import logging diff --git a/aries_cloudagent/ledger/multiple_ledger/indy_vdr_manager.py b/aries_cloudagent/ledger/multiple_ledger/indy_vdr_manager.py index 8d2c51c576..fd5ace6af9 100644 --- a/aries_cloudagent/ledger/multiple_ledger/indy_vdr_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/indy_vdr_manager.py @@ -1,4 +1,5 @@ """Multiple IndyVdrLedger Manager.""" + import asyncio import concurrent.futures import logging diff --git a/aries_cloudagent/ledger/multiple_ledger/ledger_config_schema.py b/aries_cloudagent/ledger/multiple_ledger/ledger_config_schema.py index e6f845a4d9..1981b6aa62 100644 --- a/aries_cloudagent/ledger/multiple_ledger/ledger_config_schema.py +++ b/aries_cloudagent/ledger/multiple_ledger/ledger_config_schema.py @@ -1,4 +1,5 @@ """Schema for configuring multiple ledgers.""" + import uuid from marshmallow import EXCLUDE, fields, pre_load diff --git a/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py b/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py index 0cf0b4dcb8..a4497f3d17 100644 --- a/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py +++ b/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py @@ -1,4 +1,5 @@ """Ledger Request Executor.""" + from typing import Optional, Tuple from ...config.base import InjectionError diff --git a/aries_cloudagent/messaging/decorators/attach_decorator.py b/aries_cloudagent/messaging/decorators/attach_decorator.py index 9b602e8f27..cdfa31a696 100644 --- a/aries_cloudagent/messaging/decorators/attach_decorator.py +++ b/aries_cloudagent/messaging/decorators/attach_decorator.py @@ -3,7 +3,6 @@ An attach decorator embeds content or specifies appended content. """ - import copy import json import uuid diff --git a/aries_cloudagent/messaging/models/base.py b/aries_cloudagent/messaging/models/base.py index d9139be964..c8fac4d5b2 100644 --- a/aries_cloudagent/messaging/models/base.py +++ b/aries_cloudagent/messaging/models/base.py @@ -132,8 +132,7 @@ def Schema(self) -> Type["BaseModelSchema"]: def deserialize( cls: Type[ModelType], obj, - ) -> ModelType: - ... + ) -> ModelType: ... @overload @classmethod @@ -142,8 +141,7 @@ def deserialize( obj, *, unknown: Optional[str] = None, - ) -> ModelType: - ... + ) -> ModelType: ... @overload @classmethod @@ -153,8 +151,7 @@ def deserialize( *, none2none: Literal[False], unknown: Optional[str] = None, - ) -> ModelType: - ... + ) -> ModelType: ... @overload @classmethod @@ -164,8 +161,7 @@ def deserialize( *, none2none: Literal[True], unknown: Optional[str] = None, - ) -> Optional[ModelType]: - ... + ) -> Optional[ModelType]: ... @classmethod def deserialize( @@ -209,16 +205,14 @@ def serialize( *, as_string: Literal[True], unknown: Optional[str] = None, - ) -> str: - ... + ) -> str: ... @overload def serialize( self, *, unknown: Optional[str] = None, - ) -> dict: - ... + ) -> dict: ... def serialize( self, diff --git a/aries_cloudagent/messaging/responder.py b/aries_cloudagent/messaging/responder.py index e978b0ee2c..12f0d3256f 100644 --- a/aries_cloudagent/messaging/responder.py +++ b/aries_cloudagent/messaging/responder.py @@ -3,6 +3,7 @@ The responder is provided to message handlers to enable them to send a new message in response to the message being handled. """ + import asyncio import json from abc import ABC, abstractmethod diff --git a/aries_cloudagent/messaging/util.py b/aries_cloudagent/messaging/util.py index e6c2ebcb98..acf1c9d962 100644 --- a/aries_cloudagent/messaging/util.py +++ b/aries_cloudagent/messaging/util.py @@ -1,6 +1,5 @@ """Utils for messages.""" - import logging import re diff --git a/aries_cloudagent/multitenant/route_manager.py b/aries_cloudagent/multitenant/route_manager.py index 03798f47ce..ac8530a741 100644 --- a/aries_cloudagent/multitenant/route_manager.py +++ b/aries_cloudagent/multitenant/route_manager.py @@ -1,6 +1,5 @@ """Multitenancy route manager.""" - import logging from typing import List, Optional diff --git a/aries_cloudagent/multitenant/tests/test_cache.py b/aries_cloudagent/multitenant/tests/test_cache.py index ab59847821..ad364371ef 100644 --- a/aries_cloudagent/multitenant/tests/test_cache.py +++ b/aries_cloudagent/multitenant/tests/test_cache.py @@ -4,11 +4,9 @@ class MockProfile(Profile): - def session(self, context=None): - ... + def session(self, context=None): ... - def transaction(self, context=None): - ... + def transaction(self, context=None): ... def test_get_not_in_cache(): diff --git a/aries_cloudagent/protocols/connections/v1_0/messages/connection_invitation.py b/aries_cloudagent/protocols/connections/v1_0/messages/connection_invitation.py index 03592102f1..a20c0fee4c 100644 --- a/aries_cloudagent/protocols/connections/v1_0/messages/connection_invitation.py +++ b/aries_cloudagent/protocols/connections/v1_0/messages/connection_invitation.py @@ -61,9 +61,11 @@ def __init__( self.routing_keys = list(routing_keys) if routing_keys else None self.routing_keys = ( [ - DIDKey.from_did(key).public_key_b58 - if key.startswith("did:key:") - else key + ( + DIDKey.from_did(key).public_key_b58 + if key.startswith("did:key:") + else key + ) for key in self.routing_keys ] if self.routing_keys @@ -174,9 +176,11 @@ def transform_routing_keys(self, data, **kwargs): routing_keys = data.get("routingKeys") if routing_keys: data["routingKeys"] = [ - DIDKey.from_did(key).public_key_b58 - if key.startswith("did:key:") - else key + ( + DIDKey.from_did(key).public_key_b58 + if key.startswith("did:key:") + else key + ) for key in routing_keys ] return data diff --git a/aries_cloudagent/protocols/coordinate_mediation/mediation_invite_store.py b/aries_cloudagent/protocols/coordinate_mediation/mediation_invite_store.py index 0e0eb85078..bd703d770e 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/mediation_invite_store.py +++ b/aries_cloudagent/protocols/coordinate_mediation/mediation_invite_store.py @@ -4,6 +4,7 @@ Enables having the mediation invite config be the same for `provision` and `starting` commands. """ + import json from typing import NamedTuple, Optional diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/controller.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/controller.py index 590362c288..fd71d083ff 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/controller.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/controller.py @@ -1,4 +1,5 @@ """Protocol controller for coordinate mediation.""" + from typing import Sequence diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_handler.py index 6d7225a64d..b93527d18f 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_handler.py @@ -1,4 +1,5 @@ """Handler for keylist message.""" + import logging from .....messaging.base_handler import BaseHandler, HandlerException diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_handler.py index 8c2b837aac..0719514cbc 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_handler.py @@ -1,4 +1,5 @@ """Test keylist handler.""" + import logging import pytest diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_query_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_query_handler.py index 9fb4e64433..5b4275b570 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_query_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_query_handler.py @@ -1,4 +1,5 @@ """Test handler for keylist-query message.""" + import pytest from unittest import IsolatedAsyncioTestCase diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_handler.py index 922ef80b98..45b90546a8 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_handler.py @@ -1,4 +1,5 @@ """Test handler for keylist-update message.""" + import pytest from unittest import IsolatedAsyncioTestCase diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py index 6437002428..b967e58536 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py @@ -1,4 +1,5 @@ """Test mediate deny message handler.""" + import pytest from unittest import IsolatedAsyncioTestCase diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_request_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_request_handler.py index e32fe4f9da..76f6918a36 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_request_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_request_handler.py @@ -1,4 +1,5 @@ """Test mediate request message handler.""" + import pytest from unittest import IsolatedAsyncioTestCase diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_problem_report_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_problem_report_handler.py index 7ec79632db..46eef13944 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_problem_report_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_problem_report_handler.py @@ -1,4 +1,5 @@ """Test Problem Report Handler.""" + import pytest diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py index a97055da63..99ba961090 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py @@ -1,4 +1,5 @@ """Manager for Mediation coordination.""" + import json import logging from typing import Dict, Optional, Sequence, Tuple diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/inner/keylist_update_rule.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/inner/keylist_update_rule.py index d66b5162b5..99576e5be8 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/inner/keylist_update_rule.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/inner/keylist_update_rule.py @@ -3,7 +3,6 @@ Represents single item of keylist-update.updates. """ - from marshmallow import fields from marshmallow.validate import OneOf diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py index b37f58dba7..5a262cd886 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py @@ -1,6 +1,5 @@ """mediate-deny message used to notify mediation client of a denied mediation request.""" - from .....messaging.agent_message import AgentMessage, AgentMessageSchema from ..message_types import MEDIATE_DENY, PROTOCOL_PACKAGE diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py index 2d47dc45eb..c8498ef9b2 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py @@ -1,6 +1,5 @@ """mediate-request message used to request mediation from a mediator.""" - from .....messaging.agent_message import AgentMessage, AgentMessageSchema from ..message_types import MEDIATE_REQUEST, PROTOCOL_PACKAGE diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist.py index a955580966..aa76fb34d3 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist.py @@ -1,4 +1,5 @@ """Test keylist message.""" + from unittest import TestCase from ...message_types import KEYLIST diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_query.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_query.py index 8aff024d52..9af6593a3f 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_query.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_query.py @@ -1,4 +1,5 @@ """Test keylist query message.""" + from unittest import TestCase from ...message_types import KEYLIST_QUERY diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update.py index caa0b3c976..d447aa4483 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update.py @@ -1,4 +1,5 @@ """Test keylist update message.""" + from unittest import TestCase from ...message_types import KEYLIST_UPDATE diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update_response.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update_response.py index e59ea63511..3b6ccaea42 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update_response.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_keylist_update_response.py @@ -1,4 +1,5 @@ """Test keylist update response message.""" + from unittest import TestCase from ...message_types import KEYLIST_UPDATE_RESPONSE diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py index bff806b0ed..869c2a305a 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py @@ -1,4 +1,5 @@ """Test mediate deny message.""" + from unittest import TestCase from ...message_types import MEDIATE_DENY diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_grant.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_grant.py index 9c992ff883..74e6426ea8 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_grant.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_grant.py @@ -1,4 +1,5 @@ """Test mediate grant message.""" + from unittest import TestCase from ...message_types import MEDIATE_GRANT diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py index bb9ee0713b..6e4852c658 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py @@ -1,4 +1,5 @@ """Test mediate request message.""" + from unittest import TestCase from ...message_types import MEDIATE_REQUEST diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_problem_report.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_problem_report.py index fe0b5a8722..526f748390 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_problem_report.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_problem_report.py @@ -1,4 +1,5 @@ """Test Problem Report Message.""" + import pytest from unittest import mock diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py index 546f1f2128..a1eab7e846 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py @@ -1,4 +1,5 @@ """Test mediation record.""" + import json import pytest diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py index 28fee2ce89..a1b2abe751 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py @@ -1,4 +1,5 @@ """Normalization methods used while transitioning to DID:Key method.""" + from typing import Union from ....did.did_key import DIDKey from ....wallet.key_type import ED25519 diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager.py index c83e7984ec..4a21fa8c59 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager.py @@ -3,7 +3,6 @@ Set up routing for newly formed connections. """ - from abc import ABC, abstractmethod import logging from typing import List, NamedTuple, Optional diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager_provider.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager_provider.py index a48dddaec8..4c329a0c3b 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager_provider.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager_provider.py @@ -1,4 +1,5 @@ """RouteManager provider.""" + from ....config.base import BaseInjector, BaseProvider, BaseSettings from ....core.profile import Profile from ....multitenant.base import BaseMultitenantManager diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py index 05e39d6686..7718a10ee0 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py @@ -1,4 +1,5 @@ """Test MediationManager.""" + import pytest from aries_cloudagent.tests import mock diff --git a/aries_cloudagent/protocols/didcomm_prefix.py b/aries_cloudagent/protocols/didcomm_prefix.py index 4c5b978ce1..dea36b7752 100644 --- a/aries_cloudagent/protocols/didcomm_prefix.py +++ b/aries_cloudagent/protocols/didcomm_prefix.py @@ -1,4 +1,5 @@ """DIDComm prefix management.""" + import re from enum import Enum diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/request_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/request_handler.py index a76807db73..594df441a5 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/request_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/request_handler.py @@ -1,6 +1,5 @@ """Connection request handler under RFC 23 (DID exchange).""" - from .....connections.models.conn_record import ConnRecord from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ....coordinate_mediation.v1_0.manager import MediationManager diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/response_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/response_handler.py index 4dae2bf54d..26e3e18659 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/response_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/response_handler.py @@ -1,6 +1,5 @@ """DID exchange response handler under RFC 23.""" - from .....messaging.base_handler import ( BaseHandler, BaseResponder, diff --git a/aries_cloudagent/protocols/didexchange/v1_0/manager.py b/aries_cloudagent/protocols/didexchange/v1_0/manager.py index e22520dbd8..60bdbc8808 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/manager.py @@ -227,9 +227,9 @@ async def create_request_implicit( ) ) conn_rec = ConnRecord( - my_did=my_public_info.did - if my_public_info - else None, # create-request will fill in on local DID creation + my_did=( + my_public_info.did if my_public_info else None + ), # create-request will fill in on local DID creation their_did=their_public_did, their_label=None, their_role=ConnRecord.Role.RESPONDER.rfc23, diff --git a/aries_cloudagent/protocols/discovery/v1_0/models/discovery_record.py b/aries_cloudagent/protocols/discovery/v1_0/models/discovery_record.py index 70862f89d6..66be14fa17 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/models/discovery_record.py +++ b/aries_cloudagent/protocols/discovery/v1_0/models/discovery_record.py @@ -1,4 +1,5 @@ """.""" + import logging from typing import Any, Mapping, Union diff --git a/aries_cloudagent/protocols/discovery/v2_0/models/discovery_record.py b/aries_cloudagent/protocols/discovery/v2_0/models/discovery_record.py index 5d4cbaa2d0..7993534c6d 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/models/discovery_record.py +++ b/aries_cloudagent/protocols/discovery/v2_0/models/discovery_record.py @@ -1,4 +1,5 @@ """.""" + import logging from typing import Any, Mapping, Sequence, Union diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/manager.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/manager.py index 2137f23a5d..8952808c4d 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/manager.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/manager.py @@ -140,12 +140,16 @@ async def create_request( "context": TransactionRecord.SIGNATURE_CONTEXT, "method": TransactionRecord.ADD_SIGNATURE, "signature_type": TransactionRecord.SIGNATURE_TYPE, - "signer_goal_code": signer_goal_code - if signer_goal_code - else TransactionRecord.ENDORSE_TRANSACTION, - "author_goal_code": author_goal_code - if author_goal_code - else TransactionRecord.WRITE_TRANSACTION, + "signer_goal_code": ( + signer_goal_code + if signer_goal_code + else TransactionRecord.ENDORSE_TRANSACTION + ), + "author_goal_code": ( + author_goal_code + if author_goal_code + else TransactionRecord.WRITE_TRANSACTION + ), } transaction.signature_request.clear() transaction.signature_request.append(signature_request) diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/util.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/util.py index bf5ad810d2..dee6c34121 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/util.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/util.py @@ -1,6 +1,5 @@ """Endorser utilities.""" - from ....connections.models.conn_record import ConnRecord from ....core.profile import Profile diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_ack_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_ack_handler.py index 1c7f2f7d87..b7220f1409 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_ack_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_ack_handler.py @@ -47,9 +47,11 @@ async def handle(self, context: RequestContext, responder: BaseResponder): credential_manager = CredentialManager(context.profile) await credential_manager.receive_credential_ack( context.message, - context.connection_record.connection_id - if context.connection_record - else None, + ( + context.connection_record.connection_id + if context.connection_record + else None + ), ) trace_event( diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_issue_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_issue_handler.py index 778a9985aa..208076b60e 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_issue_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_issue_handler.py @@ -51,9 +51,11 @@ async def handle(self, context: RequestContext, responder: BaseResponder): credential_manager = CredentialManager(profile) cred_ex_record = await credential_manager.receive_credential( context.message, - context.connection_record.connection_id - if context.connection_record - else None, + ( + context.connection_record.connection_id + if context.connection_record + else None + ), ) # mgr only finds, saves record: on exception, saving state null is hopeless r_time = trace_event( diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_offer_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_offer_handler.py index f2e1b0e324..a389e5176b 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_offer_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_offer_handler.py @@ -1,6 +1,5 @@ """Credential offer message handler.""" - from .....wallet.util import default_did_from_verkey from .....core.oob_processor import OobMessageProcessor from .....indy.holder import IndyHolderError diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/credential_preview.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/credential_preview.py index 5ec5260c3c..0e9f011e11 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/credential_preview.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/credential_preview.py @@ -1,6 +1,5 @@ """A credential preview inner object.""" - from typing import Sequence from marshmallow import EXCLUDE, fields diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/handler.py index 93fd149519..c1949d2486 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/handler.py @@ -1,6 +1,5 @@ """V2.0 issue-credential linked data proof credential format handler.""" - import logging from typing import Mapping diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_ack_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_ack_handler.py index 26f5d10498..7104b08bbd 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_ack_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_ack_handler.py @@ -47,9 +47,11 @@ async def handle(self, context: RequestContext, responder: BaseResponder): cred_manager = V20CredManager(context.profile) await cred_manager.receive_credential_ack( context.message, - context.connection_record.connection_id - if context.connection_record - else None, + ( + context.connection_record.connection_id + if context.connection_record + else None + ), ) trace_event( diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_issue_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_issue_handler.py index 0b91be6151..1b6bd7398f 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_issue_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_issue_handler.py @@ -53,9 +53,11 @@ async def handle(self, context: RequestContext, responder: BaseResponder): cred_manager = V20CredManager(context.profile) cred_ex_record = await cred_manager.receive_credential( context.message, - context.connection_record.connection_id - if context.connection_record - else None, + ( + context.connection_record.connection_id + if context.connection_record + else None + ), ) # mgr only finds, saves record: on exception, saving null state is hopeless r_time = trace_event( diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_problem_report_handler.py b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_problem_report_handler.py index 692f1e48f6..5e4d6bedb4 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_problem_report_handler.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_problem_report_handler.py @@ -1,4 +1,5 @@ """Test Problem Report Handler.""" + import pytest from aries_cloudagent.tests import mock diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_accept_handler.py b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_accept_handler.py index 905c218f8d..660c3b7688 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_accept_handler.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_accept_handler.py @@ -1,4 +1,5 @@ """Test Reuse Accept Message Handler.""" + import pytest from aries_cloudagent.tests import mock diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_handler.py b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_handler.py index 2e6982aef2..2600c1db64 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_handler.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/tests/test_reuse_handler.py @@ -1,4 +1,5 @@ """Test Reuse Message Handler.""" + import pytest from aries_cloudagent.tests import mock diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/manager.py b/aries_cloudagent/protocols/out_of_band/v1_0/manager.py index 7ddbbdc847..8ff3573ecd 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/manager.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/manager.py @@ -254,9 +254,11 @@ async def create_invitation( invitation_mode=invitation_mode, their_role=ConnRecord.Role.REQUESTER.rfc23, state=ConnRecord.State.INVITATION.rfc23, - accept=ConnRecord.ACCEPT_AUTO - if auto_accept - else ConnRecord.ACCEPT_MANUAL, + accept=( + ConnRecord.ACCEPT_AUTO + if auto_accept + else ConnRecord.ACCEPT_MANUAL + ), alias=alias, connection_protocol=connection_protocol, ) @@ -305,9 +307,11 @@ async def create_invitation( invitation_key=connection_key.verkey, their_role=ConnRecord.Role.REQUESTER.rfc23, state=ConnRecord.State.INVITATION.rfc23, - accept=ConnRecord.ACCEPT_AUTO - if auto_accept - else ConnRecord.ACCEPT_MANUAL, + accept=( + ConnRecord.ACCEPT_AUTO + if auto_accept + else ConnRecord.ACCEPT_MANUAL + ), invitation_mode=invitation_mode, alias=alias, connection_protocol=connection_protocol, @@ -334,9 +338,11 @@ async def create_invitation( ) routing_keys = [ - key - if len(key.split(":")) == 3 - else DIDKey.from_public_key_b58(key, ED25519).key_id + ( + key + if len(key.split(":")) == 3 + else DIDKey.from_public_key_b58(key, ED25519).key_id + ) for key in routing_keys or [] ] diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_problem_report.py b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_problem_report.py index 4adfd23602..daec556722 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_problem_report.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_problem_report.py @@ -1,4 +1,5 @@ """Test Problem Report Message.""" + import pytest from unittest import mock diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse.py b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse.py index b81721b0a4..53789417f8 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse.py @@ -1,4 +1,5 @@ """Test Reuse Message.""" + import pytest from unittest import TestCase diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse_accept.py b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse_accept.py index 269a36cd3c..667abb4160 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse_accept.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_reuse_accept.py @@ -1,4 +1,5 @@ """Test Reuse Accept Message.""" + import pytest from unittest import TestCase diff --git a/aries_cloudagent/protocols/present_proof/anoncreds/pres_exch_handler.py b/aries_cloudagent/protocols/present_proof/anoncreds/pres_exch_handler.py index 416c13a2a9..4500af07b9 100644 --- a/aries_cloudagent/protocols/present_proof/anoncreds/pres_exch_handler.py +++ b/aries_cloudagent/protocols/present_proof/anoncreds/pres_exch_handler.py @@ -1,4 +1,5 @@ """Utilities for dif presentation exchange attachment.""" + import json import logging import time @@ -217,13 +218,13 @@ def _set_timestamps(self, requested_credentials: dict, requested_referents: dict if "timestamp" not in precis: continue if referent in requested_credentials["requested_attributes"]: - requested_credentials["requested_attributes"][referent][ - "timestamp" - ] = precis["timestamp"] + requested_credentials["requested_attributes"][referent]["timestamp"] = ( + precis["timestamp"] + ) if referent in requested_credentials["requested_predicates"]: - requested_credentials["requested_predicates"][referent][ - "timestamp" - ] = precis["timestamp"] + requested_credentials["requested_predicates"][referent]["timestamp"] = ( + precis["timestamp"] + ) async def return_presentation( self, diff --git a/aries_cloudagent/protocols/present_proof/dif/pres_exch.py b/aries_cloudagent/protocols/present_proof/dif/pres_exch.py index 7018da2d78..0d46046ea9 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_exch.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_exch.py @@ -1,4 +1,5 @@ """Schemas for dif presentation exchange attachment.""" + from typing import Mapping, Optional, Sequence from marshmallow import ( diff --git a/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py b/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py index 40ef6a43c9..995ff36050 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py @@ -7,6 +7,7 @@ merge [return applicable credential list and descriptor_map for presentation_submission] returns VerifiablePresentation """ + import pytz import re import logging diff --git a/aries_cloudagent/protocols/present_proof/dif/pres_proposal_schema.py b/aries_cloudagent/protocols/present_proof/dif/pres_proposal_schema.py index 604443435b..b5c12944d1 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_proposal_schema.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_proposal_schema.py @@ -1,4 +1,5 @@ """DIF Proof Proposal Schema.""" + from marshmallow import fields from ....messaging.models.openapi import OpenAPISchema diff --git a/aries_cloudagent/protocols/present_proof/dif/pres_request_schema.py b/aries_cloudagent/protocols/present_proof/dif/pres_request_schema.py index 20ee950c64..2f0bec6cf0 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_request_schema.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_request_schema.py @@ -1,4 +1,5 @@ """DIF Proof Request Schema.""" + from typing import Optional, Union from marshmallow import INCLUDE, fields diff --git a/aries_cloudagent/protocols/present_proof/dif/pres_schema.py b/aries_cloudagent/protocols/present_proof/dif/pres_schema.py index 141bdb79ea..5f2933fef3 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_schema.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_schema.py @@ -1,4 +1,5 @@ """DIF Proof Schema.""" + from marshmallow import fields from ....messaging.models.openapi import OpenAPISchema diff --git a/aries_cloudagent/protocols/present_proof/dif/tests/test_data.py b/aries_cloudagent/protocols/present_proof/dif/tests/test_data.py index 96a538fccb..eaa4661cab 100644 --- a/aries_cloudagent/protocols/present_proof/dif/tests/test_data.py +++ b/aries_cloudagent/protocols/present_proof/dif/tests/test_data.py @@ -1,4 +1,5 @@ """Data for DIFPresExchHandler.""" + import json from .....storage.vc_holder.vc_record import VCRecord diff --git a/aries_cloudagent/protocols/present_proof/dif/tests/test_pres_exch.py b/aries_cloudagent/protocols/present_proof/dif/tests/test_pres_exch.py index 6544e88d88..520f065bc3 100644 --- a/aries_cloudagent/protocols/present_proof/dif/tests/test_pres_exch.py +++ b/aries_cloudagent/protocols/present_proof/dif/tests/test_pres_exch.py @@ -1,4 +1,5 @@ """Test for DIF PresExch Schemas.""" + import json from unittest import TestCase diff --git a/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py b/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py index 4bff88cc89..1c6b036d77 100644 --- a/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py +++ b/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py @@ -1,4 +1,5 @@ """Utilities for dif presentation exchange attachment.""" + import json import logging import time @@ -116,10 +117,11 @@ async def return_presentation( if credential.get("rev_reg_id"): revocation_registry_id = credential["rev_reg_id"] if revocation_registry_id not in revocation_registries: - revocation_registries[ - revocation_registry_id - ] = RevocationRegistry.from_definition( - await ledger.get_revoc_reg_def(revocation_registry_id), True + revocation_registries[revocation_registry_id] = ( + RevocationRegistry.from_definition( + await ledger.get_revoc_reg_def(revocation_registry_id), + True, + ) ) # Get delta with non-revocation interval defined in "non_revoked" # of the presentation request or attributes @@ -198,13 +200,13 @@ async def return_presentation( if "timestamp" not in precis: continue if referent in requested_credentials["requested_attributes"]: - requested_credentials["requested_attributes"][referent][ - "timestamp" - ] = precis["timestamp"] + requested_credentials["requested_attributes"][referent]["timestamp"] = ( + precis["timestamp"] + ) if referent in requested_credentials["requested_predicates"]: - requested_credentials["requested_predicates"][referent][ - "timestamp" - ] = precis["timestamp"] + requested_credentials["requested_predicates"][referent]["timestamp"] = ( + precis["timestamp"] + ) indy_proof_json = await holder.create_presentation( proof_request, requested_credentials, @@ -250,17 +252,17 @@ async def process_pres_identifiers( ) if identifier["cred_def_id"] not in cred_defs: - cred_defs[ - identifier["cred_def_id"] - ] = await ledger.get_credential_definition( - identifier["cred_def_id"] + cred_defs[identifier["cred_def_id"]] = ( + await ledger.get_credential_definition( + identifier["cred_def_id"] + ) ) if identifier.get("rev_reg_id"): if identifier["rev_reg_id"] not in rev_reg_defs: - rev_reg_defs[ - identifier["rev_reg_id"] - ] = await ledger.get_revoc_reg_def(identifier["rev_reg_id"]) + rev_reg_defs[identifier["rev_reg_id"]] = ( + await ledger.get_revoc_reg_def(identifier["rev_reg_id"]) + ) if identifier.get("timestamp"): rev_reg_entries.setdefault(identifier["rev_reg_id"], {}) diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_problem_report_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_problem_report_handler.py index 8e84ffec06..7a0f9e4060 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_problem_report_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_problem_report_handler.py @@ -35,9 +35,11 @@ async def handle(self, context: RequestContext, responder: BaseResponder): try: await presentation_manager.receive_problem_report( context.message, - context.connection_record.connection_id - if context.connection_record is not None - else None, + ( + context.connection_record.connection_id + if context.connection_record is not None + else None + ), ) except (StorageError, StorageNotFoundError): self._logger.exception( diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_request_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_request_handler.py index a34cdde4cd..80f862d296 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_request_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_request_handler.py @@ -69,15 +69,15 @@ async def handle(self, context: RequestContext, responder: BaseResponder): # or create it (verifier sent request first) try: async with profile.session() as session: - ( - presentation_exchange_record - ) = await V10PresentationExchange.retrieve_by_tag_filter( - session, - {"thread_id": context.message._thread_id}, - { - "role": V10PresentationExchange.ROLE_PROVER, - "connection_id": connection_id, - }, + (presentation_exchange_record) = ( + await V10PresentationExchange.retrieve_by_tag_filter( + session, + {"thread_id": context.message._thread_id}, + { + "role": V10PresentationExchange.ROLE_PROVER, + "connection_id": connection_id, + }, + ) ) # holder initiated via proposal presentation_exchange_record.presentation_request = indy_proof_request presentation_exchange_record.presentation_request_dict = ( diff --git a/aries_cloudagent/protocols/present_proof/v1_0/manager.py b/aries_cloudagent/protocols/present_proof/v1_0/manager.py index 6da1b38859..187842fde5 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/manager.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/manager.py @@ -516,16 +516,16 @@ async def receive_presentation_ack( connection_id = connection_record.connection_id if connection_record else None async with self._profile.session() as session: - ( - presentation_exchange_record - ) = await V10PresentationExchange.retrieve_by_tag_filter( - session, - {"thread_id": message._thread_id}, - { - # connection_id can be null in connectionless - "connection_id": connection_id, - "role": V10PresentationExchange.ROLE_PROVER, - }, + (presentation_exchange_record) = ( + await V10PresentationExchange.retrieve_by_tag_filter( + session, + {"thread_id": message._thread_id}, + { + # connection_id can be null in connectionless + "connection_id": connection_id, + "role": V10PresentationExchange.ROLE_PROVER, + }, + ) ) presentation_exchange_record.verified = message._verification_result presentation_exchange_record.state = ( diff --git a/aries_cloudagent/protocols/present_proof/v2_0/formats/handler.py b/aries_cloudagent/protocols/present_proof/v2_0/formats/handler.py index 1d8a2e5d07..1173ddb936 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/formats/handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/formats/handler.py @@ -1,4 +1,5 @@ """present-proof-v2 format handler - supports DIF and INDY.""" + from abc import ABC, abstractclassmethod, abstractmethod import logging diff --git a/aries_cloudagent/protocols/present_proof/v2_0/manager.py b/aries_cloudagent/protocols/present_proof/v2_0/manager.py index 083dcac5ac..e08d816880 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/manager.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/manager.py @@ -331,9 +331,7 @@ async def receive_pres( connection_id = ( None if oob_record - else connection_record.connection_id - if connection_record - else None + else connection_record.connection_id if connection_record else None ) async with self._profile.session() as session: diff --git a/aries_cloudagent/protocols/revocation_notification/v1_0/routes.py b/aries_cloudagent/protocols/revocation_notification/v1_0/routes.py index cdefdaf642..4b577315a2 100644 --- a/aries_cloudagent/protocols/revocation_notification/v1_0/routes.py +++ b/aries_cloudagent/protocols/revocation_notification/v1_0/routes.py @@ -1,4 +1,5 @@ """Routes for revocation notification.""" + import logging import re diff --git a/aries_cloudagent/protocols/revocation_notification/v1_0/tests/test_routes.py b/aries_cloudagent/protocols/revocation_notification/v1_0/tests/test_routes.py index 4e4925cd61..0cd23a8b04 100644 --- a/aries_cloudagent/protocols/revocation_notification/v1_0/tests/test_routes.py +++ b/aries_cloudagent/protocols/revocation_notification/v1_0/tests/test_routes.py @@ -1,4 +1,5 @@ """Test routes.py""" + from aries_cloudagent.tests import mock import pytest diff --git a/aries_cloudagent/protocols/revocation_notification/v2_0/routes.py b/aries_cloudagent/protocols/revocation_notification/v2_0/routes.py index 83ba81fe63..9c62a16c15 100644 --- a/aries_cloudagent/protocols/revocation_notification/v2_0/routes.py +++ b/aries_cloudagent/protocols/revocation_notification/v2_0/routes.py @@ -1,4 +1,5 @@ """Routes for revocation notification.""" + import logging import re diff --git a/aries_cloudagent/protocols/revocation_notification/v2_0/tests/test_routes.py b/aries_cloudagent/protocols/revocation_notification/v2_0/tests/test_routes.py index 624f831119..526ed00e72 100644 --- a/aries_cloudagent/protocols/revocation_notification/v2_0/tests/test_routes.py +++ b/aries_cloudagent/protocols/revocation_notification/v2_0/tests/test_routes.py @@ -1,4 +1,5 @@ """Test routes.py""" + from aries_cloudagent.tests import mock import pytest diff --git a/aries_cloudagent/protocols/routing/v1_0/models/route_record.py b/aries_cloudagent/protocols/routing/v1_0/models/route_record.py index 1ccde542ee..94545e8d70 100644 --- a/aries_cloudagent/protocols/routing/v1_0/models/route_record.py +++ b/aries_cloudagent/protocols/routing/v1_0/models/route_record.py @@ -1,6 +1,5 @@ """An object for containing information on an individual route.""" - from marshmallow import EXCLUDE, fields, validates_schema, ValidationError from .....core.profile import ProfileSession diff --git a/aries_cloudagent/resolver/default/legacy_peer.py b/aries_cloudagent/resolver/default/legacy_peer.py index 623afff3b2..56bec90872 100644 --- a/aries_cloudagent/resolver/default/legacy_peer.py +++ b/aries_cloudagent/resolver/default/legacy_peer.py @@ -161,9 +161,11 @@ def didcomm_services_recip_keys_are_refs_routing_keys_are_did_key_ref( ] if "routingKeys" in service: service["routingKeys"] = [ - DIDKey.from_public_key_b58(key, ED25519).key_id - if "did:key:" not in key - else cls.did_key_to_did_key_ref(key) + ( + DIDKey.from_public_key_b58(key, ED25519).key_id + if "did:key:" not in key + else cls.did_key_to_did_key_ref(key) + ) for key in service["routingKeys"] ] return value diff --git a/aries_cloudagent/revocation/indy.py b/aries_cloudagent/revocation/indy.py index 622ef3f583..0f0c4114eb 100644 --- a/aries_cloudagent/revocation/indy.py +++ b/aries_cloudagent/revocation/indy.py @@ -1,4 +1,5 @@ """Indy revocation registry management.""" + import logging from typing import Optional, Sequence, Tuple from uuid import uuid4 diff --git a/aries_cloudagent/revocation/models/revocation_registry.py b/aries_cloudagent/revocation/models/revocation_registry.py index cfb97eb467..56d223d9e5 100644 --- a/aries_cloudagent/revocation/models/revocation_registry.py +++ b/aries_cloudagent/revocation/models/revocation_registry.py @@ -1,4 +1,5 @@ """Classes for managing a revocation registry.""" + import http import logging import os diff --git a/aries_cloudagent/tests/mock.py b/aries_cloudagent/tests/mock.py index 0df4f3bd3b..4948274cdb 100644 --- a/aries_cloudagent/tests/mock.py +++ b/aries_cloudagent/tests/mock.py @@ -1,4 +1,5 @@ """Mock utilities.""" + from unittest.mock import AsyncMock, MagicMock, patch, create_autospec, Mock, ANY diff --git a/aries_cloudagent/transport/inbound/delivery_queue.py b/aries_cloudagent/transport/inbound/delivery_queue.py index c22a2b91cf..d08ac30668 100644 --- a/aries_cloudagent/transport/inbound/delivery_queue.py +++ b/aries_cloudagent/transport/inbound/delivery_queue.py @@ -4,6 +4,7 @@ been delivered to their intended destination. """ + import time from ..outbound.message import OutboundMessage diff --git a/aries_cloudagent/transport/inbound/http.py b/aries_cloudagent/transport/inbound/http.py index a3bdaecd78..028bc6a174 100644 --- a/aries_cloudagent/transport/inbound/http.py +++ b/aries_cloudagent/transport/inbound/http.py @@ -110,11 +110,13 @@ async def inbound_message_handler(self, request: web.BaseRequest): body=response, status=200, headers={ - "Content-Type": DIDCOMM_V1_MIME_TYPE - if session.profile.settings.get( - "emit_new_didcomm_mime_type" + "Content-Type": ( + DIDCOMM_V1_MIME_TYPE + if session.profile.settings.get( + "emit_new_didcomm_mime_type" + ) + else DIDCOMM_V0_MIME_TYPE ) - else DIDCOMM_V0_MIME_TYPE }, ) else: diff --git a/aries_cloudagent/utils/multi_ledger.py b/aries_cloudagent/utils/multi_ledger.py index fc241bd8ac..1cde32d938 100644 --- a/aries_cloudagent/utils/multi_ledger.py +++ b/aries_cloudagent/utils/multi_ledger.py @@ -1,4 +1,5 @@ """Multiledger related utility methods.""" + from collections import OrderedDict from ..core.error import ProfileError diff --git a/aries_cloudagent/vc/ld_proofs/document_downloader.py b/aries_cloudagent/vc/ld_proofs/document_downloader.py index 19c64bbb97..2a4a794a34 100644 --- a/aries_cloudagent/vc/ld_proofs/document_downloader.py +++ b/aries_cloudagent/vc/ld_proofs/document_downloader.py @@ -2,6 +2,7 @@ Allows keeping some context in local filesystem. """ + import logging import re import string diff --git a/aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py b/aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py index cb54192903..c6846168f2 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py +++ b/aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py @@ -1,6 +1,5 @@ """Abstract base class for linked data proofs.""" - from abc import ABC from typing import ClassVar, List, Optional, Union diff --git a/aries_cloudagent/vc/vc_ld/manager.py b/aries_cloudagent/vc/vc_ld/manager.py index 66afd27ee9..d37a2da47e 100644 --- a/aries_cloudagent/vc/vc_ld/manager.py +++ b/aries_cloudagent/vc/vc_ld/manager.py @@ -1,6 +1,5 @@ """Manager for performing Linked Data Proof signatures over JSON-LD formatted W3C VCs.""" - from typing import Dict, List, Optional, Type, Union, cast from ...core.profile import Profile diff --git a/aries_cloudagent/vc/vc_ld/models/options.py b/aries_cloudagent/vc/vc_ld/models/options.py index f34ef3c5ab..a3dcd5571b 100644 --- a/aries_cloudagent/vc/vc_ld/models/options.py +++ b/aries_cloudagent/vc/vc_ld/models/options.py @@ -1,6 +1,5 @@ """Options for specifying how the linked data proof is created.""" - from typing import Optional from marshmallow import INCLUDE, Schema, fields diff --git a/aries_cloudagent/vc/vc_ld/tests/test_manager.py b/aries_cloudagent/vc/vc_ld/tests/test_manager.py index 0f2b06888f..9ac728b5a8 100644 --- a/aries_cloudagent/vc/vc_ld/tests/test_manager.py +++ b/aries_cloudagent/vc/vc_ld/tests/test_manager.py @@ -1,4 +1,5 @@ """Test VcLdpManager.""" + import pytest from aries_cloudagent.tests import mock diff --git a/aries_cloudagent/wallet/default_verification_key_strategy.py b/aries_cloudagent/wallet/default_verification_key_strategy.py index 4f580618b3..82e0dd88e5 100644 --- a/aries_cloudagent/wallet/default_verification_key_strategy.py +++ b/aries_cloudagent/wallet/default_verification_key_strategy.py @@ -1,4 +1,5 @@ """Utilities for specifying which verification method is in use for a given DID.""" + from abc import ABC, abstractmethod from typing import Optional, List diff --git a/aries_cloudagent/wallet/routes.py b/aries_cloudagent/wallet/routes.py index bfb4dd7ea5..d9baa3770e 100644 --- a/aries_cloudagent/wallet/routes.py +++ b/aries_cloudagent/wallet/routes.py @@ -853,10 +853,10 @@ async def promote_wallet_public_did( if is_ctx_admin_request else profile.inject(RouteManager) ) - await route_manager.route_verkey( - context.profile, info.verkey - ) if is_ctx_admin_request else await route_manager.route_verkey( - profile, info.verkey + ( + await route_manager.route_verkey(context.profile, info.verkey) + if is_ctx_admin_request + else await route_manager.route_verkey(profile, info.verkey) ) return info, attrib_def diff --git a/aries_cloudagent/wallet/sd_jwt.py b/aries_cloudagent/wallet/sd_jwt.py index 59f3291995..951f318906 100644 --- a/aries_cloudagent/wallet/sd_jwt.py +++ b/aries_cloudagent/wallet/sd_jwt.py @@ -162,9 +162,9 @@ async def sd_jwt_sign( match.context.value.remove(match.value) match.context.value.append(SDObj(match.value)) else: - match.context.value[ - SDObj(str(match.path)) - ] = match.context.value.pop(str(match.path)) + match.context.value[SDObj(str(match.path))] = ( + match.context.value.pop(str(match.path)) + ) return await SDJWTIssuerACAPy( user_claims=payload, diff --git a/demo/runners/agent_container.py b/demo/runners/agent_container.py index f4b7506dd8..b2db5ed138 100644 --- a/demo/runners/agent_container.py +++ b/demo/runners/agent_container.py @@ -1019,12 +1019,14 @@ async def request_proof(self, proof_request, explicit_revoc_required: bool = Fal CRED_FORMAT_INDY, ]: indy_proof_request = { - "name": proof_request["name"] - if "name" in proof_request - else "Proof of stuff", - "version": proof_request["version"] - if "version" in proof_request - else "1.0", + "name": ( + proof_request["name"] + if "name" in proof_request + else "Proof of stuff" + ), + "version": ( + proof_request["version"] if "version" in proof_request else "1.0" + ), "requested_attributes": proof_request["requested_attributes"], "requested_predicates": proof_request["requested_predicates"], } diff --git a/demo/runners/faber.py b/demo/runners/faber.py index 252c8c4a3c..d8b9e4347f 100644 --- a/demo/runners/faber.py +++ b/demo/runners/faber.py @@ -439,9 +439,11 @@ async def main(args): the_agent=agent, schema_name=faber_schema_name, schema_attrs=faber_schema_attrs, - create_endorser_agent=(faber_agent.endorser_role == "author") - if faber_agent.endorser_role - else False, + create_endorser_agent=( + (faber_agent.endorser_role == "author") + if faber_agent.endorser_role + else False + ), ) elif faber_agent.cred_type == CRED_FORMAT_JSON_LD: faber_agent.public_did = True diff --git a/poetry.lock b/poetry.lock index f03d21a159..4be98709e7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1932,13 +1932,13 @@ files = [ [[package]] name = "pydid" -version = "0.4.2" +version = "0.4.3" description = "Python library for validating, constructing, and representing DIDs and DID Documents" optional = false python-versions = ">=3.8.0,<4.0.0" files = [ - {file = "pydid-0.4.2-py3-none-any.whl", hash = "sha256:45994eb14be745da421f31c55f5c436976d5b4ec5fb704e4a9346c59837fa2f2"}, - {file = "pydid-0.4.2.tar.gz", hash = "sha256:2d2a4a9291f6ac99962aa7152a27b47a9582d13032da4bbb88e9232d513f855f"}, + {file = "pydid-0.4.3-py3-none-any.whl", hash = "sha256:39a586b4f26c41277b93db2aaf0a2db298f48ccc413bdfc71b7dd010045f31f4"}, + {file = "pydid-0.4.3.tar.gz", hash = "sha256:1a48a6940bae8279083ebb7c5ab5fe0249e9ba3ea638de9cf8c127487b96b2ef"}, ] [package.dependencies] @@ -2893,4 +2893,4 @@ indy = ["python3-indy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "285e53bb5476a7fd6355bbe59061735227bd7ba0ccdc4ec45004aeb406b23473" +content-hash = "89c521256de4ccf6f260fb168512dfb1d3419b5c23976840d3d77c49e9a330f6" diff --git a/pyproject.toml b/pyproject.toml index 6d3a539d68..e1a8ef8dfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ nest_asyncio="~1.5.5" packaging="~23.1" portalocker="~2.7.0" prompt_toolkit=">=2.0.9,<2.1.0" -pydid="^0.4.0" +pydid="^0.4.3" pyjwt="~2.8.0" pyld="~2.0.3" pynacl="~1.5.0"