diff --git a/aries_cloudagent/admin/server.py b/aries_cloudagent/admin/server.py index 6834f9ec34..9e489f2690 100644 --- a/aries_cloudagent/admin/server.py +++ b/aries_cloudagent/admin/server.py @@ -652,7 +652,9 @@ async def _on_record_event(self, profile: Profile, event: Event): if webhook_topic: await self.send_webhook(profile, webhook_topic, event.payload) - async def send_webhook(self, profile: Profile, topic: str, payload: Optional[dict] = None): + async def send_webhook( + self, profile: Profile, topic: str, payload: Optional[dict] = None + ): """Add a webhook to the queue, to send to all registered targets.""" wallet_id = profile.settings.get("wallet.id") webhook_urls = profile.settings.get("admin.webhook_urls") diff --git a/aries_cloudagent/anoncreds/holder.py b/aries_cloudagent/anoncreds/holder.py index 17de18435b..04a1a16fac 100644 --- a/aries_cloudagent/anoncreds/holder.py +++ b/aries_cloudagent/anoncreds/holder.py @@ -515,7 +515,10 @@ async def _get_credential(self, credential_id: str) -> Credential: raise AnonCredsHolderError("Error loading requested credential") from err async def credential_revoked( - self, credential_id: str, timestamp_from: Optional[int] = None, timestamp_to: Optional[int] = None + self, + credential_id: str, + timestamp_from: Optional[int] = None, + timestamp_to: Optional[int] = None, ) -> bool: """Check ledger for revocation status of credential by credential id. diff --git a/aries_cloudagent/askar/profile_anon.py b/aries_cloudagent/askar/profile_anon.py index 437da10f20..71c66f2364 100644 --- a/aries_cloudagent/askar/profile_anon.py +++ b/aries_cloudagent/askar/profile_anon.py @@ -159,7 +159,9 @@ def bind_providers(self): BaseLedger, ClassProvider(IndyVdrLedger, self.ledger_pool, ref(self)) ) - def session(self, context: Optional[InjectionContext] = None) -> "AskarAnoncredsProfileSession": + def session( + self, context: Optional[InjectionContext] = None + ) -> "AskarAnoncredsProfileSession": """Start a new interactive session with no transaction support requested.""" return AskarAnoncredsProfileSession(self, False, context=context) diff --git a/aries_cloudagent/cache/in_memory.py b/aries_cloudagent/cache/in_memory.py index e6de5fed71..e06358b1ad 100644 --- a/aries_cloudagent/cache/in_memory.py +++ b/aries_cloudagent/cache/in_memory.py @@ -38,7 +38,9 @@ async def get(self, key: Text): self._remove_expired_cache_items() return self._cache.get(key)["value"] if self._cache.get(key) else None - async def set(self, keys: Union[Text, Sequence[Text]], value: Any, ttl: Optional[int] = None): + async def set( + self, keys: Union[Text, Sequence[Text]], value: Any, ttl: Optional[int] = None + ): """Add an item to the cache with an optional ttl. Overwrites existing cache entries. diff --git a/aries_cloudagent/connections/models/conn_record.py b/aries_cloudagent/connections/models/conn_record.py index 3bd1a8c103..874d8c3d7f 100644 --- a/aries_cloudagent/connections/models/conn_record.py +++ b/aries_cloudagent/connections/models/conn_record.py @@ -331,7 +331,10 @@ async def retrieve_by_did_peer_4( @classmethod async def retrieve_by_invitation_key( - cls, session: ProfileSession, invitation_key: str, their_role: Optional[str] = None + cls, + session: ProfileSession, + invitation_key: str, + their_role: Optional[str] = None, ) -> "ConnRecord": """Retrieve a connection record by invitation key. @@ -354,7 +357,10 @@ async def retrieve_by_invitation_key( @classmethod async def retrieve_by_invitation_msg_id( - cls, session: ProfileSession, invitation_msg_id: str, their_role: Optional[str] = None + cls, + session: ProfileSession, + invitation_msg_id: str, + their_role: Optional[str] = None, ) -> Optional["ConnRecord"]: """Retrieve a connection record by invitation_msg_id. diff --git a/aries_cloudagent/core/dispatcher.py b/aries_cloudagent/core/dispatcher.py index e69b4eb137..962b69d97c 100644 --- a/aries_cloudagent/core/dispatcher.py +++ b/aries_cloudagent/core/dispatcher.py @@ -63,13 +63,19 @@ async def setup(self): ) def put_task( - self, coro: Coroutine, complete: Optional[Callable] = None, ident: Optional[str] = None + self, + coro: Coroutine, + complete: Optional[Callable] = None, + ident: Optional[str] = None, ) -> PendingTask: """Run a task in the task queue, potentially blocking other handlers.""" return self.task_queue.put(coro, complete, ident) def run_task( - self, coro: Coroutine, complete: Optional[Callable] = None, ident: Optional[str] = None + self, + coro: Coroutine, + complete: Optional[Callable] = None, + ident: Optional[str] = None, ) -> asyncio.Task: """Run a task in the task queue, potentially blocking other handlers.""" return self.task_queue.run(coro, complete, ident) diff --git a/aries_cloudagent/indy/issuer.py b/aries_cloudagent/indy/issuer.py index 9ef0f8c52b..102a84619c 100644 --- a/aries_cloudagent/indy/issuer.py +++ b/aries_cloudagent/indy/issuer.py @@ -57,7 +57,11 @@ async def create_schema( """ def make_credential_definition_id( - self, origin_did: str, schema: dict, signature_type: Optional[str] = None, tag: Optional[str] = None + self, + origin_did: str, + schema: dict, + signature_type: Optional[str] = None, + tag: Optional[str] = None, ) -> str: """Derive the ID for a credential definition.""" signature_type = signature_type or DEFAULT_SIGNATURE_TYPE diff --git a/aries_cloudagent/indy/models/cred.py b/aries_cloudagent/indy/models/cred.py index 477eb6c73c..865a7acffd 100644 --- a/aries_cloudagent/indy/models/cred.py +++ b/aries_cloudagent/indy/models/cred.py @@ -25,7 +25,9 @@ class Meta: schema_class = "IndyAttrValueSchema" - def __init__(self, raw: Optional[str] = None, encoded: Optional[str] = None, **kwargs): + def __init__( + self, raw: Optional[str] = None, encoded: Optional[str] = None, **kwargs + ): """Initialize indy (credential) attribute value.""" super().__init__(**kwargs) self.raw = raw diff --git a/aries_cloudagent/indy/models/revocation.py b/aries_cloudagent/indy/models/revocation.py index 528b8d073a..a7a2795fbd 100644 --- a/aries_cloudagent/indy/models/revocation.py +++ b/aries_cloudagent/indy/models/revocation.py @@ -275,7 +275,9 @@ class Meta: schema_class = "IndyRevRegEntrySchema" - def __init__(self, ver: Optional[str] = None, value: Optional[IndyRevRegEntryValue] = None): + def __init__( + self, ver: Optional[str] = None, value: Optional[IndyRevRegEntryValue] = None + ): """Initialize.""" self.ver = ver diff --git a/aries_cloudagent/messaging/decorators/attach_decorator.py b/aries_cloudagent/messaging/decorators/attach_decorator.py index 49a40173d7..98fc177996 100644 --- a/aries_cloudagent/messaging/decorators/attach_decorator.py +++ b/aries_cloudagent/messaging/decorators/attach_decorator.py @@ -424,7 +424,9 @@ def build_protected(verkey: str): ) self.jws_ = AttachDecoratorDataJWS.deserialize(jws) - async def verify(self, wallet: BaseWallet, signer_verkey: Optional[str] = None) -> bool: + async def verify( + self, wallet: BaseWallet, signer_verkey: Optional[str] = None + ) -> bool: """Verify the signature(s). Args: diff --git a/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py b/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py index be9610b09e..61a01a9e3c 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py +++ b/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py @@ -12,7 +12,13 @@ class SimpleModel(BaseModel): class Meta: schema_class = "SimpleModelSchema" - def __init__(self, *, value: Optional[str] = None, handled_decorator: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[str] = None, + handled_decorator: Optional[str] = None, + **kwargs, + ): super().__init__(**kwargs) self.handled_decorator = handled_decorator self.value = value diff --git a/aries_cloudagent/multitenant/single_wallet_askar_manager.py b/aries_cloudagent/multitenant/single_wallet_askar_manager.py index 92340d0326..157bd287e0 100644 --- a/aries_cloudagent/multitenant/single_wallet_askar_manager.py +++ b/aries_cloudagent/multitenant/single_wallet_askar_manager.py @@ -16,7 +16,9 @@ class SingleWalletAskarMultitenantManager(BaseMultitenantManager): DEFAULT_MULTITENANT_WALLET_NAME = "multitenant_sub_wallet" - def __init__(self, profile: Profile, multitenant_profile: Optional[AskarProfile] = None): + def __init__( + self, profile: Profile, multitenant_profile: Optional[AskarProfile] = None + ): """Initialize askar profile multitenant Manager. Args: diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/messages/perform.py b/aries_cloudagent/protocols/actionmenu/v1_0/messages/perform.py index e385e95c7d..29481a6e66 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/messages/perform.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/messages/perform.py @@ -20,7 +20,9 @@ class Meta: message_type = PERFORM schema_class = "PerformSchema" - def __init__(self, *, name: Optional[str] = None, params: Mapping[str, str] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, params: Mapping[str, str] = None, **kwargs + ): """Initialize a Perform object. Args: diff --git a/aries_cloudagent/protocols/connections/v1_0/messages/problem_report.py b/aries_cloudagent/protocols/connections/v1_0/messages/problem_report.py index 49aa7a44d7..2e8eebd923 100644 --- a/aries_cloudagent/protocols/connections/v1_0/messages/problem_report.py +++ b/aries_cloudagent/protocols/connections/v1_0/messages/problem_report.py @@ -39,7 +39,13 @@ class Meta: message_type = PROBLEM_REPORT schema_class = "ConnectionProblemReportSchema" - def __init__(self, *, problem_code: Optional[str] = None, explain: Optional[str] = None, **kwargs): + def __init__( + self, + *, + problem_code: Optional[str] = None, + explain: Optional[str] = None, + **kwargs, + ): """Initialize a ProblemReport message instance. Args: diff --git a/aries_cloudagent/protocols/connections/v1_0/models/connection_detail.py b/aries_cloudagent/protocols/connections/v1_0/models/connection_detail.py index 2363fa42b5..6029cb1614 100644 --- a/aries_cloudagent/protocols/connections/v1_0/models/connection_detail.py +++ b/aries_cloudagent/protocols/connections/v1_0/models/connection_detail.py @@ -51,7 +51,9 @@ class Meta: schema_class = "ConnectionDetailSchema" - def __init__(self, *, did: Optional[str] = None, did_doc: Optional[DIDDoc] = None, **kwargs): + def __init__( + self, *, did: Optional[str] = None, did_doc: Optional[DIDDoc] = None, **kwargs + ): """Initialize a ConnectionDetail instance. Args: diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py index 125e07217f..8fc9e414ec 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py @@ -474,7 +474,10 @@ async def request_denied(self, record: MediationRecord, deny: MediationDeny): await record.save(session, reason="Mediation request denied.") async def prepare_keylist_query( - self, filter_: Optional[dict] = None, paginate_limit: int = -1, paginate_offset: int = 0 + self, + filter_: Optional[dict] = None, + paginate_limit: int = -1, + paginate_offset: int = 0, ) -> KeylistQuery: """Prepare keylist query message. diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/transaction_resend.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/transaction_resend.py index 82216f3449..5b52e4c805 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/transaction_resend.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/transaction_resend.py @@ -1,4 +1,5 @@ """Represents a transaction resend message.""" + from typing import Optional from marshmallow import EXCLUDE, fields diff --git a/aries_cloudagent/protocols/introduction/v0_1/messages/forward_invitation.py b/aries_cloudagent/protocols/introduction/v0_1/messages/forward_invitation.py index d45fc9dd5b..5a8399c282 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/messages/forward_invitation.py +++ b/aries_cloudagent/protocols/introduction/v0_1/messages/forward_invitation.py @@ -27,7 +27,11 @@ class Meta: schema_class = "ForwardInvitationSchema" def __init__( - self, *, invitation: Optional[ConnectionInvitation] = None, message: Optional[str] = None, **kwargs + self, + *, + invitation: Optional[ConnectionInvitation] = None, + message: Optional[str] = None, + **kwargs, ): """Initialize invitation object. diff --git a/aries_cloudagent/protocols/introduction/v0_1/messages/invitation.py b/aries_cloudagent/protocols/introduction/v0_1/messages/invitation.py index 433e31df9c..1deb28dbb5 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/messages/invitation.py +++ b/aries_cloudagent/protocols/introduction/v0_1/messages/invitation.py @@ -25,7 +25,11 @@ class Meta: schema_class = "InvitationSchema" def __init__( - self, *, invitation: Optional[ConnectionInvitation] = None, message: Optional[str] = None, **kwargs + self, + *, + invitation: Optional[ConnectionInvitation] = None, + message: Optional[str] = None, + **kwargs, ): """Initialize invitation object. diff --git a/aries_cloudagent/protocols/introduction/v0_1/messages/invitation_request.py b/aries_cloudagent/protocols/introduction/v0_1/messages/invitation_request.py index 1ad4ee2527..a6966759f4 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/messages/invitation_request.py +++ b/aries_cloudagent/protocols/introduction/v0_1/messages/invitation_request.py @@ -1,4 +1,5 @@ """Represents an request for an invitation from the introduction service.""" + from typing import Optional from marshmallow import EXCLUDE, fields @@ -21,7 +22,9 @@ class Meta: message_type = INVITATION_REQUEST schema_class = "InvitationRequestSchema" - def __init__(self, *, responder: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, *, responder: Optional[str] = None, message: Optional[str] = None, **kwargs + ): """Initialize invitation request object. Args: 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 16b1560f6e..9a2e75b06b 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 @@ -18,7 +18,9 @@ class Meta: schema_class = "CredAttrSpecSchema" - def __init__(self, *, name: str, value: str, mime_type: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, value: str, mime_type: Optional[str] = None, **kwargs + ): """Initialize attribute preview object. Args: @@ -106,7 +108,11 @@ class Meta: message_type = CREDENTIAL_PREVIEW def __init__( - self, *, _type: Optional[str] = None, attributes: Sequence[CredAttrSpec] = None, **kwargs + self, + *, + _type: Optional[str] = None, + attributes: Sequence[CredAttrSpec] = None, + **kwargs, ): """Initialize credential preview object. diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/handler.py index 7836ab4d24..7ab50cf9ae 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/handler.py @@ -2,6 +2,7 @@ indy compatible, attachment is a valid verifiable credential """ + import datetime import json import logging diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/manager.py b/aries_cloudagent/protocols/issue_credential/v2_0/manager.py index 1548b4b8b0..068f94a4bd 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/manager.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/manager.py @@ -326,7 +326,10 @@ async def receive_offer( return cred_ex_record async def create_request( - self, cred_ex_record: V20CredExRecord, holder_did: str, comment: Optional[str] = None + self, + cred_ex_record: V20CredExRecord, + holder_did: str, + comment: Optional[str] = None, ) -> Tuple[V20CredExRecord, V20CredRequest]: """Create a credential request. diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py index fb58534a69..6b6e556471 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/cred_preview.py @@ -18,7 +18,9 @@ class Meta: schema_class = "V20CredAttrSpecSchema" - def __init__(self, *, name: str, value: str, mime_type: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, value: str, mime_type: Optional[str] = None, **kwargs + ): """Initialize attribute preview object. Args: diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/models/cred_ex_record.py b/aries_cloudagent/protocols/issue_credential/v2_0/models/cred_ex_record.py index 36dad47fa0..b9b1b1074f 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/models/cred_ex_record.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/models/cred_ex_record.py @@ -71,7 +71,9 @@ def __init__( auto_remove: bool = True, error_msg: Optional[str] = None, trace: bool = False, # backward compat: BaseRecord.from_storage() - cred_id_stored: Optional[str] = None, # backward compat: BaseRecord.from_storage() + cred_id_stored: Optional[ + str + ] = None, # backward compat: BaseRecord.from_storage() conn_id: Optional[str] = None, # backward compat: BaseRecord.from_storage() by_format: Optional[Mapping] = None, # backward compat: BaseRecord.from_storage() **kwargs, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/models/detail/ld_proof.py b/aries_cloudagent/protocols/issue_credential/v2_0/models/detail/ld_proof.py index 524a9d5c67..2997201e82 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/models/detail/ld_proof.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/models/detail/ld_proof.py @@ -1,4 +1,5 @@ """Linked data proof specific credential exchange information with non-secrets storage.""" + from typing import Any, Optional, Sequence from marshmallow import EXCLUDE, fields diff --git a/aries_cloudagent/protocols/notification/v1_0/messages/ack.py b/aries_cloudagent/protocols/notification/v1_0/messages/ack.py index 3732c59653..1e425976c2 100644 --- a/aries_cloudagent/protocols/notification/v1_0/messages/ack.py +++ b/aries_cloudagent/protocols/notification/v1_0/messages/ack.py @@ -1,4 +1,5 @@ """Represents an explicit RFC 15 ack message, adopted into present-proof protocol.""" + from typing import Optional from marshmallow import EXCLUDE, fields diff --git a/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_ack.py b/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_ack.py index 695351bb9a..ebebf9112b 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_ack.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_ack.py @@ -22,7 +22,12 @@ class Meta: message_type = PRESENTATION_ACK schema_class = "PresentationAckSchema" - def __init__(self, status: Optional[str] = None, verification_result: Optional[str] = None, **kwargs): + def __init__( + self, + status: Optional[str] = None, + verification_result: Optional[str] = None, + **kwargs, + ): """Initialize an explicit ack message instance. Args: diff --git a/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_request.py b/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_request.py index 97c46e51db..0eb44ca721 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_request.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/messages/presentation_request.py @@ -1,4 +1,5 @@ """A presentation request content message.""" + from typing import Optional, Sequence from marshmallow import EXCLUDE, fields diff --git a/aries_cloudagent/protocols/present_proof/v2_0/formats/anoncreds/handler.py b/aries_cloudagent/protocols/present_proof/v2_0/formats/anoncreds/handler.py index 74529488cd..d5618f4a50 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/formats/anoncreds/handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/formats/anoncreds/handler.py @@ -1,4 +1,5 @@ """V2.0 present-proof indy presentation-exchange format handler.""" + import json import logging from typing import Mapping, Optional, Tuple 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 9761b54d24..c4abf9d4c2 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.""" + import logging from abc import ABC, abstractclassmethod, abstractmethod from typing import Optional, Tuple diff --git a/aries_cloudagent/protocols/present_proof/v2_0/messages/pres.py b/aries_cloudagent/protocols/present_proof/v2_0/messages/pres.py index 290de5f277..5cf19bb81b 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/messages/pres.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/messages/pres.py @@ -1,4 +1,5 @@ """A (proof) presentation content message.""" + from typing import Optional, Sequence from marshmallow import EXCLUDE, ValidationError, fields, validates_schema diff --git a/aries_cloudagent/protocols/present_proof/v2_0/messages/pres_ack.py b/aries_cloudagent/protocols/present_proof/v2_0/messages/pres_ack.py index 859310da79..6efe4568da 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/messages/pres_ack.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/messages/pres_ack.py @@ -20,7 +20,12 @@ class Meta: message_type = PRES_20_ACK schema_class = "V20PresAckSchema" - def __init__(self, status: Optional[str] = None, verification_result: Optional[str] = None, **kwargs): + def __init__( + self, + status: Optional[str] = None, + verification_result: Optional[str] = None, + **kwargs, + ): """Initialize an explicit ack message instance. Args: diff --git a/aries_cloudagent/protocols/revocation_notification/v2_0/messages/revoke.py b/aries_cloudagent/protocols/revocation_notification/v2_0/messages/revoke.py index 44fef8d8c0..8ed4d83e96 100644 --- a/aries_cloudagent/protocols/revocation_notification/v2_0/messages/revoke.py +++ b/aries_cloudagent/protocols/revocation_notification/v2_0/messages/revoke.py @@ -1,4 +1,5 @@ """Revoke message.""" + from typing import Optional from marshmallow import fields, validate diff --git a/aries_cloudagent/protocols/routing/v1_0/manager.py b/aries_cloudagent/protocols/routing/v1_0/manager.py index facef0711c..121d0026ab 100644 --- a/aries_cloudagent/protocols/routing/v1_0/manager.py +++ b/aries_cloudagent/protocols/routing/v1_0/manager.py @@ -77,7 +77,9 @@ async def get_recipient(self, recip_verkey: str) -> RouteRecord: await asyncio.sleep(RECIP_ROUTE_PAUSE) async def get_routes( - self, client_connection_id: Optional[str] = None, tag_filter: Optional[dict] = None + self, + client_connection_id: Optional[str] = None, + tag_filter: Optional[dict] = None, ) -> Sequence[RouteRecord]: """Fetch all routes associated with the current connection. diff --git a/aries_cloudagent/protocols/routing/v1_0/messages/forward.py b/aries_cloudagent/protocols/routing/v1_0/messages/forward.py index 19f0bdc06d..ab455af073 100644 --- a/aries_cloudagent/protocols/routing/v1_0/messages/forward.py +++ b/aries_cloudagent/protocols/routing/v1_0/messages/forward.py @@ -21,7 +21,9 @@ class Meta: message_type = FORWARD schema_class = "ForwardSchema" - def __init__(self, *, to: Optional[str] = None, msg: Union[dict, str] = None, **kwargs): + def __init__( + self, *, to: Optional[str] = None, msg: Union[dict, str] = None, **kwargs + ): """Initialize forward message object. Args: 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 0f42081107..e82990f221 100644 --- a/aries_cloudagent/protocols/routing/v1_0/models/route_record.py +++ b/aries_cloudagent/protocols/routing/v1_0/models/route_record.py @@ -1,4 +1,5 @@ """An object for containing information on an individual route.""" + from typing import Optional from marshmallow import EXCLUDE, ValidationError, fields, validates_schema diff --git a/aries_cloudagent/protocols/trustping/v1_0/messages/ping.py b/aries_cloudagent/protocols/trustping/v1_0/messages/ping.py index e04b1500eb..9e8d98b5af 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/messages/ping.py +++ b/aries_cloudagent/protocols/trustping/v1_0/messages/ping.py @@ -1,4 +1,5 @@ """Represents a trust ping message.""" + from typing import Optional from marshmallow import EXCLUDE, fields @@ -19,7 +20,9 @@ class Meta: message_type = PING schema_class = "PingSchema" - def __init__(self, *, response_requested: bool = True, comment: Optional[str] = None, **kwargs): + def __init__( + self, *, response_requested: bool = True, comment: Optional[str] = None, **kwargs + ): """Initialize a Ping message instance. Args: diff --git a/aries_cloudagent/revocation/indy.py b/aries_cloudagent/revocation/indy.py index 2f2e009f47..7c1efe6e25 100644 --- a/aries_cloudagent/revocation/indy.py +++ b/aries_cloudagent/revocation/indy.py @@ -203,7 +203,10 @@ async def list_issuer_registries(self) -> Sequence[IssuerRevRegRecord]: return await IssuerRevRegRecord.query(session) async def get_issuer_rev_reg_delta( - self, rev_reg_id: str, timestamp_from: Optional[int] = None, timestamp_to: Optional[int] = None + self, + rev_reg_id: str, + timestamp_from: Optional[int] = None, + timestamp_to: Optional[int] = None, ) -> dict: """Check ledger for revocation status for a given revocation registry. diff --git a/aries_cloudagent/revocation/models/revocation_registry.py b/aries_cloudagent/revocation/models/revocation_registry.py index f2d4e262b8..177d67860d 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 hashlib import http import logging diff --git a/aries_cloudagent/revocation/models/tests/test_issuer_rev_reg_record.py b/aries_cloudagent/revocation/models/tests/test_issuer_rev_reg_record.py index 9dc6ce1287..e0f7978a86 100644 --- a/aries_cloudagent/revocation/models/tests/test_issuer_rev_reg_record.py +++ b/aries_cloudagent/revocation/models/tests/test_issuer_rev_reg_record.py @@ -120,7 +120,9 @@ async def test_fix_ledger_entry(self): } class TestProfile(InMemoryProfile): - def session(self, context: Optional[InjectionContext] = None) -> "ProfileSession": + def session( + self, context: Optional[InjectionContext] = None + ) -> "ProfileSession": return TestProfileSession(self, context=context) @classmethod diff --git a/aries_cloudagent/storage/base.py b/aries_cloudagent/storage/base.py index bc9c61f319..d1cbc8086e 100644 --- a/aries_cloudagent/storage/base.py +++ b/aries_cloudagent/storage/base.py @@ -1,4 +1,5 @@ """Abstract base classes for non-secrets storage.""" + from abc import ABC, abstractmethod from typing import Mapping, Optional, Sequence @@ -70,7 +71,10 @@ async def delete_record(self, record: StorageRecord): """ async def find_record( - self, type_filter: str, tag_query: Optional[Mapping] = None, options: Optional[Mapping] = None + self, + type_filter: str, + tag_query: Optional[Mapping] = None, + options: Optional[Mapping] = None, ) -> StorageRecord: """Find a record using a unique tag filter. diff --git a/aries_cloudagent/storage/in_memory.py b/aries_cloudagent/storage/in_memory.py index 198cc6bc24..03af62b2cf 100644 --- a/aries_cloudagent/storage/in_memory.py +++ b/aries_cloudagent/storage/in_memory.py @@ -1,4 +1,5 @@ """Basic in-memory storage implementation (non-wallet).""" + from typing import Mapping, Optional, Sequence from ..core.in_memory import InMemoryProfile diff --git a/aries_cloudagent/storage/vc_holder/in_memory.py b/aries_cloudagent/storage/vc_holder/in_memory.py index 27bad21520..6cfcb1c64e 100644 --- a/aries_cloudagent/storage/vc_holder/in_memory.py +++ b/aries_cloudagent/storage/vc_holder/in_memory.py @@ -1,4 +1,5 @@ """Basic in-memory storage implementation of VC holder interface.""" + from typing import Mapping, Optional, Sequence from dateutil.parser import ParserError diff --git a/aries_cloudagent/storage/vc_holder/vc_record.py b/aries_cloudagent/storage/vc_holder/vc_record.py index 4d091bac5a..ea859c78e7 100644 --- a/aries_cloudagent/storage/vc_holder/vc_record.py +++ b/aries_cloudagent/storage/vc_holder/vc_record.py @@ -31,7 +31,9 @@ def __init__( proof_types: Sequence[str], # one or more proof types may be present cred_value: Mapping, # the credential value as a JSON-serializable mapping given_id: Optional[str] = None, # value of the credential 'id' property, if any - cred_tags: Optional[Mapping] = None, # tags for retrieval (derived from attribute values) + cred_tags: Optional[ + Mapping + ] = None, # tags for retrieval (derived from attribute values) record_id: Optional[str] = None, # specify the storage record ID ): """Initialize some defaults on record.""" diff --git a/aries_cloudagent/transport/inbound/manager.py b/aries_cloudagent/transport/inbound/manager.py index eca52ef9dd..cdc3806aa6 100644 --- a/aries_cloudagent/transport/inbound/manager.py +++ b/aries_cloudagent/transport/inbound/manager.py @@ -1,4 +1,5 @@ """Inbound transport manager.""" + import logging from collections import OrderedDict from typing import Callable, Coroutine, Optional diff --git a/aries_cloudagent/transport/outbound/base.py b/aries_cloudagent/transport/outbound/base.py index 3aeec7c0dc..f6b8b73fb0 100644 --- a/aries_cloudagent/transport/outbound/base.py +++ b/aries_cloudagent/transport/outbound/base.py @@ -1,4 +1,5 @@ """Base outbound transport.""" + import asyncio from abc import ABC, abstractmethod from typing import Optional, Union diff --git a/aries_cloudagent/transport/outbound/manager.py b/aries_cloudagent/transport/outbound/manager.py index 075e340843..e76c1ea779 100644 --- a/aries_cloudagent/transport/outbound/manager.py +++ b/aries_cloudagent/transport/outbound/manager.py @@ -96,7 +96,9 @@ def register(self, module_name: str) -> str: return self.register_class(imported_class) def register_class( - self, transport_class: Type[BaseOutboundTransport], transport_id: Optional[str] = None + self, + transport_class: Type[BaseOutboundTransport], + transport_id: Optional[str] = None, ) -> str: """Register a new outbound transport class. diff --git a/aries_cloudagent/utils/classloader.py b/aries_cloudagent/utils/classloader.py index 9f3fd63ef5..29fd81bc4d 100644 --- a/aries_cloudagent/utils/classloader.py +++ b/aries_cloudagent/utils/classloader.py @@ -117,7 +117,9 @@ def load_class( return resolved @classmethod - def load_subclass_of(cls, base_class: Type, mod_path: str, package: Optional[str] = None): + def load_subclass_of( + cls, base_class: Type, mod_path: str, package: Optional[str] = None + ): """Resolve an implementation of a base path within a module. Args: diff --git a/aries_cloudagent/utils/jwe.py b/aries_cloudagent/utils/jwe.py index e3a3099ea1..de7f23802d 100644 --- a/aries_cloudagent/utils/jwe.py +++ b/aries_cloudagent/utils/jwe.py @@ -70,7 +70,9 @@ class JweRecipientSchema(Schema): class JweRecipient: """A single message recipient.""" - def __init__(self, *, encrypted_key: bytes, header: Optional[dict] = None) -> "JweRecipient": + def __init__( + self, *, encrypted_key: bytes, header: Optional[dict] = None + ) -> "JweRecipient": """Initialize the JWE recipient.""" self.encrypted_key = encrypted_key self.header = header or {} @@ -262,7 +264,9 @@ def protected_bytes(self) -> bytes: self.protected_b64.encode("utf-8") if self.protected_b64 is not None else None ) - def set_payload(self, ciphertext: bytes, iv: bytes, tag: bytes, aad: Optional[bytes] = None): + def set_payload( + self, ciphertext: bytes, iv: bytes, tag: bytes, aad: Optional[bytes] = None + ): """Set the payload of the JWE envelope.""" self.ciphertext = ciphertext self.iv = iv diff --git a/aries_cloudagent/utils/task_queue.py b/aries_cloudagent/utils/task_queue.py index 226040e17e..5780dd1a9d 100644 --- a/aries_cloudagent/utils/task_queue.py +++ b/aries_cloudagent/utils/task_queue.py @@ -1,4 +1,5 @@ """Classes for managing a set of asyncio tasks.""" + import asyncio import logging import time @@ -123,7 +124,10 @@ class TaskQueue: """A class for managing a set of asyncio tasks.""" def __init__( - self, max_active: int = 0, timed: bool = False, trace_fn: Optional[Callable] = None + self, + max_active: int = 0, + timed: bool = False, + trace_fn: Optional[Callable] = None, ): """Initialize the task queue. @@ -303,7 +307,10 @@ def run( return self.add_active(task, task_complete, ident, timing) def put( - self, coro: Coroutine, task_complete: Optional[Callable] = None, ident: Optional[str] = None + self, + coro: Coroutine, + task_complete: Optional[Callable] = None, + ident: Optional[str] = None, ) -> PendingTask: """Add a new task to the queue, delaying execution if busy. diff --git a/aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py index 404a3355a6..e1640c6eba 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py @@ -11,7 +11,12 @@ class AssertionProofPurpose(ControllerProofPurpose): term = "assertionMethod" - def __init__(self, *, date: Optional[datetime] = None, max_timestamp_delta: Optional[timedelta] = None): + def __init__( + self, + *, + date: Optional[datetime] = None, + max_timestamp_delta: Optional[timedelta] = None, + ): """Initialize new instance of AssertionProofPurpose.""" super().__init__( term=AssertionProofPurpose.term, diff --git a/aries_cloudagent/vc/vc_ld/manager.py b/aries_cloudagent/vc/vc_ld/manager.py index 1f3289c7f8..52808707f3 100644 --- a/aries_cloudagent/vc/vc_ld/manager.py +++ b/aries_cloudagent/vc/vc_ld/manager.py @@ -405,7 +405,10 @@ async def issue( return VerifiableCredential.deserialize(vc) async def store_credential( - self, vc: VerifiableCredential, options: LDProofVCOptions, cred_id: Optional[str] = None + self, + vc: VerifiableCredential, + options: LDProofVCOptions, + cred_id: Optional[str] = None, ) -> VerifiableCredential: """Store a verifiable credential.""" diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index 1dbffadfe6..f648df36b7 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -612,7 +612,9 @@ async def set_did_endpoint( await self.replace_local_did_metadata(did, metadata) - async def rotate_did_keypair_start(self, did: str, next_seed: Optional[str] = None) -> str: + async def rotate_did_keypair_start( + self, did: str, next_seed: Optional[str] = None + ) -> str: """Begin key rotation for DID that wallet owns: generate new keypair. Args: diff --git a/aries_cloudagent/wallet/base.py b/aries_cloudagent/wallet/base.py index 780b1da6ec..dac45d301e 100644 --- a/aries_cloudagent/wallet/base.py +++ b/aries_cloudagent/wallet/base.py @@ -108,7 +108,9 @@ async def replace_signing_key_metadata(self, verkey: str, metadata: dict): """ @abstractmethod - async def rotate_did_keypair_start(self, did: str, next_seed: Optional[str] = None) -> str: + async def rotate_did_keypair_start( + self, did: str, next_seed: Optional[str] = None + ) -> str: """Begin key rotation for DID that wallet owns: generate new keypair. Args: diff --git a/aries_cloudagent/wallet/crypto.py b/aries_cloudagent/wallet/crypto.py index 860052118c..0ceef63a91 100644 --- a/aries_cloudagent/wallet/crypto.py +++ b/aries_cloudagent/wallet/crypto.py @@ -21,7 +21,9 @@ from .util import b58_to_bytes, b64_to_bytes, bytes_to_b58, random_seed -def create_keypair(key_type: KeyType, seed: Optional[bytes] = None) -> Tuple[bytes, bytes]: +def create_keypair( + key_type: KeyType, seed: Optional[bytes] = None +) -> Tuple[bytes, bytes]: """Create a public and private keypair from a seed value. Args: diff --git a/aries_cloudagent/wallet/in_memory.py b/aries_cloudagent/wallet/in_memory.py index aaea16d579..cbd1f00960 100644 --- a/aries_cloudagent/wallet/in_memory.py +++ b/aries_cloudagent/wallet/in_memory.py @@ -179,7 +179,9 @@ async def replace_signing_key_metadata(self, verkey: str, metadata: dict): raise WalletNotFoundError("Key not found: {}".format(verkey)) self.profile.keys[verkey]["metadata"] = metadata.copy() if metadata else {} - async def rotate_did_keypair_start(self, did: str, next_seed: Optional[str] = None) -> str: + async def rotate_did_keypair_start( + self, did: str, next_seed: Optional[str] = None + ) -> str: """Begin key rotation for DID that wallet owns: generate new keypair. Args: