From e1b4d674989f11c75b82b85724b4f8d7da31607f Mon Sep 17 00:00:00 2001 From: Mourits de Beer <31511766+ff137@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:28:02 +0200 Subject: [PATCH] :art: organize imports (#3169) * :art: organize imports with `isort` Signed-off-by: ff137 * :art: organize imports with `ruff check --select I --fix .` Signed-off-by: ff137 * :art: ruff format Signed-off-by: ff137 --------- Signed-off-by: ff137 --- aries_cloudagent/admin/routes.py | 5 +- .../admin/tests/test_request_context.py | 1 - aries_cloudagent/anoncreds/__init__.py | 1 - .../default/did_web/tests/test_registry.py | 4 +- .../anoncreds/default/legacy_indy/recover.py | 5 +- .../legacy_indy/tests/test_registry.py | 8 +-- aries_cloudagent/anoncreds/holder.py | 8 +-- aries_cloudagent/anoncreds/issuer.py | 10 +-- aries_cloudagent/anoncreds/routes.py | 10 +-- .../anoncreds/tests/test_holder.py | 4 +- .../anoncreds/tests/test_issuer.py | 8 +-- .../anoncreds/tests/test_routes.py | 4 +- .../anoncreds/tests/test_verifier.py | 4 +- aries_cloudagent/anoncreds/verifier.py | 2 +- .../askar/didcomm/tests/test_v2.py | 7 +- aries_cloudagent/askar/didcomm/v1.py | 9 +-- aries_cloudagent/askar/didcomm/v2.py | 5 +- aries_cloudagent/askar/profile_anon.py | 7 +- .../cache/tests/test_in_memory_cache.py | 4 +- aries_cloudagent/commands/help.py | 5 +- aries_cloudagent/commands/provision.py | 8 +-- aries_cloudagent/commands/start.py | 6 +- aries_cloudagent/commands/tests/test_help.py | 3 +- aries_cloudagent/commands/tests/test_init.py | 3 +- .../commands/tests/test_provision.py | 5 +- aries_cloudagent/commands/tests/test_start.py | 3 +- .../commands/tests/test_upgrade.py | 5 +- aries_cloudagent/commands/upgrade.py | 11 +-- aries_cloudagent/config/banner.py | 4 +- aries_cloudagent/config/default_context.py | 5 +- aries_cloudagent/config/plugin_settings.py | 1 - .../config/tests/test_argparse.py | 5 +- .../config/tests/test_default_context.py | 2 - .../config/tests/test_injector.py | 4 +- aries_cloudagent/config/tests/test_ledger.py | 7 +- .../config/tests/test_provider.py | 7 +- .../config/tests/test_settings.py | 6 +- aries_cloudagent/config/tests/test_wallet.py | 8 +-- aries_cloudagent/connections/base_manager.py | 9 +-- .../connections/models/conn_record.py | 8 +-- .../connections/models/diddoc/diddoc.py | 2 - .../connections/models/diddoc/publickey.py | 1 - .../connections/models/diddoc/service.py | 2 +- .../connections/models/diddoc/util.py | 3 +- .../models/tests/test_conn_record.py | 1 - .../connections/tests/test_base_manager.py | 9 +-- aries_cloudagent/core/event_bus.py | 6 +- .../core/in_memory/didcomm/derive_1pu.py | 2 +- .../core/in_memory/didcomm/derive_ecdh.py | 1 - .../core/in_memory/didcomm/tests/test_1pu.py | 1 - .../core/in_memory/didcomm/tests/test_ecdh.py | 2 +- aries_cloudagent/core/oob_processor.py | 4 +- aries_cloudagent/core/plugin_registry.py | 5 +- .../core/tests/test_dispatcher.py | 9 ++- aries_cloudagent/core/tests/test_event_bus.py | 6 +- .../core/tests/test_goal_code_registry.py | 1 - .../core/tests/test_oob_processor.py | 4 +- aries_cloudagent/core/tests/test_profile.py | 1 - .../core/tests/test_protocol_registry.py | 4 +- aries_cloudagent/did/did_key.py | 9 ++- .../did/tests/test_did_key_bls12381g1.py | 3 +- .../did/tests/test_did_key_bls12381g1g2.py | 2 +- .../did/tests/test_did_key_bls12381g2.py | 2 +- .../did/tests/test_did_key_ed25519.py | 2 +- .../did/tests/test_did_key_x25519.py | 2 +- aries_cloudagent/didcomm_v2/adapters.py | 4 +- .../didcomm_v2/tests/test_adapters.py | 11 ++- .../indy/credx/tests/test_cred_issuance.py | 7 +- aries_cloudagent/indy/credx/verifier.py | 2 - aries_cloudagent/indy/models/cred_request.py | 2 +- aries_cloudagent/indy/models/predicate.py | 1 - aries_cloudagent/indy/tests/test_verifier.py | 4 +- .../merkel_validation/domain_txn_handler.py | 70 +++++++++---------- .../ledger/merkel_validation/hasher.py | 1 - .../tests/test_domain_txn_handler.py | 17 +++-- .../merkel_validation/tests/test_trie.py | 16 ++--- .../merkel_validation/tests/test_utils.py | 2 +- .../ledger/merkel_validation/trie.py | 24 +++---- .../ledger/merkel_validation/utils.py | 2 +- .../ledger/multiple_ledger/base_manager.py | 2 +- .../multiple_ledger/manager_provider.py | 4 +- .../tests/test_indy_ledger_requests.py | 5 +- .../tests/test_indy_vdr_manager.py | 10 ++- .../tests/test_manager_provider.py | 5 +- aries_cloudagent/ledger/tests/test_routes.py | 4 +- aries_cloudagent/ledger/util.py | 1 - aries_cloudagent/messaging/base_handler.py | 5 +- aries_cloudagent/messaging/base_message.py | 2 +- aries_cloudagent/messaging/decorators/base.py | 1 - .../messaging/decorators/default.py | 5 +- .../decorators/tests/test_decorator_set.py | 3 +- .../tests/test_localization_decorator.py | 4 +- .../tests/test_signature_decorator.py | 2 +- .../decorators/tests/test_thread_decorator.py | 4 +- .../decorators/tests/test_timing_decorator.py | 1 - .../decorators/tests/test_trace_decorator.py | 4 +- .../messaging/jsonld/credential.py | 1 - .../messaging/jsonld/tests/document_loader.py | 1 - .../messaging/jsonld/tests/test_credential.py | 7 +- aries_cloudagent/messaging/message_type.py | 2 +- aries_cloudagent/messaging/models/openapi.py | 2 +- .../messaging/models/tests/test_base.py | 5 +- .../messaging/tests/test_agent_message.py | 3 +- aries_cloudagent/messaging/util.py | 2 - aries_cloudagent/messaging/valid.py | 1 - aries_cloudagent/multitenant/route_manager.py | 1 - .../single_wallet_askar_manager.py | 4 +- .../multitenant/tests/test_base.py | 7 +- .../multitenant/tests/test_cache.py | 1 - .../multitenant/tests/test_manager.py | 1 + .../multitenant/tests/test_route_manager.py | 3 +- .../protocols/actionmenu/v1_0/base_service.py | 1 - .../protocols/actionmenu/v1_0/controller.py | 1 - .../actionmenu/v1_0/driver_service.py | 1 - .../actionmenu/v1_0/messages/menu_request.py | 1 - .../v1_0/messages/tests/test_menu.py | 7 +- .../v1_0/messages/tests/test_menu_request.py | 5 +- .../v1_0/messages/tests/test_perform.py | 5 +- .../actionmenu/v1_0/tests/test_controller.py | 1 + .../actionmenu/v1_0/tests/test_service.py | 4 +- .../actionmenu/v1_0/tests/test_util.py | 5 +- .../protocols/actionmenu/v1_0/util.py | 7 +- .../tests/test_basicmessage_handler.py | 2 +- .../v1_0/messages/tests/test_basic_message.py | 7 +- .../handlers/connection_invitation_handler.py | 6 +- .../handlers/connection_response_handler.py | 6 +- .../handlers/tests/test_response_handler.py | 7 +- .../tests/test_connection_invitation.py | 5 +- .../messages/tests/test_connection_request.py | 15 +--- .../tests/test_connection_response.py | 16 +---- .../connections/v1_0/tests/test_manager.py | 5 +- .../v1_0/handlers/keylist_handler.py | 2 - .../v1_0/handlers/keylist_query_handler.py | 1 - .../v1_0/handlers/keylist_update_handler.py | 1 - .../v1_0/handlers/mediation_deny_handler.py | 1 - .../v1_0/handlers/mediation_grant_handler.py | 1 - .../handlers/mediation_request_handler.py | 3 +- .../v1_0/handlers/problem_report_handler.py | 1 - .../handlers/tests/test_keylist_handler.py | 2 +- .../tests/test_keylist_query_handler.py | 5 +- .../tests/test_keylist_update_handler.py | 5 +- .../test_keylist_update_response_handler.py | 7 +- .../tests/test_mediation_deny_handler.py | 3 +- .../tests/test_mediation_grant_handler.py | 8 +-- .../tests/test_mediation_request_handler.py | 7 +- .../tests/test_problem_report_handler.py | 2 - .../coordinate_mediation/v1_0/manager.py | 5 +- .../v1_0/messages/problem_report.py | 2 - .../messages/tests/test_problem_report.py | 9 +-- .../v1_0/normalization.py | 1 + .../v1_0/route_manager.py | 8 +-- .../v1_0/route_manager_provider.py | 2 +- .../v1_0/tests/test_mediation_invite_store.py | 6 +- .../v1_0/tests/test_mediation_manager.py | 7 +- .../v1_0/tests/test_route_manager.py | 5 +- .../did_rotate/v1_0/messages/__init__.py | 4 +- .../did_rotate/v1_0/messages/rotate.py | 2 +- .../did_rotate/v1_0/tests/test_manager.py | 8 +-- aries_cloudagent/protocols/didcomm_prefix.py | 1 - .../v1_0/handlers/complete_handler.py | 7 +- .../v1_0/handlers/invitation_handler.py | 6 +- .../v1_0/handlers/response_handler.py | 6 +- .../handlers/tests/test_complete_handler.py | 5 +- .../handlers/tests/test_invitation_handler.py | 4 +- .../tests/test_problem_report_handler.py | 5 +- .../handlers/tests/test_response_handler.py | 7 +- .../didexchange/v1_0/messages/complete.py | 3 +- .../v1_0/messages/tests/test_complete.py | 2 - .../messages/tests/test_problem_report.py | 7 +- .../v1_0/messages/tests/test_request.py | 4 +- .../v1_0/messages/tests/test_response.py | 4 +- .../didexchange/v1_0/tests/test_manager.py | 4 +- .../handlers/tests/test_disclose_handler.py | 2 - .../protocols/discovery/v1_0/manager.py | 4 +- .../v1_0/messages/tests/test_disclose.py | 4 +- .../v1_0/messages/tests/test_query.py | 6 +- .../discovery/v1_0/tests/test_manager.py | 7 +- .../tests/test_disclosures_handler.py | 5 +- .../protocols/discovery/v2_0/manager.py | 10 ++- .../v2_0/messages/tests/test_disclosures.py | 7 +- .../v2_0/messages/tests/test_queries.py | 6 +- .../discovery/v2_0/tests/test_manager.py | 9 ++- .../endorsed_transaction_response_handler.py | 1 - .../refused_transaction_response_handler.py | 1 - ...t_endorsed_transaction_response_handler.py | 4 +- ...st_refused_transaction_response_handler.py | 4 +- ...est_transaction_acknowledgement_handler.py | 4 +- .../tests/test_transaction_cancel_handler.py | 6 +- .../test_transaction_job_to_send_handler.py | 4 +- .../tests/test_transaction_request_handler.py | 6 +- .../tests/test_transaction_resend_handler.py | 6 +- .../transaction_acknowledgement_handler.py | 1 - .../handlers/transaction_cancel_handler.py | 1 - .../handlers/transaction_request_handler.py | 2 - .../handlers/transaction_resend_handler.py | 1 - .../messages/tests/test_cancel_transaction.py | 7 +- .../test_endorsed_transaction_response.py | 7 +- .../messages/tests/test_messages_attach.py | 6 +- .../test_refused_transaction_response.py | 7 +- .../tests/test_transaction_acknowledgement.py | 6 +- .../tests/test_transaction_job_to_send.py | 7 +- .../tests/test_transaction_request.py | 7 +- .../messages/tests/test_transaction_resend.py | 7 +- .../introduction/v0_1/base_service.py | 1 - .../introduction/v0_1/demo_service.py | 7 +- .../handlers/forward_invitation_handler.py | 2 - .../v0_1/handlers/invitation_handler.py | 2 +- .../handlers/invitation_request_handler.py | 4 +- .../handlers/tests/test_invitation_handler.py | 3 +- .../messages/tests/test_forward_invitation.py | 7 +- .../v0_1/messages/tests/test_invitation.py | 7 +- .../messages/tests/test_invitation_request.py | 8 +-- .../introduction/v0_1/tests/test_service.py | 4 +- .../issue_credential/v1_0/__init__.py | 1 - .../v1_0/handlers/credential_ack_handler.py | 3 +- .../v1_0/handlers/credential_issue_handler.py | 3 +- .../v1_0/handlers/credential_offer_handler.py | 5 +- .../credential_problem_report_handler.py | 1 - .../handlers/credential_proposal_handler.py | 3 +- .../handlers/credential_request_handler.py | 3 +- .../tests/test_credential_ack_handler.py | 4 +- .../tests/test_credential_issue_handler.py | 5 +- .../tests/test_credential_offer_handler.py | 5 +- .../test_credential_problem_report_handler.py | 5 +- .../tests/test_credential_proposal_handler.py | 5 +- .../tests/test_credential_request_handler.py | 5 +- .../issue_credential/v1_0/manager.py | 4 +- .../v1_0/messages/credential_ack.py | 1 - .../inner/tests/test_credential_preview.py | 5 +- .../messages/tests/test_credential_ack.py | 5 +- .../messages/tests/test_credential_issue.py | 6 +- .../messages/tests/test_credential_offer.py | 5 +- .../tests/test_credential_problem_report.py | 11 +-- .../messages/tests/test_credential_request.py | 6 +- .../v1_0/tests/test_manager.py | 20 +++--- .../v2_0/formats/anoncreds/handler.py | 11 ++- .../formats/anoncreds/tests/test_handler.py | 32 ++++----- .../issue_credential/v2_0/formats/handler.py | 8 +-- .../v2_0/formats/indy/tests/test_handler.py | 45 ++++++------ .../formats/ld_proof/models/cred_detail.py | 1 - .../v2_0/formats/vc_di/handler.py | 53 ++++++-------- .../v2_0/formats/vc_di/models/cred_offer.py | 5 +- .../v2_0/formats/vc_di/models/cred_request.py | 5 +- .../v2_0/formats/vc_di/tests/test_handler.py | 57 ++++++--------- .../v2_0/handlers/cred_ack_handler.py | 3 +- .../v2_0/handlers/cred_issue_handler.py | 5 +- .../v2_0/handlers/cred_offer_handler.py | 7 +- .../handlers/cred_problem_report_handler.py | 1 - .../v2_0/handlers/cred_proposal_handler.py | 3 +- .../v2_0/handlers/cred_request_handler.py | 5 +- .../handlers/tests/test_cred_ack_handler.py | 5 +- .../handlers/tests/test_cred_issue_handler.py | 5 +- .../handlers/tests/test_cred_offer_handler.py | 5 +- .../tests/test_cred_problem_report_handler.py | 7 +- .../tests/test_cred_proposal_handler.py | 5 +- .../tests/test_cred_request_handler.py | 5 +- .../issue_credential/v2_0/message_types.py | 2 - .../v2_0/messages/cred_ack.py | 1 - .../messages/inner/tests/test_cred_preview.py | 5 +- .../v2_0/messages/tests/test_cred_ack.py | 5 +- .../v2_0/messages/tests/test_cred_format.py | 2 - .../tests/test_cred_problem_report.py | 13 ++-- .../v2_0/tests/test_manager.py | 19 +++-- .../v2_0/tests/test_routes.py | 5 +- .../v1_0/handlers/problem_report_handler.py | 1 - .../v1_0/handlers/reuse_accept_handler.py | 1 - .../tests/test_problem_report_handler.py | 1 - .../tests/test_reuse_accept_handler.py | 1 - .../out_of_band/v1_0/message_types.py | 2 - .../v1_0/messages/tests/test_invitation.py | 12 ++-- .../messages/tests/test_problem_report.py | 9 +-- .../v1_0/messages/tests/test_reuse.py | 5 +- .../v1_0/messages/tests/test_reuse_accept.py | 6 +- .../v1_0/models/tests/test_invitation.py | 3 - .../v1_0/models/tests/test_out_of_band.py | 4 +- .../v1_0/tests/test_invite_creator.py | 1 + .../out_of_band/v1_0/tests/test_manager.py | 6 +- .../protocols/present_proof/dif/pres_exch.py | 2 +- .../present_proof/dif/pres_exch_handler.py | 2 +- .../present_proof/dif/tests/test_data.py | 1 - .../present_proof/dif/tests/test_pres_exch.py | 8 +-- .../protocols/present_proof/v1_0/__init__.py | 1 - .../v1_0/handlers/presentation_ack_handler.py | 3 +- .../v1_0/handlers/presentation_handler.py | 3 +- .../presentation_problem_report_handler.py | 1 - .../handlers/presentation_proposal_handler.py | 3 +- .../handlers/presentation_request_handler.py | 5 +- .../tests/test_presentation_ack_handler.py | 5 +- .../tests/test_presentation_handler.py | 5 +- ...est_presentation_problem_report_handler.py | 5 +- .../test_presentation_proposal_handler.py | 5 +- .../test_presentation_request_handler.py | 5 +- .../tests/test_presentation_problem_report.py | 8 +-- .../v1_0/models/tests/test_record.py | 5 +- .../present_proof/v1_0/tests/test_manager.py | 12 +--- .../protocols/present_proof/v2_0/__init__.py | 6 +- .../v2_0/formats/anoncreds/handler.py | 11 ++- .../v2_0/formats/dif/tests/test_handler.py | 8 ++- .../present_proof/v2_0/formats/handler.py | 4 +- .../v2_0/formats/indy/handler.py | 7 +- .../v2_0/handlers/pres_ack_handler.py | 3 +- .../v2_0/handlers/pres_handler.py | 3 +- .../handlers/pres_problem_report_handler.py | 1 - .../v2_0/handlers/pres_proposal_handler.py | 3 +- .../v2_0/handlers/pres_request_handler.py | 5 +- .../handlers/tests/test_pres_ack_handler.py | 5 +- .../v2_0/handlers/tests/test_pres_handler.py | 5 +- .../tests/test_pres_problem_report_handler.py | 7 +- .../tests/test_pres_proposal_handler.py | 5 +- .../tests/test_pres_request_handler.py | 6 +- .../present_proof/v2_0/message_types.py | 1 - .../v2_0/messages/tests/test_pres_format.py | 2 - .../tests/test_pres_problem_report.py | 10 +-- .../v2_0/models/tests/test_record.py | 5 +- .../present_proof/v2_0/tests/test_manager.py | 10 ++- .../v2_0/tests/test_manager_anoncreds.py | 33 ++++----- .../protocols/problem_report/v1_0/handler.py | 7 +- .../problem_report/v1_0/tests/test_handler.py | 1 - .../problem_report/v1_0/tests/test_message.py | 9 +-- .../v1_0/message_types.py | 1 - .../v2_0/message_types.py | 1 - .../handlers/tests/test_forward_handler.py | 7 +- .../protocols/routing/v1_0/manager.py | 7 +- .../v1_0/messages/tests/test_forward.py | 5 +- .../v1_0/models/tests/test_route_record.py | 1 + .../v1_0/tests/test_routing_manager.py | 11 ++- .../trustping/v1_0/handlers/ping_handler.py | 7 +- .../v1_0/handlers/ping_response_handler.py | 7 +- .../v1_0/handlers/tests/test_ping_handler.py | 1 - .../tests/test_ping_response_handler.py | 1 - .../v1_0/messages/tests/test_trust_ping.py | 6 +- .../messages/tests/test_trust_ping_reponse.py | 6 +- aries_cloudagent/resolver/default/jwk.py | 3 +- aries_cloudagent/resolver/default/key.py | 3 +- .../resolver/default/legacy_peer.py | 3 +- aries_cloudagent/resolver/default/peer1.py | 1 - aries_cloudagent/resolver/default/peer2.py | 2 +- aries_cloudagent/resolver/default/peer3.py | 4 +- .../resolver/default/tests/test_indy.py | 1 - .../resolver/default/tests/test_jwk.py | 1 - .../resolver/default/tests/test_key.py | 1 - .../default/tests/test_legacy_peer.py | 6 +- .../resolver/default/tests/test_peer2.py | 1 - .../resolver/default/tests/test_peer3.py | 7 +- .../resolver/default/tests/test_universal.py | 6 +- .../resolver/default/tests/test_web.py | 1 + .../resolver/default/universal.py | 2 +- aries_cloudagent/resolver/default/web.py | 10 +-- aries_cloudagent/resolver/did_resolver.py | 4 +- aries_cloudagent/resolver/tests/test_base.py | 4 +- .../resolver/tests/test_did_resolver.py | 7 +- aries_cloudagent/revocation/manager.py | 4 +- .../revocation/models/revocation_registry.py | 6 +- .../models/tests/test_revocation_registry.py | 9 +-- aries_cloudagent/revocation/recover.py | 1 - .../revocation_anoncreds/manager.py | 4 +- .../models/issuer_cred_rev_record.py | 4 +- .../revocation_anoncreds/recover.py | 1 - .../tests/test_manager.py | 11 ++- aries_cloudagent/storage/tests/conftest.py | 1 + .../storage/tests/test_askar_storage.py | 10 ++- .../storage/vc_holder/tests/conftest.py | 1 + .../vc_holder/tests/test_askar_vc_holder.py | 3 - .../tests/test_in_memory_vc_holder.py | 2 - .../storage/vc_holder/tests/test_vc_record.py | 2 - aries_cloudagent/storage/vc_holder/xform.py | 1 - .../tails/anoncreds_tails_server.py | 5 +- aries_cloudagent/tails/indy_tails_server.py | 5 +- aries_cloudagent/tails/tests/test_indy.py | 4 +- aries_cloudagent/tests/mock.py | 2 +- aries_cloudagent/tests/test_main.py | 3 +- aries_cloudagent/transport/inbound/receipt.py | 1 + aries_cloudagent/transport/inbound/session.py | 2 - .../inbound/tests/test_delivery_queue.py | 1 - .../inbound/tests/test_http_transport.py | 7 +- .../transport/inbound/tests/test_manager.py | 5 +- .../transport/inbound/tests/test_message.py | 1 - .../transport/inbound/tests/test_session.py | 5 +- .../inbound/tests/test_ws_transport.py | 9 ++- .../outbound/tests/test_http_transport.py | 7 +- .../transport/outbound/tests/test_manager.py | 5 +- .../outbound/tests/test_ws_transport.py | 3 +- aries_cloudagent/transport/pack_format.py | 10 +-- aries_cloudagent/transport/queue/base.py | 2 +- .../transport/queue/tests/test_basic_queue.py | 2 +- .../transport/tests/test_pack_format.py | 9 ++- .../transport/tests/test_stats.py | 4 +- aries_cloudagent/transport/v2_pack_format.py | 8 +-- aries_cloudagent/transport/wire_format.py | 4 +- aries_cloudagent/utils/classloader.py | 4 +- aries_cloudagent/utils/env.py | 2 +- aries_cloudagent/utils/http.py | 10 +-- aries_cloudagent/utils/multi_ledger.py | 2 +- aries_cloudagent/utils/outofband.py | 1 - .../utils/tests/test_classloader.py | 4 +- aries_cloudagent/utils/tests/test_http.py | 2 +- aries_cloudagent/utils/tests/test_jwe.py | 3 +- .../utils/tests/test_multiformats.py | 1 + aries_cloudagent/utils/tests/test_repeat.py | 3 +- aries_cloudagent/utils/tests/test_stats.py | 1 - .../utils/tests/test_task_queue.py | 2 +- aries_cloudagent/utils/tests/test_tracing.py | 12 ++-- aries_cloudagent/vc/ld_proofs/__init__.py | 45 +++++------- .../crypto/tests/test_wallet_key_pair.py | 3 +- .../vc/ld_proofs/crypto/wallet_key_pair.py | 2 - .../vc/ld_proofs/document_downloader.py | 7 +- .../vc/ld_proofs/document_loader.py | 7 +- .../vc/ld_proofs/purposes/__init__.py | 2 +- .../purposes/authentication_proof_purpose.py | 1 - .../purposes/controller_proof_purpose.py | 3 +- .../purposes/credential_issuance_purpose.py | 5 +- .../vc/ld_proofs/purposes/proof_purpose.py | 1 - .../test_authentication_proof_purpose.py | 5 +- .../tests/test_controller_proof_purpose.py | 5 +- .../tests/test_credential_issuance_purpose.py | 7 +- .../purposes/tests/test_proof_purpose.py | 3 +- .../vc/ld_proofs/suites/__init__.py | 10 +-- .../suites/bbs_bls_signature_2020_base.py | 2 - .../suites/bbs_bls_signature_proof_2020.py | 21 +++--- .../suites/ed25519_signature_2018.py | 1 - .../suites/ed25519_signature_2020.py | 2 +- .../suites/jws_linked_data_signature.py | 5 +- .../tests/test_bbs_bls_signature_2020.py | 14 ++-- .../test_bbs_bls_signature_proof_2020.py | 24 +++---- .../tests/test_ed25519_signature_2018.py | 13 ++-- .../tests/test_ed25519_signature_2020.py | 18 ++--- .../vc/ld_proofs/tests/test_check.py | 2 +- .../vc/ld_proofs/tests/test_ld_proofs.py | 27 ++++--- .../vc/tests/contexts/__init__.py | 15 ++-- aries_cloudagent/vc/tests/data/__init__.py | 39 +++++------ aries_cloudagent/vc/tests/dids/__init__.py | 4 +- aries_cloudagent/vc/tests/document_loader.py | 38 +++++----- .../vc/tests/test_bbs_mattr_interop.py | 25 +++---- aries_cloudagent/vc/vc_di/__init__.py | 4 +- aries_cloudagent/vc/vc_di/prove.py | 21 +++--- .../vc/vc_di/tests/test_manager.py | 6 +- aries_cloudagent/vc/vc_di/tests/test_prove.py | 9 +-- aries_cloudagent/vc/vc_di/verify.py | 15 ++-- aries_cloudagent/vc/vc_ld/__init__.py | 16 ++--- aries_cloudagent/vc/vc_ld/issue.py | 6 +- aries_cloudagent/vc/vc_ld/models/__init__.py | 14 ++-- .../vc/vc_ld/models/presentation.py | 1 + .../vc/vc_ld/models/web_schemas.py | 16 ++--- aries_cloudagent/vc/vc_ld/prove.py | 5 +- .../vc/vc_ld/tests/test_credential.py | 6 +- .../vc/vc_ld/tests/test_manager.py | 4 +- aries_cloudagent/vc/vc_ld/tests/test_vc_ld.py | 29 ++++---- aries_cloudagent/vc/vc_ld/verify.py | 9 +-- aries_cloudagent/wallet/askar.py | 15 +--- aries_cloudagent/wallet/bbs.py | 18 ++--- .../default_verification_key_strategy.py | 6 +- aries_cloudagent/wallet/did_info.py | 1 - .../wallet/did_parameters_validation.py | 6 +- aries_cloudagent/wallet/jwt.py | 2 +- .../wallet/models/tests/test_wallet_record.py | 2 +- aries_cloudagent/wallet/tests/conftest.py | 1 + aries_cloudagent/wallet/tests/test_bbs.py | 5 +- aries_cloudagent/wallet/tests/test_crypto.py | 11 ++- .../test_default_verification_key_strategy.py | 2 - .../wallet/tests/test_did_method.py | 1 - .../tests/test_did_parameters_validation.py | 4 +- aries_cloudagent/wallet/tests/test_jwt.py | 1 - .../wallet/tests/test_key_pair.py | 11 ++- aries_cloudagent/wallet/tests/test_sd_jwt.py | 5 +- aries_cloudagent/wallet/tests/test_util.py | 3 +- aries_cloudagent/wallet/util.py | 5 +- conftest.py | 1 + demo/features/environment.py | 4 +- demo/features/steps/0160-connection.py | 9 ++- demo/features/steps/0453-issue-credential.py | 4 +- demo/features/steps/0454-present-proof.py | 7 +- .../steps/taa-txn-author-agreement.py | 3 +- demo/features/steps/upgrade.py | 5 +- demo/playground/examples/tests/__init__.py | 2 +- .../tests/test_mediator_ping_agents.py | 6 +- .../examples/tests/test_ping_agents.py | 5 +- demo/runners/acme.py | 3 +- demo/runners/alice.py | 3 +- demo/runners/faber.py | 7 +- demo/runners/performance.py | 3 +- demo/runners/support/utils.py | 6 +- 481 files changed, 1012 insertions(+), 1786 deletions(-) diff --git a/aries_cloudagent/admin/routes.py b/aries_cloudagent/admin/routes.py index 583be2e331..c21ba9fa0d 100644 --- a/aries_cloudagent/admin/routes.py +++ b/aries_cloudagent/admin/routes.py @@ -4,10 +4,7 @@ import re from aiohttp import web -from aiohttp_apispec import ( - docs, - response_schema, -) +from aiohttp_apispec import docs, response_schema from marshmallow import fields from ..core.plugin_registry import PluginRegistry diff --git a/aries_cloudagent/admin/tests/test_request_context.py b/aries_cloudagent/admin/tests/test_request_context.py index 10c4ac5c8e..d1b72494cd 100644 --- a/aries_cloudagent/admin/tests/test_request_context.py +++ b/aries_cloudagent/admin/tests/test_request_context.py @@ -3,7 +3,6 @@ from ...core.in_memory import InMemoryProfile from ...core.profile import ProfileSession from ...utils.stats import Collector - from .. import request_context as test_module diff --git a/aries_cloudagent/anoncreds/__init__.py b/aries_cloudagent/anoncreds/__init__.py index 753d303c71..23112a355b 100644 --- a/aries_cloudagent/anoncreds/__init__.py +++ b/aries_cloudagent/anoncreds/__init__.py @@ -2,7 +2,6 @@ from ..config.injection_context import InjectionContext from ..config.provider import ClassProvider - from .registry import AnonCredsRegistry LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/anoncreds/default/did_web/tests/test_registry.py b/aries_cloudagent/anoncreds/default/did_web/tests/test_registry.py index 5a06d8d879..01fc756888 100644 --- a/aries_cloudagent/anoncreds/default/did_web/tests/test_registry.py +++ b/aries_cloudagent/anoncreds/default/did_web/tests/test_registry.py @@ -1,7 +1,9 @@ """Test DIDWebRegistry.""" -import pytest import re + +import pytest + from ..registry import DIDWebRegistry DID_WEB = re.compile( diff --git a/aries_cloudagent/anoncreds/default/legacy_indy/recover.py b/aries_cloudagent/anoncreds/default/legacy_indy/recover.py index d8bde0103c..cd183adf15 100644 --- a/aries_cloudagent/anoncreds/default/legacy_indy/recover.py +++ b/aries_cloudagent/anoncreds/default/legacy_indy/recover.py @@ -7,10 +7,7 @@ import aiohttp import base58 import indy_vdr -from anoncreds import ( - RevocationRegistry, - RevocationRegistryDefinition, -) +from anoncreds import RevocationRegistry, RevocationRegistryDefinition from ...models.anoncreds_revocation import RevList diff --git a/aries_cloudagent/anoncreds/default/legacy_indy/tests/test_registry.py b/aries_cloudagent/anoncreds/default/legacy_indy/tests/test_registry.py index 2fc3bdcfc2..42c23f78b0 100644 --- a/aries_cloudagent/anoncreds/default/legacy_indy/tests/test_registry.py +++ b/aries_cloudagent/anoncreds/default/legacy_indy/tests/test_registry.py @@ -13,9 +13,7 @@ ) from base58 import alphabet -from .....anoncreds.base import ( - AnonCredsSchemaAlreadyExists, -) +from .....anoncreds.base import AnonCredsSchemaAlreadyExists from .....anoncreds.models.anoncreds_schema import ( AnonCredsSchema, GetSchemaResult, @@ -31,9 +29,7 @@ IndyLedgerRequestsExecutor, ) from .....messaging.responder import BaseResponder -from .....protocols.endorse_transaction.v1_0.manager import ( - TransactionManager, -) +from .....protocols.endorse_transaction.v1_0.manager import TransactionManager from .....protocols.endorse_transaction.v1_0.models.transaction_record import ( TransactionRecord, ) diff --git a/aries_cloudagent/anoncreds/holder.py b/aries_cloudagent/anoncreds/holder.py index 86e8432cdc..0fb3ac519d 100644 --- a/aries_cloudagent/anoncreds/holder.py +++ b/aries_cloudagent/anoncreds/holder.py @@ -3,11 +3,8 @@ import asyncio import json import logging -from marshmallow import INCLUDE import re from typing import Dict, Optional, Sequence, Tuple, Union -from pyld import jsonld -from pyld.jsonld import JsonLdProcessor from anoncreds import ( AnoncredsError, @@ -21,6 +18,9 @@ create_link_secret, ) from aries_askar import AskarError, AskarErrorCode +from marshmallow import INCLUDE +from pyld import jsonld +from pyld.jsonld import JsonLdProcessor from uuid_utils import uuid4 from ..anoncreds.models.anoncreds_schema import AnonCredsSchema @@ -29,8 +29,8 @@ from ..core.profile import Profile from ..storage.vc_holder.base import VCHolder from ..storage.vc_holder.vc_record import VCRecord -from ..vc.vc_ld import VerifiableCredential from ..vc.ld_proofs import DocumentLoader +from ..vc.vc_ld import VerifiableCredential from ..wallet.error import WalletNotFoundError from .error_messages import ANONCREDS_PROFILE_REQUIRED_MSG from .models.anoncreds_cred_def import CredDef diff --git a/aries_cloudagent/anoncreds/issuer.py b/aries_cloudagent/anoncreds/issuer.py index 9aedc6db1a..ad79173e16 100644 --- a/aries_cloudagent/anoncreds/issuer.py +++ b/aries_cloudagent/anoncreds/issuer.py @@ -17,17 +17,11 @@ ) from aries_askar import AskarError -from ..askar.profile_anon import ( - AskarAnoncredsProfile, - AskarAnoncredsProfileSession, -) +from ..askar.profile_anon import AskarAnoncredsProfile, AskarAnoncredsProfileSession from ..core.error import BaseError from ..core.event_bus import Event, EventBus from ..core.profile import Profile -from .base import ( - AnonCredsSchemaAlreadyExists, - BaseAnonCredsError, -) +from .base import AnonCredsSchemaAlreadyExists, BaseAnonCredsError from .error_messages import ANONCREDS_PROFILE_REQUIRED_MSG from .events import CredDefFinishedEvent from .models.anoncreds_cred_def import CredDef, CredDefResult diff --git a/aries_cloudagent/anoncreds/routes.py b/aries_cloudagent/anoncreds/routes.py index 2eec01d12e..9cf1d6ad98 100644 --- a/aries_cloudagent/anoncreds/routes.py +++ b/aries_cloudagent/anoncreds/routes.py @@ -26,10 +26,7 @@ UUIDFour, ) from ..revocation.error import RevocationNotSupportedError -from ..revocation.routes import ( - RevocationModuleResponseSchema, - RevRegIdMatchInfoSchema, -) +from ..revocation.routes import RevocationModuleResponseSchema, RevRegIdMatchInfoSchema from ..storage.error import StorageNotFoundError from ..utils.profiles import is_not_anoncreds_profile_raise_web_exception from .base import ( @@ -38,10 +35,7 @@ AnonCredsResolutionError, ) from .issuer import AnonCredsIssuer, AnonCredsIssuerError -from .models.anoncreds_cred_def import ( - CredDefResultSchema, - GetCredDefResultSchema, -) +from .models.anoncreds_cred_def import CredDefResultSchema, GetCredDefResultSchema from .models.anoncreds_revocation import RevListResultSchema, RevRegDefResultSchema from .models.anoncreds_schema import ( AnonCredsSchemaSchema, diff --git a/aries_cloudagent/anoncreds/tests/test_holder.py b/aries_cloudagent/anoncreds/tests/test_holder.py index e622d99495..a6ca5b0bf4 100644 --- a/aries_cloudagent/anoncreds/tests/test_holder.py +++ b/aries_cloudagent/anoncreds/tests/test_holder.py @@ -2,8 +2,6 @@ from copy import deepcopy from unittest import IsolatedAsyncioTestCase from unittest.mock import MagicMock -from pyld.jsonld import JsonLdProcessor -from pyld import jsonld import anoncreds import pytest @@ -22,6 +20,8 @@ W3cPresentation, ) from aries_askar import AskarError, AskarErrorCode +from pyld import jsonld +from pyld.jsonld import JsonLdProcessor from aries_cloudagent.anoncreds.tests.mock_objects import ( CRED_DEFS, diff --git a/aries_cloudagent/anoncreds/tests/test_issuer.py b/aries_cloudagent/anoncreds/tests/test_issuer.py index c48c9a6d6b..9082e20e8e 100644 --- a/aries_cloudagent/anoncreds/tests/test_issuer.py +++ b/aries_cloudagent/anoncreds/tests/test_issuer.py @@ -25,12 +25,8 @@ SchemaResult, SchemaState, ) -from aries_cloudagent.askar.profile import ( - AskarProfile, -) -from aries_cloudagent.askar.profile_anon import ( - AskarAnoncredsProfile, -) +from aries_cloudagent.askar.profile import AskarProfile +from aries_cloudagent.askar.profile_anon import AskarAnoncredsProfile from aries_cloudagent.core.event_bus import Event, MockEventBus from aries_cloudagent.core.in_memory.profile import ( InMemoryProfile, diff --git a/aries_cloudagent/anoncreds/tests/test_routes.py b/aries_cloudagent/anoncreds/tests/test_routes.py index 809b3f42e7..853fcb92d7 100644 --- a/aries_cloudagent/anoncreds/tests/test_routes.py +++ b/aries_cloudagent/anoncreds/tests/test_routes.py @@ -16,9 +16,7 @@ from aries_cloudagent.anoncreds.revocation_setup import DefaultRevocationSetup from aries_cloudagent.askar.profile_anon import AskarAnoncredsProfile from aries_cloudagent.core.event_bus import MockEventBus -from aries_cloudagent.core.in_memory.profile import ( - InMemoryProfile, -) +from aries_cloudagent.core.in_memory.profile import InMemoryProfile from aries_cloudagent.tests import mock from ...askar.profile import AskarProfile diff --git a/aries_cloudagent/anoncreds/tests/test_verifier.py b/aries_cloudagent/anoncreds/tests/test_verifier.py index df830258b3..1bf9f8550d 100644 --- a/aries_cloudagent/anoncreds/tests/test_verifier.py +++ b/aries_cloudagent/anoncreds/tests/test_verifier.py @@ -22,9 +22,7 @@ GetSchemaResult, ) from aries_cloudagent.askar.profile_anon import AskarAnoncredsProfile -from aries_cloudagent.core.in_memory.profile import ( - InMemoryProfile, -) +from aries_cloudagent.core.in_memory.profile import InMemoryProfile from aries_cloudagent.tests import mock from .. import verifier as test_module diff --git a/aries_cloudagent/anoncreds/verifier.py b/aries_cloudagent/anoncreds/verifier.py index 961d26cd8a..4f7972371d 100644 --- a/aries_cloudagent/anoncreds/verifier.py +++ b/aries_cloudagent/anoncreds/verifier.py @@ -11,9 +11,9 @@ from ..core.profile import Profile from ..indy.models.xform import indy_proof_req2non_revoc_intervals from ..messaging.util import canon, encode +from ..vc.vc_ld.validation_result import PresentationVerificationResult from .models.anoncreds_cred_def import GetCredDefResult from .registry import AnonCredsRegistry -from ..vc.vc_ld.validation_result import PresentationVerificationResult LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/askar/didcomm/tests/test_v2.py b/aries_cloudagent/askar/didcomm/tests/test_v2.py index ec3fa53dba..9b9650645c 100644 --- a/aries_cloudagent/askar/didcomm/tests/test_v2.py +++ b/aries_cloudagent/askar/didcomm/tests/test_v2.py @@ -1,17 +1,14 @@ import json - from unittest import mock -import pytest +import pytest from aries_askar import AskarError, Key, KeyAlg, Session from ....config.injection_context import InjectionContext -from ....utils.jwe import JweRecipient, b64url, JweEnvelope - +from ....utils.jwe import JweEnvelope, JweRecipient, b64url from ...profile import AskarProfileManager from .. import v2 as test_module - ALICE_KID = "did:example:alice#key-1" BOB_KID = "did:example:bob#key-1" CAROL_KID = "did:example:carol#key-2" diff --git a/aries_cloudagent/askar/didcomm/v1.py b/aries_cloudagent/askar/didcomm/v1.py index 5083ce1f49..02a00f3105 100644 --- a/aries_cloudagent/askar/didcomm/v1.py +++ b/aries_cloudagent/askar/didcomm/v1.py @@ -3,16 +3,11 @@ from collections import OrderedDict from typing import Optional, Sequence, Tuple -from aries_askar import ( - crypto_box, - Key, - KeyAlg, - Session, -) +from aries_askar import Key, KeyAlg, Session, crypto_box from aries_askar.bindings import key_get_secret_bytes from marshmallow import ValidationError -from ...utils.jwe import b64url, JweEnvelope, JweRecipient +from ...utils.jwe import JweEnvelope, JweRecipient, b64url from ...wallet.base import WalletError from ...wallet.crypto import extract_pack_recipients from ...wallet.util import b58_to_bytes, bytes_to_b58 diff --git a/aries_cloudagent/askar/didcomm/v2.py b/aries_cloudagent/askar/didcomm/v2.py index c00e0e8ac0..4e00c0030e 100644 --- a/aries_cloudagent/askar/didcomm/v2.py +++ b/aries_cloudagent/askar/didcomm/v2.py @@ -1,14 +1,13 @@ """DIDComm v2 envelope handling via Askar backend.""" import json - from collections import OrderedDict from typing import Mapping, Tuple, Union -from aries_askar import ecdh, AskarError, Key, KeyAlg, Session +from aries_askar import AskarError, Key, KeyAlg, Session, ecdh from marshmallow import ValidationError -from ...utils.jwe import b64url, from_b64url, JweEnvelope, JweRecipient +from ...utils.jwe import JweEnvelope, JweRecipient, b64url, from_b64url from ...wallet.base import WalletError diff --git a/aries_cloudagent/askar/profile_anon.py b/aries_cloudagent/askar/profile_anon.py index 8f881c514f..fe17aeb827 100644 --- a/aries_cloudagent/askar/profile_anon.py +++ b/aries_cloudagent/askar/profile_anon.py @@ -3,9 +3,6 @@ import asyncio import logging import time - -# import traceback - from typing import Any, Mapping from weakref import ref @@ -25,8 +22,10 @@ from ..utils.multi_ledger import get_write_ledger_config_for_profile from ..wallet.base import BaseWallet from ..wallet.crypto import validate_seed +from .store import AskarOpenStore, AskarStoreConfig + +# import traceback -from .store import AskarStoreConfig, AskarOpenStore LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/cache/tests/test_in_memory_cache.py b/aries_cloudagent/cache/tests/test_in_memory_cache.py index e805a49df7..381b60ab53 100644 --- a/aries_cloudagent/cache/tests/test_in_memory_cache.py +++ b/aries_cloudagent/cache/tests/test_in_memory_cache.py @@ -1,7 +1,7 @@ -import pytest - from asyncio import sleep, wait_for +import pytest + from ..base import CacheError from ..in_memory import InMemoryCache diff --git a/aries_cloudagent/commands/help.py b/aries_cloudagent/commands/help.py index 305b8d0726..dbac126eb1 100644 --- a/aries_cloudagent/commands/help.py +++ b/aries_cloudagent/commands/help.py @@ -1,14 +1,15 @@ """Help command for indexing available commands.""" -from configargparse import ArgumentParser from typing import Sequence +from configargparse import ArgumentParser + from ..version import __version__ def execute(argv: Sequence[str] = None): """Execute the help command.""" - from . import available_commands, load_command, PROG + from . import PROG, available_commands, load_command parser = ArgumentParser(prog=PROG) parser.add_argument( diff --git a/aries_cloudagent/commands/provision.py b/aries_cloudagent/commands/provision.py index bfc64c2bb8..962b38dc8e 100644 --- a/aries_cloudagent/commands/provision.py +++ b/aries_cloudagent/commands/provision.py @@ -1,12 +1,13 @@ """Provision command for setting up agent settings before starting.""" import asyncio -from configargparse import ArgumentParser from typing import Sequence +from configargparse import ArgumentParser + from ..config import argparse as arg -from ..config.default_context import DefaultContextBuilder from ..config.base import BaseError +from ..config.default_context import DefaultContextBuilder from ..config.ledger import ( get_genesis_transactions, ledger_config, @@ -15,11 +16,10 @@ from ..config.util import common_config from ..config.wallet import wallet_config from ..protocols.coordinate_mediation.mediation_invite_store import ( - MediationInviteStore, MediationInviteRecord, + MediationInviteStore, ) from ..storage.base import BaseStorage - from . import PROG diff --git a/aries_cloudagent/commands/start.py b/aries_cloudagent/commands/start.py index c74b8d3a79..f30fc5c582 100644 --- a/aries_cloudagent/commands/start.py +++ b/aries_cloudagent/commands/start.py @@ -5,19 +5,19 @@ import logging import signal import sys -from configargparse import ArgumentParser from typing import Coroutine, Sequence +from configargparse import ArgumentParser + try: import uvloop except ImportError: uvloop = None -from ..core.conductor import Conductor from ..config import argparse as arg from ..config.default_context import DefaultContextBuilder from ..config.util import common_config - +from ..core.conductor import Conductor from . import PROG LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/commands/tests/test_help.py b/aries_cloudagent/commands/tests/test_help.py index b94906795e..562b371ee2 100644 --- a/aries_cloudagent/commands/tests/test_help.py +++ b/aries_cloudagent/commands/tests/test_help.py @@ -1,5 +1,4 @@ -from unittest import mock -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from .. import help as command diff --git a/aries_cloudagent/commands/tests/test_init.py b/aries_cloudagent/commands/tests/test_init.py index 0944977dff..bd62ebd9b3 100644 --- a/aries_cloudagent/commands/tests/test_init.py +++ b/aries_cloudagent/commands/tests/test_init.py @@ -1,5 +1,4 @@ -from unittest import mock -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from ... import commands as test_module diff --git a/aries_cloudagent/commands/tests/test_provision.py b/aries_cloudagent/commands/tests/test_provision.py index 73b9e35630..9a098de320 100644 --- a/aries_cloudagent/commands/tests/test_provision.py +++ b/aries_cloudagent/commands/tests/test_provision.py @@ -1,12 +1,13 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ...config.base import ConfigError from ...config.error import ArgsParseError -from .. import provision as test_module from ...protocols.coordinate_mediation.mediation_invite_store import ( MediationInviteRecord, ) +from .. import provision as test_module class TestProvision(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/commands/tests/test_start.py b/aries_cloudagent/commands/tests/test_start.py index 372e61224b..c430c98299 100644 --- a/aries_cloudagent/commands/tests/test_start.py +++ b/aries_cloudagent/commands/tests/test_start.py @@ -1,10 +1,9 @@ import sys +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from ...config.error import ArgsParseError - from .. import start as test_module diff --git a/aries_cloudagent/commands/tests/test_upgrade.py b/aries_cloudagent/commands/tests/test_upgrade.py index a6506cd497..5d5b311004 100644 --- a/aries_cloudagent/commands/tests/test_upgrade.py +++ b/aries_cloudagent/commands/tests/test_upgrade.py @@ -1,16 +1,15 @@ import asyncio +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase -from ...core.in_memory import InMemoryProfile from ...connections.models.conn_record import ConnRecord +from ...core.in_memory import InMemoryProfile from ...storage.base import BaseStorage, BaseStorageSearch from ...storage.in_memory import InMemoryStorage from ...storage.record import StorageRecord from ...version import __version__ from ...wallet.models.wallet_record import WalletRecord - from .. import upgrade as test_module from ..upgrade import UpgradeError diff --git a/aries_cloudagent/commands/upgrade.py b/aries_cloudagent/commands/upgrade.py index 6a7272c50c..58e4f58698 100644 --- a/aries_cloudagent/commands/upgrade.py +++ b/aries_cloudagent/commands/upgrade.py @@ -5,16 +5,7 @@ import logging import os from enum import Enum -from typing import ( - Any, - Callable, - List, - Mapping, - Optional, - Sequence, - Tuple, - Union, -) +from typing import Any, Callable, List, Mapping, Optional, Sequence, Tuple, Union import yaml from configargparse import ArgumentParser diff --git a/aries_cloudagent/config/banner.py b/aries_cloudagent/config/banner.py index aed73be28f..6d60d682c6 100644 --- a/aries_cloudagent/config/banner.py +++ b/aries_cloudagent/config/banner.py @@ -1,9 +1,9 @@ """Module to contain logic to generate the banner for ACA-py.""" -from contextlib import contextmanager -from enum import Enum, auto import sys import textwrap +from contextlib import contextmanager +from enum import Enum, auto from typing import Optional, TextIO diff --git a/aries_cloudagent/config/default_context.py b/aries_cloudagent/config/default_context.py index aa0b96c867..c012b676a7 100644 --- a/aries_cloudagent/config/default_context.py +++ b/aries_cloudagent/config/default_context.py @@ -6,10 +6,7 @@ from ..core.event_bus import EventBus from ..core.goal_code_registry import GoalCodeRegistry from ..core.plugin_registry import PluginRegistry -from ..core.profile import ( - ProfileManager, - ProfileManagerProvider, -) +from ..core.profile import ProfileManager, ProfileManagerProvider from ..core.protocol_registry import ProtocolRegistry from ..protocols.actionmenu.v1_0.base_service import BaseMenuService from ..protocols.actionmenu.v1_0.driver_service import DriverMenuService diff --git a/aries_cloudagent/config/plugin_settings.py b/aries_cloudagent/config/plugin_settings.py index 1da1392ef0..a2830e87eb 100644 --- a/aries_cloudagent/config/plugin_settings.py +++ b/aries_cloudagent/config/plugin_settings.py @@ -4,7 +4,6 @@ from .base import BaseSettings - PLUGIN_CONFIG_KEY = "plugin_config" diff --git a/aries_cloudagent/config/tests/test_argparse.py b/aries_cloudagent/config/tests/test_argparse.py index 3698329143..f56c485a0d 100644 --- a/aries_cloudagent/config/tests/test_argparse.py +++ b/aries_cloudagent/config/tests/test_argparse.py @@ -1,7 +1,6 @@ -from configargparse import ArgumentTypeError +from unittest import IsolatedAsyncioTestCase, mock -from unittest import mock -from unittest import IsolatedAsyncioTestCase +from configargparse import ArgumentTypeError from .. import argparse from ..util import BoundedInt, ByteSize diff --git a/aries_cloudagent/config/tests/test_default_context.py b/aries_cloudagent/config/tests/test_default_context.py index 722038715a..1c75772a37 100644 --- a/aries_cloudagent/config/tests/test_default_context.py +++ b/aries_cloudagent/config/tests/test_default_context.py @@ -1,12 +1,10 @@ from tempfile import NamedTemporaryFile - from unittest import IsolatedAsyncioTestCase from ...cache.base import BaseCache from ...core.profile import ProfileManager from ...core.protocol_registry import ProtocolRegistry from ...transport.wire_format import BaseWireFormat - from ..default_context import DefaultContextBuilder from ..injection_context import InjectionContext diff --git a/aries_cloudagent/config/tests/test_injector.py b/aries_cloudagent/config/tests/test_injector.py index 3b5023307f..e6e98e5b03 100644 --- a/aries_cloudagent/config/tests/test_injector.py +++ b/aries_cloudagent/config/tests/test_injector.py @@ -1,8 +1,8 @@ from unittest import IsolatedAsyncioTestCase -from ..base import BaseProvider, BaseInjector, BaseSettings, InjectionError +from ..base import BaseInjector, BaseProvider, BaseSettings, InjectionError from ..injector import Injector -from ..provider import ClassProvider, CachedProvider +from ..provider import CachedProvider, ClassProvider class MockProvider(BaseProvider): diff --git a/aries_cloudagent/config/tests/test_ledger.py b/aries_cloudagent/config/tests/test_ledger.py index 6af560d148..6d16b57908 100644 --- a/aries_cloudagent/config/tests/test_ledger.py +++ b/aries_cloudagent/config/tests/test_ledger.py @@ -1,13 +1,14 @@ +from unittest import IsolatedAsyncioTestCase + import pytest + from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase -from .. import argparse from ...core.in_memory import InMemoryProfile from ...ledger.base import BaseLedger from ...ledger.error import LedgerError from ...wallet.base import BaseWallet - +from .. import argparse from .. import ledger as test_module TEST_DID = "55GkHamhTU1ZbTbV2ab9DE" diff --git a/aries_cloudagent/config/tests/test_provider.py b/aries_cloudagent/config/tests/test_provider.py index 944b4a7b86..8d949d5cc9 100644 --- a/aries_cloudagent/config/tests/test_provider.py +++ b/aries_cloudagent/config/tests/test_provider.py @@ -1,19 +1,16 @@ from tempfile import NamedTemporaryFile +from unittest import IsolatedAsyncioTestCase, mock from weakref import ref -from unittest import mock -from unittest import IsolatedAsyncioTestCase - from ...utils.stats import Collector - from ..base import InjectionError from ..injection_context import InjectionContext from ..provider import ( BaseProvider, + CachedProvider, ClassProvider, InstanceProvider, StatsProvider, - CachedProvider, ) from ..settings import Settings diff --git a/aries_cloudagent/config/tests/test_settings.py b/aries_cloudagent/config/tests/test_settings.py index bad58f38f2..8689ac7109 100644 --- a/aries_cloudagent/config/tests/test_settings.py +++ b/aries_cloudagent/config/tests/test_settings.py @@ -1,11 +1,11 @@ -import pytest - from unittest import TestCase +import pytest + from aries_cloudagent.config.plugin_settings import PluginSettings -from ..settings import Settings from ..plugin_settings import PLUGIN_CONFIG_KEY +from ..settings import Settings class TestSettings(TestCase): diff --git a/aries_cloudagent/config/tests/test_wallet.py b/aries_cloudagent/config/tests/test_wallet.py index 45b96b5f9a..87d8bec3e9 100644 --- a/aries_cloudagent/config/tests/test_wallet.py +++ b/aries_cloudagent/config/tests/test_wallet.py @@ -1,16 +1,16 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ...core.in_memory import InMemoryProfile from ...core.profile import ProfileManager, ProfileSession from ...storage.base import BaseStorage from ...storage.record import StorageRecord -from ...version import __version__, RECORD_TYPE_ACAPY_VERSION +from ...version import RECORD_TYPE_ACAPY_VERSION, __version__ from ...wallet.base import BaseWallet - from .. import wallet as test_module -from ..injector import Injector from ..injection_context import InjectionContext +from ..injector import Injector TEST_DID = "55GkHamhTU1ZbTbV2ab9DE" TEST_VERKEY = "3Dn1SJNPaCXcvvJvSbsFWP2xaCjMom3can8CQNhWrTRx" diff --git a/aries_cloudagent/connections/base_manager.py b/aries_cloudagent/connections/base_manager.py index 19b9439223..f5ea4451b5 100644 --- a/aries_cloudagent/connections/base_manager.py +++ b/aries_cloudagent/connections/base_manager.py @@ -13,13 +13,8 @@ from did_peer_4 import encode, long_to_short from did_peer_4.input_doc import KeySpec as KeySpec_DP4 from did_peer_4.input_doc import input_doc_from_keys_and_services -from pydid import ( - BaseDIDDocument as ResolvedDocument, -) -from pydid import ( - DIDCommService, - VerificationMethod, -) +from pydid import BaseDIDDocument as ResolvedDocument +from pydid import DIDCommService, VerificationMethod from pydid.verification_method import ( Ed25519VerificationKey2018, Ed25519VerificationKey2020, diff --git a/aries_cloudagent/connections/models/conn_record.py b/aries_cloudagent/connections/models/conn_record.py index 7ec90f3d73..9bdc81651c 100644 --- a/aries_cloudagent/connections/models/conn_record.py +++ b/aries_cloudagent/connections/models/conn_record.py @@ -25,12 +25,8 @@ ) from ...protocols.connections.v1_0.messages.connection_request import ConnectionRequest from ...protocols.didcomm_prefix import DIDCommPrefix -from ...protocols.didexchange.v1_0.message_types import ( - ARIES_PROTOCOL as DIDEX_1_1, -) -from ...protocols.didexchange.v1_0.message_types import ( - DIDEX_1_0, -) +from ...protocols.didexchange.v1_0.message_types import ARIES_PROTOCOL as DIDEX_1_1 +from ...protocols.didexchange.v1_0.message_types import DIDEX_1_0 from ...protocols.didexchange.v1_0.messages.request import DIDXRequest from ...protocols.out_of_band.v1_0.messages.invitation import ( InvitationMessage as OOBInvitation, diff --git a/aries_cloudagent/connections/models/diddoc/diddoc.py b/aries_cloudagent/connections/models/diddoc/diddoc.py index 170da4ec9c..43fc2d7988 100644 --- a/aries_cloudagent/connections/models/diddoc/diddoc.py +++ b/aries_cloudagent/connections/models/diddoc/diddoc.py @@ -18,11 +18,9 @@ import json import logging - from typing import List, Sequence, Union from ....did.did_key import DIDKey - from .publickey import PublicKey, PublicKeyType from .service import Service from .util import canon_did, canon_ref, ok_did, resource diff --git a/aries_cloudagent/connections/models/diddoc/publickey.py b/aries_cloudagent/connections/models/diddoc/publickey.py index 7390e2f0ba..1a8c5687a4 100644 --- a/aries_cloudagent/connections/models/diddoc/publickey.py +++ b/aries_cloudagent/connections/models/diddoc/publickey.py @@ -21,7 +21,6 @@ from .util import canon_did, canon_ref - LinkedDataKeySpec = namedtuple("LinkedDataKeySpec", "ver_type authn_type specifier") diff --git a/aries_cloudagent/connections/models/diddoc/service.py b/aries_cloudagent/connections/models/diddoc/service.py index 919e1e126d..28ee50a0e3 100644 --- a/aries_cloudagent/connections/models/diddoc/service.py +++ b/aries_cloudagent/connections/models/diddoc/service.py @@ -18,8 +18,8 @@ from typing import List, Sequence, Union -from .util import canon_did, canon_ref from .publickey import PublicKey +from .util import canon_did, canon_ref class Service: diff --git a/aries_cloudagent/connections/models/diddoc/util.py b/aries_cloudagent/connections/models/diddoc/util.py index 26ce9352de..0301c3e19a 100644 --- a/aries_cloudagent/connections/models/diddoc/util.py +++ b/aries_cloudagent/connections/models/diddoc/util.py @@ -16,9 +16,10 @@ limitations under the License. """ -from base58 import b58decode from urllib.parse import urlparse +from base58 import b58decode + def resource(ref: str, delimiter: str = None) -> str: """Extract the resource for an identifier. diff --git a/aries_cloudagent/connections/models/tests/test_conn_record.py b/aries_cloudagent/connections/models/tests/test_conn_record.py index b396a9b111..c73713275d 100644 --- a/aries_cloudagent/connections/models/tests/test_conn_record.py +++ b/aries_cloudagent/connections/models/tests/test_conn_record.py @@ -8,7 +8,6 @@ from ....protocols.connections.v1_0.models.connection_detail import ConnectionDetail from ....storage.base import BaseStorage from ....storage.error import StorageNotFoundError - from ..conn_record import ConnRecord from ..diddoc.diddoc import DIDDoc diff --git a/aries_cloudagent/connections/tests/test_base_manager.py b/aries_cloudagent/connections/tests/test_base_manager.py index bcc7f0d4d0..b721935ff8 100644 --- a/aries_cloudagent/connections/tests/test_base_manager.py +++ b/aries_cloudagent/connections/tests/test_base_manager.py @@ -1,9 +1,8 @@ """Test connections base manager.""" +from unittest import IsolatedAsyncioTestCase from unittest.mock import call -from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from pydid import DID, DIDDocument, DIDDocumentBuilder from pydid.doc.builder import ServiceBuilder from pydid.verification_method import ( @@ -13,6 +12,8 @@ JsonWebKey2020, ) +from aries_cloudagent.tests import mock + from ...cache.base import BaseCache from ...cache.in_memory import InMemoryCache from ...config.base import InjectionError @@ -33,8 +34,8 @@ MediationRecord, ) from ...protocols.coordinate_mediation.v1_0.route_manager import ( - RouteManager, CoordinateMediationV1RouteManager, + RouteManager, ) from ...protocols.discovery.v2_0.manager import V20DiscoveryMgr from ...resolver.default.key import KeyDIDResolver @@ -44,7 +45,7 @@ from ...transport.inbound.receipt import MessageReceipt from ...utils.multiformats import multibase, multicodec from ...wallet.base import DIDInfo -from ...wallet.did_method import DIDMethods, SOV +from ...wallet.did_method import SOV, DIDMethods from ...wallet.error import WalletNotFoundError from ...wallet.in_memory import InMemoryWallet from ...wallet.key_type import ED25519 diff --git a/aries_cloudagent/core/event_bus.py b/aries_cloudagent/core/event_bus.py index 22d7c8f922..01fb319db4 100644 --- a/aries_cloudagent/core/event_bus.py +++ b/aries_cloudagent/core/event_bus.py @@ -1,9 +1,11 @@ """A simple event bus.""" import asyncio -from contextlib import contextmanager import logging +from contextlib import contextmanager +from functools import partial from typing import ( + TYPE_CHECKING, Any, Awaitable, Callable, @@ -14,10 +16,8 @@ NamedTuple, Optional, Pattern, - TYPE_CHECKING, Tuple, ) -from functools import partial if TYPE_CHECKING: # To avoid circular import error from .profile import Profile diff --git a/aries_cloudagent/core/in_memory/didcomm/derive_1pu.py b/aries_cloudagent/core/in_memory/didcomm/derive_1pu.py index 39a9451636..386b7f769e 100644 --- a/aries_cloudagent/core/in_memory/didcomm/derive_1pu.py +++ b/aries_cloudagent/core/in_memory/didcomm/derive_1pu.py @@ -1,6 +1,6 @@ """Functions for performing Key Agreement using ECDH-1PU.""" -from .derive_ecdh import derive_shared_secret, concat_kdf +from .derive_ecdh import concat_kdf, derive_shared_secret def derive_1pu(ze, zs, alg, apu, apv, keydatalen): diff --git a/aries_cloudagent/core/in_memory/didcomm/derive_ecdh.py b/aries_cloudagent/core/in_memory/didcomm/derive_ecdh.py index d737d38425..b2ce8ee391 100644 --- a/aries_cloudagent/core/in_memory/didcomm/derive_ecdh.py +++ b/aries_cloudagent/core/in_memory/didcomm/derive_ecdh.py @@ -1,7 +1,6 @@ """Functions for performing Key Agreement.""" import hashlib - from binascii import unhexlify from typing import Union diff --git a/aries_cloudagent/core/in_memory/didcomm/tests/test_1pu.py b/aries_cloudagent/core/in_memory/didcomm/tests/test_1pu.py index b6b70d5cc8..a1ace8a3f9 100644 --- a/aries_cloudagent/core/in_memory/didcomm/tests/test_1pu.py +++ b/aries_cloudagent/core/in_memory/didcomm/tests/test_1pu.py @@ -1,7 +1,6 @@ from binascii import unhexlify from .....wallet.util import b64_to_bytes - from ..derive_1pu import derive_receiver_1pu, derive_sender_1pu diff --git a/aries_cloudagent/core/in_memory/didcomm/tests/test_ecdh.py b/aries_cloudagent/core/in_memory/didcomm/tests/test_ecdh.py index dc1db0bd54..e9d4f2aa13 100644 --- a/aries_cloudagent/core/in_memory/didcomm/tests/test_ecdh.py +++ b/aries_cloudagent/core/in_memory/didcomm/tests/test_ecdh.py @@ -1,9 +1,9 @@ from ecdsa import ECDH, NIST256p, SigningKey from ..derive_ecdh import ( + concat_kdf, derive_shared_secret, derive_shared_secret_from_key, - concat_kdf, ) diff --git a/aries_cloudagent/core/oob_processor.py b/aries_cloudagent/core/oob_processor.py index 49a7ff33e6..15f4028837 100644 --- a/aries_cloudagent/core/oob_processor.py +++ b/aries_cloudagent/core/oob_processor.py @@ -4,17 +4,17 @@ import logging from typing import Any, Callable, Dict, List, Optional -from ..messaging.agent_message import AgentMessage from ..connections.models.conn_record import ConnRecord from ..connections.models.connection_target import ConnectionTarget +from ..messaging.agent_message import AgentMessage from ..messaging.decorators.service_decorator import ServiceDecorator from ..messaging.request_context import RequestContext from ..protocols.didcomm_prefix import DIDCommPrefix from ..protocols.issue_credential.v1_0.message_types import CREDENTIAL_OFFER from ..protocols.issue_credential.v2_0.message_types import CRED_20_OFFER +from ..protocols.out_of_band.v1_0.models.oob_record import OobRecord from ..protocols.present_proof.v1_0.message_types import PRESENTATION_REQUEST from ..protocols.present_proof.v2_0.message_types import PRES_20_REQUEST -from ..protocols.out_of_band.v1_0.models.oob_record import OobRecord from ..storage.error import StorageNotFoundError from ..transport.inbound.message import InboundMessage from ..transport.outbound.message import OutboundMessage diff --git a/aries_cloudagent/core/plugin_registry.py b/aries_cloudagent/core/plugin_registry.py index b5d4fb107e..27ca46eff3 100644 --- a/aries_cloudagent/core/plugin_registry.py +++ b/aries_cloudagent/core/plugin_registry.py @@ -3,15 +3,14 @@ import logging from collections import OrderedDict from types import ModuleType -from typing import Sequence, Iterable +from typing import Iterable, Sequence from ..config.injection_context import InjectionContext from ..core.event_bus import EventBus from ..utils.classloader import ClassLoader, ModuleLoadError - from .error import ProtocolDefinitionValidationError -from .protocol_registry import ProtocolRegistry from .goal_code_registry import GoalCodeRegistry +from .protocol_registry import ProtocolRegistry LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/core/tests/test_dispatcher.py b/aries_cloudagent/core/tests/test_dispatcher.py index 5e8d1143f0..c53eec0bb6 100644 --- a/aries_cloudagent/core/tests/test_dispatcher.py +++ b/aries_cloudagent/core/tests/test_dispatcher.py @@ -1,11 +1,11 @@ import json - from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock -import pytest +import pytest from marshmallow import EXCLUDE +from aries_cloudagent.tests import mock + from ...cache.base import BaseCache from ...cache.in_memory import InMemoryCache from ...config.injection_context import InjectionContext @@ -15,18 +15,17 @@ from ...core.protocol_registry import ProtocolRegistry from ...messaging.agent_message import AgentMessage, AgentMessageSchema from ...messaging.request_context import RequestContext +from ...protocols.coordinate_mediation.v1_0.route_manager import RouteManager from ...protocols.didcomm_prefix import DIDCommPrefix from ...protocols.issue_credential.v2_0.message_types import CRED_20_PROBLEM_REPORT from ...protocols.issue_credential.v2_0.messages.cred_problem_report import ( V20CredProblemReport, ) from ...protocols.problem_report.v1_0.message import ProblemReport -from ...protocols.coordinate_mediation.v1_0.route_manager import RouteManager from ...transport.inbound.message import InboundMessage from ...transport.inbound.receipt import MessageReceipt from ...transport.outbound.message import OutboundMessage from ...utils.stats import Collector - from .. import dispatcher as test_module diff --git a/aries_cloudagent/core/tests/test_event_bus.py b/aries_cloudagent/core/tests/test_event_bus.py index 0d93b584ce..c1cf2b43ef 100644 --- a/aries_cloudagent/core/tests/test_event_bus.py +++ b/aries_cloudagent/core/tests/test_event_bus.py @@ -1,12 +1,12 @@ """Test Event Bus.""" -import pytest import re - from unittest import mock +import pytest + from .. import event_bus as test_module -from ..event_bus import EventBus, Event +from ..event_bus import Event, EventBus # pylint: disable=redefined-outer-name diff --git a/aries_cloudagent/core/tests/test_goal_code_registry.py b/aries_cloudagent/core/tests/test_goal_code_registry.py index a59aed56c1..1d2a3dc935 100644 --- a/aries_cloudagent/core/tests/test_goal_code_registry.py +++ b/aries_cloudagent/core/tests/test_goal_code_registry.py @@ -1,7 +1,6 @@ from unittest import IsolatedAsyncioTestCase from ...protocols.issue_credential.v1_0.message_types import CONTROLLERS - from ..goal_code_registry import GoalCodeRegistry diff --git a/aries_cloudagent/core/tests/test_oob_processor.py b/aries_cloudagent/core/tests/test_oob_processor.py index 4345e5b761..ef22fb2616 100644 --- a/aries_cloudagent/core/tests/test_oob_processor.py +++ b/aries_cloudagent/core/tests/test_oob_processor.py @@ -1,9 +1,9 @@ import json - from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock from unittest.mock import ANY +from aries_cloudagent.tests import mock + from ...connections.models.conn_record import ConnRecord from ...messaging.decorators.attach_decorator import AttachDecorator from ...messaging.decorators.service_decorator import ServiceDecorator diff --git a/aries_cloudagent/core/tests/test_profile.py b/aries_cloudagent/core/tests/test_profile.py index 9e45badeb0..c6284a8547 100644 --- a/aries_cloudagent/core/tests/test_profile.py +++ b/aries_cloudagent/core/tests/test_profile.py @@ -2,7 +2,6 @@ from ...config.base import InjectionError from ...config.injection_context import InjectionContext - from ..error import ProfileSessionInactiveError from ..profile import Profile, ProfileManagerProvider, ProfileSession diff --git a/aries_cloudagent/core/tests/test_protocol_registry.py b/aries_cloudagent/core/tests/test_protocol_registry.py index bbc24c2894..738a3c9e6b 100644 --- a/aries_cloudagent/core/tests/test_protocol_registry.py +++ b/aries_cloudagent/core/tests/test_protocol_registry.py @@ -1,9 +1,9 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ...config.injection_context import InjectionContext from ...utils.classloader import ClassLoader, DeferLoad - from ..protocol_registry import ProtocolRegistry diff --git a/aries_cloudagent/did/did_key.py b/aries_cloudagent/did/did_key.py index 872c17d6e8..2db750d139 100644 --- a/aries_cloudagent/did/did_key.py +++ b/aries_cloudagent/did/did_key.py @@ -1,19 +1,18 @@ """DID Key class and resolver methods.""" +from ..vc.ld_proofs.constants import DID_V1_CONTEXT_URL from ..wallet.crypto import ed25519_pk_to_curve25519 from ..wallet.key_type import ( + BLS12381G1, BLS12381G1G2, + BLS12381G2, ED25519, - KeyType, - BLS12381G1, X25519, - BLS12381G2, + KeyType, KeyTypes, ) from ..wallet.util import b58_to_bytes, bytes_to_b58 -from ..vc.ld_proofs.constants import DID_V1_CONTEXT_URL - class DIDKey: """DID Key parser and resolver.""" diff --git a/aries_cloudagent/did/tests/test_did_key_bls12381g1.py b/aries_cloudagent/did/tests/test_did_key_bls12381g1.py index f5b84b3bd0..3c65dc1b51 100644 --- a/aries_cloudagent/did/tests/test_did_key_bls12381g1.py +++ b/aries_cloudagent/did/tests/test_did_key_bls12381g1.py @@ -1,9 +1,8 @@ from unittest import TestCase - from ...wallet.key_type import BLS12381G1 from ...wallet.util import b58_to_bytes -from ..did_key import DIDKey, DID_KEY_RESOLVERS +from ..did_key import DID_KEY_RESOLVERS, DIDKey from .test_dids import ( DID_BLS12381G1_z3tEFALUKUzzCAvytMHX8X4SnsNsq6T5tC5Zb18oQEt1FqNcJXqJ3AA9umgzA9yoqPBeWA, ) diff --git a/aries_cloudagent/did/tests/test_did_key_bls12381g1g2.py b/aries_cloudagent/did/tests/test_did_key_bls12381g1g2.py index 5877bed1c6..9033b5409e 100644 --- a/aries_cloudagent/did/tests/test_did_key_bls12381g1g2.py +++ b/aries_cloudagent/did/tests/test_did_key_bls12381g1g2.py @@ -2,7 +2,7 @@ from ...wallet.key_type import BLS12381G1, BLS12381G1G2, BLS12381G2 from ...wallet.util import b58_to_bytes -from ..did_key import DIDKey, DID_KEY_RESOLVERS +from ..did_key import DID_KEY_RESOLVERS, DIDKey from .test_dids import ( DID_BLS12381G1G2_z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s, ) diff --git a/aries_cloudagent/did/tests/test_did_key_bls12381g2.py b/aries_cloudagent/did/tests/test_did_key_bls12381g2.py index 0eb4b4c8f4..929b5c1ef7 100644 --- a/aries_cloudagent/did/tests/test_did_key_bls12381g2.py +++ b/aries_cloudagent/did/tests/test_did_key_bls12381g2.py @@ -2,7 +2,7 @@ from ...wallet.key_type import BLS12381G2 from ...wallet.util import b58_to_bytes -from ..did_key import DIDKey, DID_KEY_RESOLVERS +from ..did_key import DID_KEY_RESOLVERS, DIDKey from .test_dids import ( DID_BLS12381G2_zUC71nmwvy83x1UzNKbZbS7N9QZx8rqpQx3Ee3jGfKiEkZngTKzsRoqobX6wZdZF5F93pSGYYco3gpK9tc53ruWUo2tkBB9bxPCFBUjq2th8FbtT4xih6y6Q1K9EL4Th86NiCGT, ) diff --git a/aries_cloudagent/did/tests/test_did_key_ed25519.py b/aries_cloudagent/did/tests/test_did_key_ed25519.py index c5063719bc..487f3757cb 100644 --- a/aries_cloudagent/did/tests/test_did_key_ed25519.py +++ b/aries_cloudagent/did/tests/test_did_key_ed25519.py @@ -2,7 +2,7 @@ from ...wallet.key_type import ED25519 from ...wallet.util import b58_to_bytes -from ..did_key import DIDKey, DID_KEY_RESOLVERS +from ..did_key import DID_KEY_RESOLVERS, DIDKey from .test_dids import DID_ED25519_z6MkmjY8GnV5i9YTDtPETC2uUAW6ejw3nk5mXF5yci5ab7th TEST_ED25519_BASE58_KEY = "8HH5gYEeNc3z7PYXmd54d4x6qAfCNrqQqEB3nS7Zfu7K" diff --git a/aries_cloudagent/did/tests/test_did_key_x25519.py b/aries_cloudagent/did/tests/test_did_key_x25519.py index 84513da814..43bbb8b0eb 100644 --- a/aries_cloudagent/did/tests/test_did_key_x25519.py +++ b/aries_cloudagent/did/tests/test_did_key_x25519.py @@ -2,7 +2,7 @@ from ...wallet.key_type import X25519 from ...wallet.util import b58_to_bytes -from ..did_key import DIDKey, DID_KEY_RESOLVERS +from ..did_key import DID_KEY_RESOLVERS, DIDKey from .test_dids import DID_X25519_z6LShLeXRTzevtwcfehaGEzCMyL3bNsAeKCwcqwJxyCo63yE TEST_X25519_BASE58_KEY = "6fUMuABnqSDsaGKojbUF3P7ZkEL3wi2njsDdUWZGNgCU" diff --git a/aries_cloudagent/didcomm_v2/adapters.py b/aries_cloudagent/didcomm_v2/adapters.py index 349c5479ce..9f4b5f3e93 100644 --- a/aries_cloudagent/didcomm_v2/adapters.py +++ b/aries_cloudagent/didcomm_v2/adapters.py @@ -2,6 +2,7 @@ import logging from typing import Optional, cast + from aries_askar import Key try: @@ -11,11 +12,10 @@ except ModuleNotFoundError as err: raise ImportError("Install the didcommv2 extra to use this module.") from err +from ..askar.profile import AskarProfileSession from ..core.error import BaseError from ..core.profile import Profile, ProfileSession from ..resolver.did_resolver import DIDResolver -from ..askar.profile import AskarProfileSession - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/didcomm_v2/tests/test_adapters.py b/aries_cloudagent/didcomm_v2/tests/test_adapters.py index 4cee64c603..b67c8212a0 100644 --- a/aries_cloudagent/didcomm_v2/tests/test_adapters.py +++ b/aries_cloudagent/didcomm_v2/tests/test_adapters.py @@ -1,8 +1,7 @@ -from aries_cloudagent.config.injection_context import InjectionContext -from aries_cloudagent.resolver.base import BaseDIDResolver -from aries_cloudagent.tests.mock import MagicMock, AsyncMock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.askar.profile import AskarProfile, AskarProfileSession +from aries_cloudagent.config.injection_context import InjectionContext from aries_cloudagent.core.event_bus import EventBus from aries_cloudagent.core.in_memory.profile import InMemoryProfile from aries_cloudagent.core.profile import Profile @@ -10,12 +9,12 @@ from aries_cloudagent.protocols.coordinate_mediation.v1_0.route_manager import ( RouteManager, ) - +from aries_cloudagent.resolver.base import BaseDIDResolver +from aries_cloudagent.resolver.did_resolver import DIDResolver +from aries_cloudagent.tests.mock import AsyncMock, MagicMock from aries_cloudagent.utils.stats import Collector from ..adapters import ResolverAdapter, SecretsAdapter, SecretsAdapterError -from aries_cloudagent.resolver.did_resolver import DIDResolver -from aries_cloudagent.askar.profile import AskarProfileSession, AskarProfile def make_profile() -> Profile: diff --git a/aries_cloudagent/indy/credx/tests/test_cred_issuance.py b/aries_cloudagent/indy/credx/tests/test_cred_issuance.py index 6ffe5c964c..1eb2726dd6 100644 --- a/aries_cloudagent/indy/credx/tests/test_cred_issuance.py +++ b/aries_cloudagent/indy/credx/tests/test_cred_issuance.py @@ -1,9 +1,10 @@ import json import tempfile +from unittest import IsolatedAsyncioTestCase + import pytest from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from ....askar.profile import AskarProfileManager from ....config.injection_context import InjectionContext @@ -11,9 +12,7 @@ from ....ledger.multiple_ledger.ledger_requests_executor import ( IndyLedgerRequestsExecutor, ) - -from .. import issuer, holder, verifier - +from .. import holder, issuer, verifier TEST_DID = "55GkHamhTU1ZbTbV2ab9DE" SCHEMA_NAME = "resident" diff --git a/aries_cloudagent/indy/credx/verifier.py b/aries_cloudagent/indy/credx/verifier.py index 505a840f25..3f3ef06d78 100644 --- a/aries_cloudagent/indy/credx/verifier.py +++ b/aries_cloudagent/indy/credx/verifier.py @@ -2,13 +2,11 @@ import asyncio import logging - from typing import Tuple from indy_credx import CredxError, Presentation from ...core.profile import Profile - from ..verifier import IndyVerifier, PresVerifyMsg LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/indy/models/cred_request.py b/aries_cloudagent/indy/models/cred_request.py index 805cdaa61d..f43bbf89d2 100644 --- a/aries_cloudagent/indy/models/cred_request.py +++ b/aries_cloudagent/indy/models/cred_request.py @@ -8,9 +8,9 @@ from ...messaging.valid import ( INDY_CRED_DEF_ID_EXAMPLE, INDY_CRED_DEF_ID_VALIDATE, - UUID4_EXAMPLE, NUM_STR_WHOLE_EXAMPLE, NUM_STR_WHOLE_VALIDATE, + UUID4_EXAMPLE, ) diff --git a/aries_cloudagent/indy/models/predicate.py b/aries_cloudagent/indy/models/predicate.py index 29278ad036..d455e78d55 100644 --- a/aries_cloudagent/indy/models/predicate.py +++ b/aries_cloudagent/indy/models/predicate.py @@ -4,7 +4,6 @@ from enum import Enum from typing import Any - Relation = namedtuple("Relation", "fortran wql math yes no") diff --git a/aries_cloudagent/indy/tests/test_verifier.py b/aries_cloudagent/indy/tests/test_verifier.py index 63b931f1d9..81c92f7cca 100644 --- a/aries_cloudagent/indy/tests/test_verifier.py +++ b/aries_cloudagent/indy/tests/test_verifier.py @@ -1,7 +1,7 @@ from copy import deepcopy from time import time - from unittest import IsolatedAsyncioTestCase + from aries_cloudagent.tests import mock from ...core.in_memory import InMemoryProfile @@ -10,11 +10,9 @@ ) from ...multitenant.base import BaseMultitenantManager from ...multitenant.manager import MultitenantManager - from .. import verifier as test_module from ..verifier import IndyVerifier - INDY_PROOF_REQ_NAME = { "nonce": "15606741555044336341559", "name": "proof_req", diff --git a/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py b/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py index 4e7b4997aa..8ec4cbc34e 100644 --- a/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py +++ b/aries_cloudagent/ledger/merkel_validation/domain_txn_handler.py @@ -1,65 +1,65 @@ """Utilities for Processing Replies to Domain Read Requests.""" -import base58 import base64 import hashlib import json - from binascii import hexlify from copy import deepcopy -from .utils import audit_path_length +import base58 + from .constants import ( ACCUM_FROM, ACCUM_TO, ALL_ATR_KEYS, - LAST_SEQ_NO, - VAL, - VALUE, + ATTR_NAMES, + ATTRIB, + AUDIT_PATH, + CLAIM_DEF, + CRED_DEF_ID, + DATA, + DEST, + FROM, + GET_ATTR, + GET_CLAIM_DEF, + GET_NYM, + GET_REVOC_REG_DEF, + GET_REVOC_REG_DELTA, + GET_REVOC_REG_ENTRY, + GET_SCHEMA, HASH, + LAST_SEQ_NO, LAST_UPDATE_TIME, - MARKER_CLAIM_DEF, - MARKER_SCHEMA, MARKER_ATTR, + MARKER_CLAIM_DEF, MARKER_REVOC_DEF, MARKER_REVOC_REG_ENTRY, MARKER_REVOC_REG_ENTRY_ACCUM, - GET_NYM, - GET_ATTR, - GET_CLAIM_DEF, - GET_REVOC_REG_DEF, - GET_REVOC_REG_ENTRY, - GET_REVOC_REG_DELTA, - GET_SCHEMA, - NYM, - ATTRIB, - SCHEMA, - CLAIM_DEF, - REVOC_REG_DEF, - REVOC_REG_ENTRY, - DEST, - RESULT, - DATA, - SEQ_NO, - TXN_METADATA, - TXN_TIME, - TXN, - NAME, - VERSION, - ATTR_NAMES, - FROM, + MARKER_SCHEMA, METADATA, + NAME, + NYM, + PROOF_NODES, REF, - CRED_DEF_ID, + RESULT, REVOC_DEF_TYPE, REVOC_DEF_TYPE_ID, - AUDIT_PATH, + REVOC_REG_DEF, + REVOC_REG_ENTRY, ROOT_HASH, + SCHEMA, + SEQ_NO, STATE_PROOF, STATE_PROOF_FROM, - PROOF_NODES, TAG, + TXN, + TXN_METADATA, + TXN_TIME, + VAL, + VALUE, + VERSION, ) +from .utils import audit_path_length def _extract_attr_typed_value(txn_data): diff --git a/aries_cloudagent/ledger/merkel_validation/hasher.py b/aries_cloudagent/ledger/merkel_validation/hasher.py index 8d036f3b38..af0d07ac1d 100644 --- a/aries_cloudagent/ledger/merkel_validation/hasher.py +++ b/aries_cloudagent/ledger/merkel_validation/hasher.py @@ -1,7 +1,6 @@ """Merkle tree hasher for leaf and children nodes.""" import hashlib - from binascii import hexlify, unhexlify 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 a6a8e3b439..b098f45af1 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,28 +1,27 @@ """Tests for Domain Txn Handling Utils.""" -import base58 import json - from copy import deepcopy - from unittest import TestCase +import base58 + from ..domain_txn_handler import ( _extract_attr_typed_value, - parse_attr_txn, decode_state_value, extract_params_write_request, hash_of, make_state_path_for_attr, + parse_attr_txn, prepare_attr_for_state, - prepare_nym_for_state, - prepare_revoc_reg_entry_for_state, - prepare_schema_for_state, - prepare_get_claim_def_for_state, prepare_claim_def_for_state, - prepare_revoc_def_for_state, + prepare_get_claim_def_for_state, prepare_get_revoc_reg_entry_for_state, + prepare_nym_for_state, + prepare_revoc_def_for_state, prepare_revoc_reg_entry_accum_for_state, + prepare_revoc_reg_entry_for_state, + prepare_schema_for_state, ) CLAIM_DEF_TXN = { diff --git a/aries_cloudagent/ledger/merkel_validation/tests/test_trie.py b/aries_cloudagent/ledger/merkel_validation/tests/test_trie.py index 239edc4d73..aac52e4a55 100644 --- a/aries_cloudagent/ledger/merkel_validation/tests/test_trie.py +++ b/aries_cloudagent/ledger/merkel_validation/tests/test_trie.py @@ -1,26 +1,22 @@ from unittest import IsolatedAsyncioTestCase -from ..domain_txn_handler import ( - prepare_for_state_read, - get_proof_nodes, -) +from ..domain_txn_handler import get_proof_nodes, prepare_for_state_read from ..hasher import HexTreeHasher -from ..trie import SubTrie from ..merkel_verifier import MerkleVerifier - +from ..trie import SubTrie from .test_data import ( - GET_REVOC_REG_REPLY_A, - GET_REVOC_REG_REPLY_B, GET_ATTRIB_REPLY, - GET_CLAIM_DEF_REPLY_INVALID, GET_CLAIM_DEF_REPLY_A, GET_CLAIM_DEF_REPLY_B, + GET_CLAIM_DEF_REPLY_INVALID, + GET_NYM_REPLY, GET_REVOC_REG_DEF_REPLY_A, GET_REVOC_REG_DEF_REPLY_B, GET_REVOC_REG_DELTA_REPLY_A, GET_REVOC_REG_DELTA_REPLY_B, GET_REVOC_REG_DELTA_REPLY_C, - GET_NYM_REPLY, + GET_REVOC_REG_REPLY_A, + GET_REVOC_REG_REPLY_B, GET_SCHEMA_REPLY_A, GET_SCHEMA_REPLY_B, RAW_HEX_LEAF, diff --git a/aries_cloudagent/ledger/merkel_validation/tests/test_utils.py b/aries_cloudagent/ledger/merkel_validation/tests/test_utils.py index 50ec93f492..eb33886cbc 100644 --- a/aries_cloudagent/ledger/merkel_validation/tests/test_utils.py +++ b/aries_cloudagent/ledger/merkel_validation/tests/test_utils.py @@ -2,7 +2,7 @@ from unittest import TestCase -from ..utils import encode_hex, ascii_chr +from ..utils import ascii_chr, encode_hex class TestUtils(TestCase): diff --git a/aries_cloudagent/ledger/merkel_validation/trie.py b/aries_cloudagent/ledger/merkel_validation/trie.py index 3c4ef18c6b..e89687cda1 100644 --- a/aries_cloudagent/ledger/merkel_validation/trie.py +++ b/aries_cloudagent/ledger/merkel_validation/trie.py @@ -1,28 +1,20 @@ """Validates State Proof.""" import json +from collections import OrderedDict -from collections import ( - OrderedDict, -) -from rlp import ( - encode as rlp_encode, - decode as rlp_decode, - DecodingError, -) -from .utils import ( - sha3_256, - NIBBLE_TERMINATOR, - unpack_to_nibbles, -) +from rlp import DecodingError +from rlp import decode as rlp_decode +from rlp import encode as rlp_encode from .constants import ( + BLANK_NODE, NODE_TYPE_BLANK, - NODE_TYPE_LEAF, - NODE_TYPE_EXTENSION, NODE_TYPE_BRANCH, - BLANK_NODE, + NODE_TYPE_EXTENSION, + NODE_TYPE_LEAF, ) +from .utils import NIBBLE_TERMINATOR, sha3_256, unpack_to_nibbles class SubTrie: diff --git a/aries_cloudagent/ledger/merkel_validation/utils.py b/aries_cloudagent/ledger/merkel_validation/utils.py index 75885bedbf..395f4ce1cd 100644 --- a/aries_cloudagent/ledger/merkel_validation/utils.py +++ b/aries_cloudagent/ledger/merkel_validation/utils.py @@ -1,7 +1,7 @@ """Merkel Validation Utils.""" -from binascii import hexlify import hashlib +from binascii import hexlify hash_function = hashlib.sha256() diff --git a/aries_cloudagent/ledger/multiple_ledger/base_manager.py b/aries_cloudagent/ledger/multiple_ledger/base_manager.py index 69e1f2d26c..61a3e2a490 100644 --- a/aries_cloudagent/ledger/multiple_ledger/base_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/base_manager.py @@ -1,7 +1,7 @@ """Manager for multiple ledger.""" from abc import ABC, abstractmethod -from typing import Optional, Tuple, Mapping, List +from typing import List, Mapping, Optional, Tuple from ...core.error import BaseError from ...core.profile import Profile diff --git a/aries_cloudagent/ledger/multiple_ledger/manager_provider.py b/aries_cloudagent/ledger/multiple_ledger/manager_provider.py index 13a88a79fd..dcb9b67bc2 100644 --- a/aries_cloudagent/ledger/multiple_ledger/manager_provider.py +++ b/aries_cloudagent/ledger/multiple_ledger/manager_provider.py @@ -1,16 +1,14 @@ """Profile manager for multiple Indy ledger support.""" import logging - from collections import OrderedDict from ...cache.base import BaseCache +from ...config.injector import BaseInjector, InjectionError from ...config.provider import BaseProvider from ...config.settings import BaseSettings -from ...config.injector import BaseInjector, InjectionError from ...core.profile import Profile from ...utils.classloader import ClassNotFoundError, DeferLoad - from .base_manager import MultipleLedgerManagerError LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py index 6b1295386b..48bff6f494 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py @@ -1,15 +1,14 @@ from unittest import IsolatedAsyncioTestCase + from aries_cloudagent.tests import mock from ....core.in_memory import InMemoryProfile - from ...base import BaseLedger +from ...indy_vdr import IndyVdrLedger, IndyVdrLedgerPool from ...multiple_ledger.base_manager import ( BaseMultipleLedgerManager, MultipleLedgerManagerError, ) -from ...indy_vdr import IndyVdrLedger, IndyVdrLedgerPool - from ..ledger_requests_executor import IndyLedgerRequestsExecutor diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py index 87d8a66397..10ae154d9a 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py @@ -1,23 +1,21 @@ import asyncio import json +from collections import OrderedDict +from copy import deepcopy +from unittest import IsolatedAsyncioTestCase + import pytest -from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from copy import deepcopy - -from collections import OrderedDict from ....cache.base import BaseCache from ....cache.in_memory import InMemoryCache from ....core.in_memory import InMemoryProfile from ....ledger.base import BaseLedger from ....messaging.responder import BaseResponder - from ...error import LedgerError from ...indy_vdr import IndyVdrLedger, IndyVdrLedgerPool from ...merkel_validation.tests.test_data import GET_NYM_REPLY - from .. import indy_vdr_manager as test_module from ..base_manager import MultipleLedgerManagerError from ..indy_vdr_manager import MultiIndyVDRLedgerManager diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py index 80091cfb01..ffce7c6aa4 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py @@ -1,13 +1,12 @@ -import pytest - from unittest import IsolatedAsyncioTestCase +import pytest + from ....askar.profile import AskarProfileManager from ....config.injection_context import InjectionContext from ....core.in_memory import InMemoryProfile from ....ledger.base import BaseLedger from ....ledger.indy_vdr import IndyVdrLedger, IndyVdrLedgerPool - from ..base_manager import MultipleLedgerManagerError from ..manager_provider import MultiIndyLedgerManagerProvider diff --git a/aries_cloudagent/ledger/tests/test_routes.py b/aries_cloudagent/ledger/tests/test_routes.py index 941c7dd336..38cf897776 100644 --- a/aries_cloudagent/ledger/tests/test_routes.py +++ b/aries_cloudagent/ledger/tests/test_routes.py @@ -7,9 +7,7 @@ from ...core.in_memory import InMemoryProfile from ...ledger.base import BaseLedger from ...ledger.endpoint_type import EndpointType -from ...ledger.multiple_ledger.base_manager import ( - BaseMultipleLedgerManager, -) +from ...ledger.multiple_ledger.base_manager import BaseMultipleLedgerManager from ...ledger.multiple_ledger.ledger_requests_executor import ( IndyLedgerRequestsExecutor, ) diff --git a/aries_cloudagent/ledger/util.py b/aries_cloudagent/ledger/util.py index 165d64a8b4..f934cf9a8d 100644 --- a/aries_cloudagent/ledger/util.py +++ b/aries_cloudagent/ledger/util.py @@ -4,7 +4,6 @@ from ..core.profile import Profile - TAA_ACCEPTED_RECORD_TYPE = "taa_accepted" DID_EVENT_PREFIX = "acapy::REGISTER_DID::" diff --git a/aries_cloudagent/messaging/base_handler.py b/aries_cloudagent/messaging/base_handler.py index cd1181330f..067cf51a09 100644 --- a/aries_cloudagent/messaging/base_handler.py +++ b/aries_cloudagent/messaging/base_handler.py @@ -1,12 +1,11 @@ """A Base handler class for all message handlers.""" -from abc import ABC, abstractmethod import logging +from abc import ABC, abstractmethod from ..core.error import BaseError - -from .responder import BaseResponder from .request_context import RequestContext +from .responder import BaseResponder class HandlerException(BaseError): diff --git a/aries_cloudagent/messaging/base_message.py b/aries_cloudagent/messaging/base_message.py index 0132f3c9c6..91df02cb1f 100644 --- a/aries_cloudagent/messaging/base_message.py +++ b/aries_cloudagent/messaging/base_message.py @@ -2,7 +2,7 @@ from abc import ABC, abstractclassmethod, abstractmethod, abstractproperty from enum import Enum, auto -from typing import Optional, Type, TYPE_CHECKING +from typing import TYPE_CHECKING, Optional, Type if TYPE_CHECKING: from .base_handler import BaseHandler diff --git a/aries_cloudagent/messaging/decorators/base.py b/aries_cloudagent/messaging/decorators/base.py index abebad4a91..0044163190 100644 --- a/aries_cloudagent/messaging/decorators/base.py +++ b/aries_cloudagent/messaging/decorators/base.py @@ -7,7 +7,6 @@ from marshmallow.fields import Field from ...core.error import BaseError - from ..models.base import BaseModel DECORATOR_PREFIX = "~" diff --git a/aries_cloudagent/messaging/decorators/default.py b/aries_cloudagent/messaging/decorators/default.py index bc8c314466..5761fc263b 100644 --- a/aries_cloudagent/messaging/decorators/default.py +++ b/aries_cloudagent/messaging/decorators/default.py @@ -1,14 +1,13 @@ """Default decorator set implementation.""" from .base import BaseDecoratorSet - from .localization_decorator import LocalizationDecorator +from .service_decorator import ServiceDecorator from .signature_decorator import SignatureDecorator from .thread_decorator import ThreadDecorator -from .trace_decorator import TraceDecorator from .timing_decorator import TimingDecorator +from .trace_decorator import TraceDecorator from .transport_decorator import TransportDecorator -from .service_decorator import ServiceDecorator DEFAULT_MODELS = { "l10n": LocalizationDecorator, diff --git a/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py b/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py index 96e2c034af..80e7543270 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py +++ b/aries_cloudagent/messaging/decorators/tests/test_decorator_set.py @@ -3,9 +3,8 @@ from marshmallow import EXCLUDE, fields from ...models.base import BaseModel, BaseModelSchema - from ..base import BaseDecoratorSet -from ..default import DecoratorSet, DEFAULT_MODELS +from ..default import DEFAULT_MODELS, DecoratorSet class SimpleModel(BaseModel): diff --git a/aries_cloudagent/messaging/decorators/tests/test_localization_decorator.py b/aries_cloudagent/messaging/decorators/tests/test_localization_decorator.py index 6140f4e1f4..dc5a981fd5 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_localization_decorator.py +++ b/aries_cloudagent/messaging/decorators/tests/test_localization_decorator.py @@ -1,7 +1,7 @@ -from ..localization_decorator import LocalizationDecorator - from unittest import TestCase +from ..localization_decorator import LocalizationDecorator + class TestThreadDecorator(TestCase): LOCALE = "en-ca" diff --git a/aries_cloudagent/messaging/decorators/tests/test_signature_decorator.py b/aries_cloudagent/messaging/decorators/tests/test_signature_decorator.py index e6028978dc..453edb6d9b 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_signature_decorator.py +++ b/aries_cloudagent/messaging/decorators/tests/test_signature_decorator.py @@ -1,9 +1,9 @@ from unittest import IsolatedAsyncioTestCase -from ....wallet.key_type import ED25519 from ....core.in_memory import InMemoryProfile from ....protocols.trustping.v1_0.messages.ping import Ping from ....wallet.in_memory import InMemoryWallet +from ....wallet.key_type import ED25519 from ..signature_decorator import SignatureDecorator TEST_VERKEY = "3Dn1SJNPaCXcvvJvSbsFWP2xaCjMom3can8CQNhWrTRx" diff --git a/aries_cloudagent/messaging/decorators/tests/test_thread_decorator.py b/aries_cloudagent/messaging/decorators/tests/test_thread_decorator.py index 8ad7be4878..b91e220b18 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_thread_decorator.py +++ b/aries_cloudagent/messaging/decorators/tests/test_thread_decorator.py @@ -1,7 +1,7 @@ -from ..thread_decorator import ThreadDecorator - from unittest import TestCase +from ..thread_decorator import ThreadDecorator + class TestThreadDecorator(TestCase): thread_id = "tid-001" diff --git a/aries_cloudagent/messaging/decorators/tests/test_timing_decorator.py b/aries_cloudagent/messaging/decorators/tests/test_timing_decorator.py index ea4527674f..3b0ee71ad8 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_timing_decorator.py +++ b/aries_cloudagent/messaging/decorators/tests/test_timing_decorator.py @@ -4,7 +4,6 @@ from ...util import datetime_to_str from ..timing_decorator import TimingDecorator - NOW = datetime.now() diff --git a/aries_cloudagent/messaging/decorators/tests/test_trace_decorator.py b/aries_cloudagent/messaging/decorators/tests/test_trace_decorator.py index 51e4fa0a61..85cbd9796b 100644 --- a/aries_cloudagent/messaging/decorators/tests/test_trace_decorator.py +++ b/aries_cloudagent/messaging/decorators/tests/test_trace_decorator.py @@ -1,7 +1,7 @@ -from ..trace_decorator import TraceDecorator, TraceReport, TRACE_MESSAGE_TARGET - from unittest import TestCase +from ..trace_decorator import TRACE_MESSAGE_TARGET, TraceDecorator, TraceReport + class TestTraceDecorator(TestCase): target_api = "http://example.com/api/trace/" diff --git a/aries_cloudagent/messaging/jsonld/credential.py b/aries_cloudagent/messaging/jsonld/credential.py index df8c557583..04151fbe95 100644 --- a/aries_cloudagent/messaging/jsonld/credential.py +++ b/aries_cloudagent/messaging/jsonld/credential.py @@ -7,7 +7,6 @@ from ...wallet.base import BaseWallet from ...wallet.key_type import ED25519 from ...wallet.util import b64_to_bytes, b64_to_str, bytes_to_b64, str_to_b64 - from .create_verify_data import create_verify_data from .error import BadJWSHeaderError diff --git a/aries_cloudagent/messaging/jsonld/tests/document_loader.py b/aries_cloudagent/messaging/jsonld/tests/document_loader.py index 8fb294bda5..cefa103615 100644 --- a/aries_cloudagent/messaging/jsonld/tests/document_loader.py +++ b/aries_cloudagent/messaging/jsonld/tests/document_loader.py @@ -7,7 +7,6 @@ SECURITY_V1, SECURITY_V2, ) - from . import ( TEST_EURO_HEALTH, TEST_SIGN_OBJ0, diff --git a/aries_cloudagent/messaging/jsonld/tests/test_credential.py b/aries_cloudagent/messaging/jsonld/tests/test_credential.py index 46ff019838..14d6e07630 100644 --- a/aries_cloudagent/messaging/jsonld/tests/test_credential.py +++ b/aries_cloudagent/messaging/jsonld/tests/test_credential.py @@ -1,22 +1,17 @@ """Test json-ld credential.""" import json - - -from unittest import mock -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from ....core.in_memory import InMemoryProfile from ....vc.ld_proofs import DocumentLoader from ....wallet.base import BaseWallet from ....wallet.in_memory import InMemoryWallet from ....wallet.key_type import ED25519 - from .. import credential as test_module from ..create_verify_data import DroppedAttributeError from ..credential import did_key, sign_credential, verify_credential from ..error import BadJWSHeaderError, SignatureTypeError - from . import ( TEST_SEED, TEST_SIGN_ERROR_OBJS, diff --git a/aries_cloudagent/messaging/message_type.py b/aries_cloudagent/messaging/message_type.py index 06bbf591cd..aa6d105c4f 100644 --- a/aries_cloudagent/messaging/message_type.py +++ b/aries_cloudagent/messaging/message_type.py @@ -1,8 +1,8 @@ """Utilities for working with Message Types and Versions.""" +import re from dataclasses import dataclass from functools import lru_cache -import re from typing import ClassVar, Pattern, Tuple, Union diff --git a/aries_cloudagent/messaging/models/openapi.py b/aries_cloudagent/messaging/models/openapi.py index 2ddeb140ee..847788dbe9 100644 --- a/aries_cloudagent/messaging/models/openapi.py +++ b/aries_cloudagent/messaging/models/openapi.py @@ -1,6 +1,6 @@ """Base class for OpenAPI artifact schema.""" -from marshmallow import Schema, EXCLUDE +from marshmallow import EXCLUDE, Schema class OpenAPISchema(Schema): diff --git a/aries_cloudagent/messaging/models/tests/test_base.py b/aries_cloudagent/messaging/models/tests/test_base.py index d19b5b1c6b..23599f9fb7 100644 --- a/aries_cloudagent/messaging/models/tests/test_base.py +++ b/aries_cloudagent/messaging/models/tests/test_base.py @@ -1,7 +1,6 @@ -from unittest import mock -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock -from marshmallow import EXCLUDE, INCLUDE, fields, validates_schema, ValidationError +from marshmallow import EXCLUDE, INCLUDE, ValidationError, fields, validates_schema from ..base import BaseModel, BaseModelError, BaseModelSchema diff --git a/aries_cloudagent/messaging/tests/test_agent_message.py b/aries_cloudagent/messaging/tests/test_agent_message.py index d47b632d25..bfb12fe510 100644 --- a/aries_cloudagent/messaging/tests/test_agent_message.py +++ b/aries_cloudagent/messaging/tests/test_agent_message.py @@ -5,10 +5,9 @@ from ...core.in_memory import InMemoryProfile from ...protocols.didcomm_prefix import DIDCommPrefix from ...wallet.key_type import ED25519 - from ..agent_message import AgentMessage, AgentMessageSchema from ..decorators.signature_decorator import SignatureDecorator -from ..decorators.trace_decorator import TraceReport, TRACE_LOG_TARGET +from ..decorators.trace_decorator import TRACE_LOG_TARGET, TraceReport from ..models.base import BaseModelError diff --git a/aries_cloudagent/messaging/util.py b/aries_cloudagent/messaging/util.py index ac2feb5cae..8318b15018 100644 --- a/aries_cloudagent/messaging/util.py +++ b/aries_cloudagent/messaging/util.py @@ -2,13 +2,11 @@ import logging import re - from datetime import datetime, timedelta, timezone from hashlib import sha256 from math import floor from typing import Any, Dict, List, Union - LOGGER = logging.getLogger(__name__) I32_BOUND = 2**31 diff --git a/aries_cloudagent/messaging/valid.py b/aries_cloudagent/messaging/valid.py index 0f6ed4c27c..894c1a819b 100644 --- a/aries_cloudagent/messaging/valid.py +++ b/aries_cloudagent/messaging/valid.py @@ -4,7 +4,6 @@ import re from base58 import alphabet - from marshmallow.exceptions import ValidationError from marshmallow.fields import Field from marshmallow.validate import OneOf, Range, Regexp, Validator diff --git a/aries_cloudagent/multitenant/route_manager.py b/aries_cloudagent/multitenant/route_manager.py index ac8530a741..9369f34eb9 100644 --- a/aries_cloudagent/multitenant/route_manager.py +++ b/aries_cloudagent/multitenant/route_manager.py @@ -24,7 +24,6 @@ from ..storage.error import StorageNotFoundError from .base import BaseMultitenantManager - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/multitenant/single_wallet_askar_manager.py b/aries_cloudagent/multitenant/single_wallet_askar_manager.py index 1744adfb09..aeb513403f 100644 --- a/aries_cloudagent/multitenant/single_wallet_askar_manager.py +++ b/aries_cloudagent/multitenant/single_wallet_askar_manager.py @@ -6,9 +6,7 @@ from ..askar.profile_anon import AskarAnoncredsProfile from ..config.injection_context import InjectionContext from ..config.wallet import wallet_config -from ..core.profile import ( - Profile, -) +from ..core.profile import Profile from ..wallet.models.wallet_record import WalletRecord from .base import BaseMultitenantManager diff --git a/aries_cloudagent/multitenant/tests/test_base.py b/aries_cloudagent/multitenant/tests/test_base.py index 35b3ca8267..9ee093afec 100644 --- a/aries_cloudagent/multitenant/tests/test_base.py +++ b/aries_cloudagent/multitenant/tests/test_base.py @@ -1,10 +1,10 @@ from datetime import datetime, timezone - from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock + import jwt -from .. import base as test_module +from aries_cloudagent.tests import mock + from ...config.base import InjectionError from ...core.in_memory import InMemoryProfile from ...messaging.responder import BaseResponder @@ -21,6 +21,7 @@ from ...wallet.in_memory import InMemoryWallet from ...wallet.key_type import ED25519 from ...wallet.models.wallet_record import WalletRecord +from .. import base as test_module from ..base import BaseMultitenantManager, MultitenantManagerError from ..error import WalletKeyMissingError diff --git a/aries_cloudagent/multitenant/tests/test_cache.py b/aries_cloudagent/multitenant/tests/test_cache.py index ad364371ef..795419e22a 100644 --- a/aries_cloudagent/multitenant/tests/test_cache.py +++ b/aries_cloudagent/multitenant/tests/test_cache.py @@ -1,5 +1,4 @@ from ...core.profile import Profile - from ..cache import ProfileCache diff --git a/aries_cloudagent/multitenant/tests/test_manager.py b/aries_cloudagent/multitenant/tests/test_manager.py index 8c129adde9..00f746cedc 100644 --- a/aries_cloudagent/multitenant/tests/test_manager.py +++ b/aries_cloudagent/multitenant/tests/test_manager.py @@ -1,4 +1,5 @@ from unittest import IsolatedAsyncioTestCase + from aries_cloudagent.tests import mock from ...core.in_memory import InMemoryProfile diff --git a/aries_cloudagent/multitenant/tests/test_route_manager.py b/aries_cloudagent/multitenant/tests/test_route_manager.py index 771b4a81fd..21f0d90916 100644 --- a/aries_cloudagent/multitenant/tests/test_route_manager.py +++ b/aries_cloudagent/multitenant/tests/test_route_manager.py @@ -1,6 +1,7 @@ -from aries_cloudagent.tests import mock import pytest +from aries_cloudagent.tests import mock + from ...core.in_memory import InMemoryProfile from ...core.profile import Profile from ...messaging.responder import BaseResponder, MockResponder diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/base_service.py b/aries_cloudagent/protocols/actionmenu/v1_0/base_service.py index 4b0f2e19d9..ab9d3a1867 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/base_service.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/base_service.py @@ -6,7 +6,6 @@ from ....connections.models.conn_record import ConnRecord from ....core.profile import Profile from ....messaging.agent_message import AgentMessage - from .messages.menu import Menu diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/controller.py b/aries_cloudagent/protocols/actionmenu/v1_0/controller.py index 74e1e9164b..8bc9b3a147 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/controller.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/controller.py @@ -3,7 +3,6 @@ from typing import Sequence from ....config.injection_context import InjectionContext - from .base_service import BaseMenuService diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/driver_service.py b/aries_cloudagent/protocols/actionmenu/v1_0/driver_service.py index 3133f8135c..21b36fba69 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/driver_service.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/driver_service.py @@ -5,7 +5,6 @@ from ....connections.models.conn_record import ConnRecord from ....core.profile import Profile from ....messaging.agent_message import AgentMessage - from .base_service import BaseMenuService from .messages.menu import Menu diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/messages/menu_request.py b/aries_cloudagent/protocols/actionmenu/v1_0/messages/menu_request.py index 9aa81676d4..33b8c362ba 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/messages/menu_request.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/messages/menu_request.py @@ -3,7 +3,6 @@ from marshmallow import EXCLUDE from .....messaging.agent_message import AgentMessage, AgentMessageSchema - from ..message_types import MENU_REQUEST, PROTOCOL_PACKAGE HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.menu_request_handler.MenuRequestHandler" diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu.py b/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu.py index 50e6fc4f0d..1474cf6760 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu.py @@ -1,13 +1,10 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - +from ...message_types import MENU, PROTOCOL_PACKAGE from ...models.menu_form import MenuForm from ...models.menu_form_param import MenuFormParam from ...models.menu_option import MenuOption -from ...message_types import MENU, PROTOCOL_PACKAGE - from ..menu import Menu diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu_request.py b/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu_request.py index f79d2119b4..d8b22dfa6e 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu_request.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_menu_request.py @@ -1,10 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import MENU_REQUEST, PROTOCOL_PACKAGE - from ..menu_request import MenuRequest diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_perform.py b/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_perform.py index 6268229faf..39df919b9f 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_perform.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/messages/tests/test_perform.py @@ -1,10 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import PERFORM, PROTOCOL_PACKAGE - from ..perform import Perform diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_controller.py b/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_controller.py index 46072e2f3e..dc43675764 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_controller.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_controller.py @@ -1,4 +1,5 @@ from unittest import IsolatedAsyncioTestCase + from aries_cloudagent.tests import mock from .....core.in_memory import InMemoryProfile diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_service.py b/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_service.py index af20c24af4..f2bf2896db 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_service.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_service.py @@ -1,10 +1,8 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock from .....core.event_bus import EventBus, MockEventBus from .....core.in_memory import InMemoryProfile from .....messaging.request_context import RequestContext - from .. import driver_service as test_module diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_util.py b/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_util.py index 68ecfbcc53..fe5c2addc4 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_util.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/tests/test_util.py @@ -1,11 +1,10 @@ from unittest import IsolatedAsyncioTestCase -from .....core.event_bus import EventBus, MockEventBus from .....admin.request_context import AdminRequestContext - +from .....core.event_bus import EventBus, MockEventBus from .. import util as test_module -from ..models.menu_form_param import MenuFormParam from ..models.menu_form import MenuForm +from ..models.menu_form_param import MenuFormParam from ..models.menu_option import MenuOption diff --git a/aries_cloudagent/protocols/actionmenu/v1_0/util.py b/aries_cloudagent/protocols/actionmenu/v1_0/util.py index 2ea08d1b27..750eb032e7 100644 --- a/aries_cloudagent/protocols/actionmenu/v1_0/util.py +++ b/aries_cloudagent/protocols/actionmenu/v1_0/util.py @@ -1,12 +1,7 @@ """Action menu utility methods.""" from ....admin.request_context import AdminRequestContext -from ....storage.base import ( - BaseStorage, - StorageRecord, - StorageNotFoundError, -) - +from ....storage.base import BaseStorage, StorageNotFoundError, StorageRecord from .messages.menu import Menu MENU_RECORD_TYPE = "connection_action_menu" diff --git a/aries_cloudagent/protocols/basicmessage/v1_0/handlers/tests/test_basicmessage_handler.py b/aries_cloudagent/protocols/basicmessage/v1_0/handlers/tests/test_basicmessage_handler.py index 0f70218901..dca8ef7a03 100644 --- a/aries_cloudagent/protocols/basicmessage/v1_0/handlers/tests/test_basicmessage_handler.py +++ b/aries_cloudagent/protocols/basicmessage/v1_0/handlers/tests/test_basicmessage_handler.py @@ -2,7 +2,7 @@ import pytest -from ......core.event_bus import EventBus, MockEventBus, Event +from ......core.event_bus import Event, EventBus, MockEventBus from ......messaging.decorators.localization_decorator import LocalizationDecorator from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder diff --git a/aries_cloudagent/protocols/basicmessage/v1_0/messages/tests/test_basic_message.py b/aries_cloudagent/protocols/basicmessage/v1_0/messages/tests/test_basic_message.py index bb0fcf6f2e..293c8f3f3a 100644 --- a/aries_cloudagent/protocols/basicmessage/v1_0/messages/tests/test_basic_message.py +++ b/aries_cloudagent/protocols/basicmessage/v1_0/messages/tests/test_basic_message.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import BASIC_MESSAGE, PROTOCOL_PACKAGE - from ..basicmessage import BasicMessage diff --git a/aries_cloudagent/protocols/connections/v1_0/handlers/connection_invitation_handler.py b/aries_cloudagent/protocols/connections/v1_0/handlers/connection_invitation_handler.py index 3c9dde344d..124e9130e3 100644 --- a/aries_cloudagent/protocols/connections/v1_0/handlers/connection_invitation_handler.py +++ b/aries_cloudagent/protocols/connections/v1_0/handlers/connection_invitation_handler.py @@ -1,10 +1,6 @@ """Connect invitation handler.""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ..messages.connection_invitation import ConnectionInvitation from ..messages.problem_report import ConnectionProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/connections/v1_0/handlers/connection_response_handler.py b/aries_cloudagent/protocols/connections/v1_0/handlers/connection_response_handler.py index d9556d8f67..61fd814362 100644 --- a/aries_cloudagent/protocols/connections/v1_0/handlers/connection_response_handler.py +++ b/aries_cloudagent/protocols/connections/v1_0/handlers/connection_response_handler.py @@ -1,10 +1,6 @@ """Connection response handler.""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from .....protocols.trustping.v1_0.messages.ping import Ping from ..manager import ConnectionManager, ConnectionManagerError from ..messages.connection_response import ConnectionResponse diff --git a/aries_cloudagent/protocols/connections/v1_0/handlers/tests/test_response_handler.py b/aries_cloudagent/protocols/connections/v1_0/handlers/tests/test_response_handler.py index 56349e0ef2..7873613129 100644 --- a/aries_cloudagent/protocols/connections/v1_0/handlers/tests/test_response_handler.py +++ b/aries_cloudagent/protocols/connections/v1_0/handlers/tests/test_response_handler.py @@ -3,12 +3,7 @@ from aries_cloudagent.tests import mock from ......connections.models import connection_target -from ......connections.models.diddoc import ( - DIDDoc, - PublicKey, - PublicKeyType, - Service, -) +from ......connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......protocols.trustping.v1_0.messages.ping import Ping diff --git a/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_invitation.py b/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_invitation.py index f325f34c71..a957e81de5 100644 --- a/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_invitation.py +++ b/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_invitation.py @@ -1,10 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CONNECTION_INVITATION from ..connection_invitation import ConnectionInvitation diff --git a/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_request.py b/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_request.py index f6f20a6d83..d120e769ea 100644 --- a/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_request.py +++ b/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_request.py @@ -1,20 +1,9 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase - -from ......connections.models.diddoc import ( - DIDDoc, - PublicKey, - PublicKeyType, - Service, -) +from unittest import IsolatedAsyncioTestCase, TestCase, mock +from ......connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CONNECTION_REQUEST from ...models.connection_detail import ConnectionDetail - from ..connection_request import ConnectionRequest diff --git a/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_response.py b/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_response.py index 2a3858044a..1b1af0442b 100644 --- a/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_response.py +++ b/aries_cloudagent/protocols/connections/v1_0/messages/tests/test_connection_response.py @@ -1,21 +1,11 @@ -from unittest import mock -from unittest import TestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock -from unittest import IsolatedAsyncioTestCase - -from ......wallet.key_type import ED25519 -from ......connections.models.diddoc import ( - DIDDoc, - PublicKey, - PublicKeyType, - Service, -) +from ......connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from ......core.in_memory import InMemoryProfile - +from ......wallet.key_type import ED25519 from .....didcomm_prefix import DIDCommPrefix from ...message_types import CONNECTION_RESPONSE from ...models.connection_detail import ConnectionDetail - from ..connection_response import ConnectionResponse diff --git a/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py index 6d6e57ae93..746f638311 100644 --- a/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py @@ -1,6 +1,7 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from .....cache.base import BaseCache from .....cache.in_memory import InMemoryCache from .....connections.models.conn_record import ConnRecord @@ -15,7 +16,7 @@ from .....storage.error import StorageNotFoundError from .....transport.inbound.receipt import MessageReceipt from .....wallet.base import DIDInfo -from .....wallet.did_method import DIDMethods, SOV +from .....wallet.did_method import SOV, DIDMethods from .....wallet.in_memory import InMemoryWallet from .....wallet.key_type import ED25519 from ....coordinate_mediation.v1_0.manager import MediationManager 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 006ec0acc0..a276de53b1 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 @@ -6,11 +6,9 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageNotFoundError - from ..messages.keylist import Keylist from ..models.mediation_record import MediationRecord - LOG = logging.getLogger(__name__) diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_query_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_query_handler.py index 6a18d06854..afa541ebb0 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_query_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_query_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageNotFoundError - from ..manager import MediationManager, MediationNotGrantedError from ..messages.keylist_query import KeylistQuery from ..messages.problem_report import CMProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_update_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_update_handler.py index d31cd0e9f9..726529bb98 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_update_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_update_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageNotFoundError - from ..manager import MediationManager, MediationNotGrantedError from ..messages.keylist_update import KeylistUpdate from ..messages.problem_report import CMProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_deny_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_deny_handler.py index 3e2ad0416c..ec9e6b1389 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_deny_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_deny_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageNotFoundError - from ..manager import MediationManager from ..messages.mediate_deny import MediationDeny from ..models.mediation_record import MediationRecord diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_grant_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_grant_handler.py index d82a406373..89505d67c7 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_grant_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_grant_handler.py @@ -5,7 +5,6 @@ from .....messaging.responder import BaseResponder from .....multitenant.base import BaseMultitenantManager from .....storage.error import StorageNotFoundError - from ..manager import MediationManager from ..messages.mediate_grant import MediationGrant from ..models.mediation_record import MediationRecord diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_request_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_request_handler.py index d6c2cd26aa..8644e39ba8 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_request_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/mediation_request_handler.py @@ -3,8 +3,7 @@ from .....messaging.base_handler import BaseHandler, HandlerException from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder - -from ..manager import MediationManager, MediationAlreadyExists +from ..manager import MediationAlreadyExists, MediationManager from ..messages.mediate_request import MediationRequest from ..messages.problem_report import CMProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/problem_report_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/problem_report_handler.py index f6ae021b80..ccf020ec6f 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/problem_report_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/problem_report_handler.py @@ -3,7 +3,6 @@ from .....messaging.base_handler import BaseHandler from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder - from ..messages.problem_report import CMProblemReport 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 0719514cbc..635815a16c 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,6 +1,7 @@ """Test keylist handler.""" import logging + import pytest from ......connections.models.conn_record import ConnRecord @@ -11,7 +12,6 @@ from ...models.mediation_record import MediationRecord from ..keylist_handler import KeylistHandler - TEST_CONN_ID = "conn-id" pytestmark = pytest.mark.asyncio 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 08cd0c0f99..1cbb3f10b9 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,19 +1,18 @@ """Test handler for keylist-query message.""" -import pytest from unittest import IsolatedAsyncioTestCase +import pytest + from ......connections.models.conn_record import ConnRecord from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from .....routing.v1_0.models.route_record import RouteRecord - from ...messages.keylist import Keylist from ...messages.keylist_query import KeylistQuery from ...messages.problem_report import CMProblemReport, ProblemReportReason from ...models.mediation_record import MediationRecord - from ..keylist_query_handler import KeylistQueryHandler TEST_CONN_ID = "conn-id" 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 45b90546a8..7df4c10479 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,19 +1,18 @@ """Test handler for keylist-update message.""" -import pytest from unittest import IsolatedAsyncioTestCase +import pytest + from ......connections.models.conn_record import ConnRecord from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder - from ...messages.inner.keylist_update_rule import KeylistUpdateRule from ...messages.keylist_update import KeylistUpdate from ...messages.keylist_update_response import KeylistUpdateResponse from ...messages.problem_report import CMProblemReport from ...models.mediation_record import MediationRecord - from ..keylist_update_handler import KeylistUpdateHandler TEST_CONN_ID = "conn-id" diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_response_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_response_handler.py index 734ad7177d..cf4d69b0e7 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_response_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_keylist_update_response_handler.py @@ -2,20 +2,19 @@ from functools import partial from typing import AsyncGenerator -import pytest -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock +import pytest from ......connections.models.conn_record import ConnRecord from ......core.event_bus import EventBus, MockEventBus from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder +from ...manager import MediationManager from ...messages.inner.keylist_update_rule import KeylistUpdateRule from ...messages.inner.keylist_updated import KeylistUpdated from ...messages.keylist_update_response import KeylistUpdateResponse -from ...manager import MediationManager from ...route_manager import RouteManager from ...tests.test_route_manager import MockRouteManager from ..keylist_update_response_handler import KeylistUpdateResponseHandler 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 b967e58536..6050bd6a33 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,8 +1,9 @@ """Test mediate deny message handler.""" -import pytest from unittest import IsolatedAsyncioTestCase +import pytest + from ......connections.models.conn_record import ConnRecord from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_grant_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_grant_handler.py index 5234713869..4813897ccf 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_grant_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_grant_handler.py @@ -1,22 +1,20 @@ """Test mediate grant message handler.""" import pytest -from aries_cloudagent.tests import mock from aries_cloudagent.core.profile import ProfileSession +from aries_cloudagent.tests import mock from ......connections.models.conn_record import ConnRecord from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......multitenant.base import BaseMultitenantManager - +from ...manager import MediationManager from ...messages.mediate_grant import MediationGrant from ...models.mediation_record import MediationRecord -from ...manager import MediationManager - -from ..mediation_grant_handler import MediationGrantHandler from .. import mediation_grant_handler as test_module +from ..mediation_grant_handler import MediationGrantHandler TEST_CONN_ID = "conn-id" TEST_BASE58_VERKEY = "3Dn1SJNPaCXcvvJvSbsFWP2xaCjMom3can8CQNhWrTRx" 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 76f6918a36..ac1e2ff53e 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,20 +1,19 @@ """Test mediate request message handler.""" -import pytest from unittest import IsolatedAsyncioTestCase +import pytest + from ......connections.models.conn_record import ConnRecord from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder - +from ......wallet.did_method import DIDMethods from ...messages.mediate_grant import MediationGrant from ...messages.mediate_request import MediationRequest from ...messages.problem_report import CMProblemReport from ...models.mediation_record import MediationRecord - from ..mediation_request_handler import MediationRequestHandler -from ......wallet.did_method import DIDMethods TEST_CONN_ID = "conn-id" TEST_VERKEY = "3Dn1SJNPaCXcvvJvSbsFWP2xaCjMom3can8CQNhWrTRx" 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 46eef13944..126747ec23 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 @@ -2,13 +2,11 @@ import pytest - from ......connections.models.conn_record import ConnRecord from ......core.profile import ProfileSession from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import problem_report_handler as test_module from ...messages.problem_report import CMProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py index fa8ee6ff9a..675c027e32 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py @@ -27,10 +27,7 @@ from .messages.mediate_grant import MediationGrant from .messages.mediate_request import MediationRequest from .models.mediation_record import MediationRecord -from .normalization import ( - normalize_from_did_key, - normalize_to_did_key, -) +from .normalization import normalize_from_did_key, normalize_to_did_key LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/problem_report.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/problem_report.py index 6a63c79b86..f264b26e99 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/problem_report.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/problem_report.py @@ -1,13 +1,11 @@ """Represents a coordinate-mediation problem report message.""" import logging - from enum import Enum from marshmallow import EXCLUDE, ValidationError, validates_schema from ....problem_report.v1_0.message import ProblemReport, ProblemReportSchema - from ..message_types import PROBLEM_REPORT, PROTOCOL_PACKAGE HANDLER_CLASS = ( 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 526f748390..41aefe3435 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,12 +1,11 @@ """Test Problem Report Message.""" -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from ......messaging.models.base import BaseModelError - +from .. import problem_report as test_module from ..problem_report import ( CMProblemReport, CMProblemReportSchema, @@ -14,8 +13,6 @@ ValidationError, ) -from .. import problem_report as test_module - class TestCMProblemReportMessage(TestCase): """Test problem report.""" diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py index a1b2abe751..245b55dacc 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/normalization.py @@ -1,6 +1,7 @@ """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 d148be1780..d8e4067aaa 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/route_manager.py @@ -3,8 +3,8 @@ Set up routing for newly formed connections. """ -from abc import ABC, abstractmethod import logging +from abc import ABC, abstractmethod from typing import List, NamedTuple, Optional from ....connections.models.conn_record import ConnRecord @@ -19,11 +19,7 @@ from .manager import MediationManager from .messages.keylist_update import KeylistUpdate from .models.mediation_record import MediationRecord -from .normalization import ( - normalize_from_did_key, - normalize_to_did_key, -) - +from .normalization import normalize_from_did_key, normalize_to_did_key LOGGER = logging.getLogger(__name__) 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 e99c01c0b3..89368d3135 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 @@ -4,8 +4,8 @@ from ....core.profile import Profile from ....multitenant.base import BaseMultitenantManager from ....multitenant.route_manager import ( - MultitenantRouteManager, BaseWalletRouteManager, + MultitenantRouteManager, ) from .route_manager import CoordinateMediationV1RouteManager diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_invite_store.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_invite_store.py index 03b0e1cdda..ea25170646 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_invite_store.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_invite_store.py @@ -1,10 +1,8 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import TestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, TestCase, mock from aries_cloudagent.protocols.coordinate_mediation.mediation_invite_store import ( - MediationInviteStore, MediationInviteRecord, + MediationInviteStore, NoDefaultMediationInviteException, ) from aries_cloudagent.storage.base import BaseStorage 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 59b299b47e..3397593936 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,17 +1,19 @@ """Test MediationManager.""" +from typing import AsyncIterable, Iterable + import pytest from aries_cloudagent.tests import mock -from typing import AsyncIterable, Iterable -from .. import manager as test_module from .....core.event_bus import EventBus, MockEventBus from .....core.in_memory import InMemoryProfile from .....core.profile import Profile, ProfileSession from .....did.did_key import DIDKey from .....storage.error import StorageNotFoundError +from .....wallet.did_method import DIDMethods from ....routing.v1_0.models.route_record import RouteRecord +from .. import manager as test_module from ..manager import ( MediationAlreadyExists, MediationManager, @@ -24,7 +26,6 @@ from ..messages.mediate_grant import MediationGrant from ..messages.mediate_request import MediationRequest from ..models.mediation_record import MediationRecord -from .....wallet.did_method import DIDMethods TEST_CONN_ID = "conn-id" TEST_THREAD_ID = "thread-id" diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_route_manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_route_manager.py index c065753245..be462c511c 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_route_manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_route_manager.py @@ -1,12 +1,13 @@ -from aries_cloudagent.tests import mock import pytest +from aries_cloudagent.tests import mock + from .....connections.models.conn_record import ConnRecord from .....core.in_memory import InMemoryProfile -from .....wallet.base import BaseWallet from .....core.profile import Profile from .....messaging.responder import BaseResponder, MockResponder from .....storage.error import StorageNotFoundError +from .....wallet.base import BaseWallet from .....wallet.did_info import DIDInfo from .....wallet.did_method import SOV from .....wallet.in_memory import InMemoryWallet diff --git a/aries_cloudagent/protocols/did_rotate/v1_0/messages/__init__.py b/aries_cloudagent/protocols/did_rotate/v1_0/messages/__init__.py index a9ede8f62f..fbfbf14d2d 100644 --- a/aries_cloudagent/protocols/did_rotate/v1_0/messages/__init__.py +++ b/aries_cloudagent/protocols/did_rotate/v1_0/messages/__init__.py @@ -1,6 +1,6 @@ -from .rotate import Rotate from .ack import RotateAck -from .problem_report import RotateProblemReport from .hangup import Hangup +from .problem_report import RotateProblemReport +from .rotate import Rotate __all__ = ["Rotate", "RotateAck", "RotateProblemReport", "Hangup"] diff --git a/aries_cloudagent/protocols/did_rotate/v1_0/messages/rotate.py b/aries_cloudagent/protocols/did_rotate/v1_0/messages/rotate.py index 3fc3a121fd..3a0c886a9e 100644 --- a/aries_cloudagent/protocols/did_rotate/v1_0/messages/rotate.py +++ b/aries_cloudagent/protocols/did_rotate/v1_0/messages/rotate.py @@ -3,7 +3,7 @@ from marshmallow import EXCLUDE, fields from .....messaging.agent_message import AgentMessage, AgentMessageSchema -from ..message_types import ROTATE, PROTOCOL_PACKAGE +from ..message_types import PROTOCOL_PACKAGE, ROTATE HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.rotate_handler.RotateHandler" diff --git a/aries_cloudagent/protocols/did_rotate/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/did_rotate/v1_0/tests/test_manager.py index 471d712f2f..f405d089e5 100644 --- a/aries_cloudagent/protocols/did_rotate/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/did_rotate/v1_0/tests/test_manager.py @@ -1,8 +1,6 @@ from unittest import IsolatedAsyncioTestCase -from .....connections.base_manager import ( - BaseConnectionManager, -) +from .....connections.base_manager import BaseConnectionManager from .....core.in_memory.profile import InMemoryProfile from .....messaging.responder import BaseResponder, MockResponder from .....protocols.coordinate_mediation.v1_0.route_manager import RouteManager @@ -12,9 +10,7 @@ UnrecordableKeysError, ) from .....protocols.did_rotate.v1_0.messages.ack import RotateAck -from .....protocols.did_rotate.v1_0.messages.problem_report import ( - RotateProblemReport, -) +from .....protocols.did_rotate.v1_0.messages.problem_report import RotateProblemReport from .....protocols.did_rotate.v1_0.messages.rotate import Rotate from .....protocols.did_rotate.v1_0.models.rotate_record import RotateRecord from .....protocols.didcomm_prefix import DIDCommPrefix diff --git a/aries_cloudagent/protocols/didcomm_prefix.py b/aries_cloudagent/protocols/didcomm_prefix.py index dcd30076e5..ee5475fec9 100644 --- a/aries_cloudagent/protocols/didcomm_prefix.py +++ b/aries_cloudagent/protocols/didcomm_prefix.py @@ -1,7 +1,6 @@ """DIDComm prefix management.""" import re - from enum import Enum QUALIFIED = re.compile(r"^[a-zA-Z\-\+]+:.+") diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/complete_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/complete_handler.py index 72122aa62f..800a675fbb 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/complete_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/complete_handler.py @@ -1,11 +1,6 @@ """Connection complete handler under RFC 23 (DID exchange).""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) - +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ..manager import DIDXManager, DIDXManagerError from ..messages.complete import DIDXComplete diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/invitation_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/invitation_handler.py index 6b95209006..3bc1d9d5ee 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/invitation_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/invitation_handler.py @@ -1,10 +1,6 @@ """Connect invitation handler under RFC 23 (DID exchange).""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ....out_of_band.v1_0.messages.invitation import InvitationMessage from ..messages.problem_report import DIDXProblemReport, ProblemReportReason 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 9ecedf58a5..1a4b4bc9ad 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/response_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/response_handler.py @@ -1,10 +1,6 @@ """DID exchange response handler under RFC 23.""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ....trustping.v1_0.messages.ping import Ping from ..manager import DIDXManager, DIDXManagerError from ..messages.response import DIDXResponse diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_complete_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_complete_handler.py index 55971a2fda..e9edb870a0 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_complete_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_complete_handler.py @@ -1,16 +1,15 @@ import pytest + from aries_cloudagent.tests import mock from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - +from ......wallet.did_method import DIDMethods from ...manager import DIDXManagerError from ...messages.complete import DIDXComplete from ...messages.problem_report import ProblemReportReason - from .. import complete_handler as test_module -from ......wallet.did_method import DIDMethods @pytest.fixture() diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_invitation_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_invitation_handler.py index 77013f4fb7..97da2ba82f 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_invitation_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_invitation_handler.py @@ -3,12 +3,10 @@ from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - +from ......wallet.did_method import DIDMethods from .....out_of_band.v1_0.messages.invitation import InvitationMessage - from ...handlers.invitation_handler import InvitationHandler from ...messages.problem_report import DIDXProblemReport, ProblemReportReason -from ......wallet.did_method import DIDMethods @pytest.fixture() diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_problem_report_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_problem_report_handler.py index 72382fefe1..3e4280a313 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_problem_report_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_problem_report_handler.py @@ -1,12 +1,13 @@ -from aries_cloudagent.tests import mock import pytest -from .. import problem_report_handler as test_module +from aries_cloudagent.tests import mock + from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ...manager import DIDXManagerError from ...messages.problem_report import DIDXProblemReport +from .. import problem_report_handler as test_module @pytest.fixture() diff --git a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py index 87369fbaf2..db201a326c 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py @@ -5,12 +5,7 @@ from aries_cloudagent.tests import mock from ......connections.models import connection_target -from ......connections.models.diddoc import ( - DIDDoc, - PublicKey, - PublicKeyType, - Service, -) +from ......connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from ......messaging.decorators.attach_decorator import AttachDecorator from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder diff --git a/aries_cloudagent/protocols/didexchange/v1_0/messages/complete.py b/aries_cloudagent/protocols/didexchange/v1_0/messages/complete.py index bc70a3a736..d8c88ef7a3 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/messages/complete.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/messages/complete.py @@ -1,9 +1,8 @@ """Represents a DID exchange complete message under RFC 23.""" -from marshmallow import EXCLUDE, pre_dump, ValidationError +from marshmallow import EXCLUDE, ValidationError, pre_dump from .....messaging.agent_message import AgentMessage, AgentMessageSchema - from ..message_types import DIDX_COMPLETE, PROTOCOL_PACKAGE HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.complete_handler.DIDXCompleteHandler" diff --git a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_complete.py b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_complete.py index 4b03156be1..0a549a8b6c 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_complete.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_complete.py @@ -1,9 +1,7 @@ from unittest import TestCase from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import DIDX_COMPLETE from ..complete import DIDXComplete diff --git a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_problem_report.py b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_problem_report.py index 1d8d0eba59..9e7843a9ef 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_problem_report.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_problem_report.py @@ -1,13 +1,12 @@ -import pytest - from unittest import mock +import pytest + from ......messaging.models.base import BaseModelError from .....didcomm_prefix import DIDCommPrefix from ...message_types import PROBLEM_REPORT -from ..problem_report import DIDXProblemReport - from .. import problem_report as test_module +from ..problem_report import DIDXProblemReport THID = "dummy-thid" PTHID = "dummy-pthid" diff --git a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_request.py b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_request.py index 835b7afcb3..48ab8736c6 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_request.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_request.py @@ -1,6 +1,4 @@ -from unittest import mock - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from ......connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from ......core.in_memory import InMemoryProfile diff --git a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_response.py b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_response.py index 45fe24dba6..fe7cc5b431 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_response.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/messages/tests/test_response.py @@ -1,6 +1,4 @@ -from unittest import mock - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from ......connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from ......core.in_memory import InMemoryProfile diff --git a/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py index d02235f9f0..0ded6e3db4 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py @@ -5,7 +5,6 @@ from aries_cloudagent.tests import mock -from .. import manager as test_module from .....admin.server import AdminResponder from .....cache.base import BaseCache from .....cache.in_memory import InMemoryCache @@ -24,7 +23,7 @@ from .....storage.error import StorageNotFoundError from .....transport.inbound.receipt import MessageReceipt from .....wallet.did_info import DIDInfo -from .....wallet.did_method import DIDMethods, PEER2, PEER4, SOV +from .....wallet.did_method import PEER2, PEER4, SOV, DIDMethods from .....wallet.error import WalletError from .....wallet.in_memory import InMemoryWallet from .....wallet.key_type import ED25519 @@ -36,6 +35,7 @@ from ....out_of_band.v1_0.manager import OutOfBandManager from ....out_of_band.v1_0.messages.invitation import HSProto, InvitationMessage from ....out_of_band.v1_0.messages.service import Service as OOBService +from .. import manager as test_module from ..manager import DIDXManager, DIDXManagerError from ..message_types import DIDEX_1_0, DIDEX_1_1 from ..messages.problem_report import DIDXProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/discovery/v1_0/handlers/tests/test_disclose_handler.py b/aries_cloudagent/protocols/discovery/v1_0/handlers/tests/test_disclose_handler.py index 59d46f043b..571d3de64d 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/handlers/tests/test_disclose_handler.py +++ b/aries_cloudagent/protocols/discovery/v1_0/handlers/tests/test_disclose_handler.py @@ -6,9 +6,7 @@ from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder - from .....didcomm_prefix import DIDCommPrefix - from ...handlers.disclose_handler import DiscloseHandler from ...messages.disclose import Disclose from ...messages.query import Query diff --git a/aries_cloudagent/protocols/discovery/v1_0/manager.py b/aries_cloudagent/protocols/discovery/v1_0/manager.py index 556c970bdd..cb0edabdd6 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/manager.py +++ b/aries_cloudagent/protocols/discovery/v1_0/manager.py @@ -2,15 +2,13 @@ import asyncio import logging - from typing import Optional from ....core.error import BaseError from ....core.profile import Profile from ....core.protocol_registry import ProtocolRegistry -from ....storage.error import StorageNotFoundError from ....messaging.responder import BaseResponder - +from ....storage.error import StorageNotFoundError from .messages.disclose import Disclose from .messages.query import Query from .models.discovery_record import V10DiscoveryExchangeRecord as DiscRecord diff --git a/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_disclose.py b/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_disclose.py index 5c33b88bf2..0411cfb3dc 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_disclose.py +++ b/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_disclose.py @@ -1,8 +1,6 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import DISCLOSE, PROTOCOL_PACKAGE from ..disclose import Disclose diff --git a/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_query.py b/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_query.py index c691f6a65f..08c7be4633 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_query.py +++ b/aries_cloudagent/protocols/discovery/v1_0/messages/tests/test_query.py @@ -1,9 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - -from ...message_types import QUERY, PROTOCOL_PACKAGE +from ...message_types import PROTOCOL_PACKAGE, QUERY from ..query import Query diff --git a/aries_cloudagent/protocols/discovery/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/discovery/v1_0/tests/test_manager.py index b4fa3071b3..c30430cf54 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/discovery/v1_0/tests/test_manager.py @@ -1,14 +1,13 @@ +from unittest import IsolatedAsyncioTestCase + import pytest from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from .....core.in_memory import InMemoryProfile -from .....storage.error import StorageNotFoundError from .....messaging.responder import BaseResponder, MockResponder - +from .....storage.error import StorageNotFoundError from ....didcomm_prefix import DIDCommPrefix - from ..manager import V10DiscoveryMgr from ..messages.disclose import Disclose from ..messages.query import Query diff --git a/aries_cloudagent/protocols/discovery/v2_0/handlers/tests/test_disclosures_handler.py b/aries_cloudagent/protocols/discovery/v2_0/handlers/tests/test_disclosures_handler.py index 82d3cf0318..1b8a113bcb 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/handlers/tests/test_disclosures_handler.py +++ b/aries_cloudagent/protocols/discovery/v2_0/handlers/tests/test_disclosures_handler.py @@ -1,16 +1,13 @@ import pytest -from aries_cloudagent.tests import mock - from aries_cloudagent.storage.error import StorageNotFoundError +from aries_cloudagent.tests import mock from ......core.protocol_registry import ProtocolRegistry from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder - from .....didcomm_prefix import DIDCommPrefix - from ...handlers.disclosures_handler import DisclosuresHandler from ...messages.disclosures import Disclosures from ...messages.queries import Queries, QueryItem diff --git a/aries_cloudagent/protocols/discovery/v2_0/manager.py b/aries_cloudagent/protocols/discovery/v2_0/manager.py index 7be0f5a50a..f5d3b118b3 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/manager.py +++ b/aries_cloudagent/protocols/discovery/v2_0/manager.py @@ -2,18 +2,16 @@ import asyncio import logging - -from typing import Tuple, Optional, Sequence +from typing import Optional, Sequence, Tuple from ....core.error import BaseError +from ....core.goal_code_registry import GoalCodeRegistry from ....core.profile import Profile from ....core.protocol_registry import ProtocolRegistry -from ....core.goal_code_registry import GoalCodeRegistry -from ....storage.error import StorageNotFoundError from ....messaging.responder import BaseResponder - +from ....storage.error import StorageNotFoundError from .messages.disclosures import Disclosures -from .messages.queries import QueryItem, Queries +from .messages.queries import Queries, QueryItem from .models.discovery_record import V20DiscoveryExchangeRecord diff --git a/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_disclosures.py b/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_disclosures.py index c6440d72eb..ccc4b01a51 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_disclosures.py +++ b/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_disclosures.py @@ -1,13 +1,8 @@ -from unittest import mock -from unittest import TestCase - +from unittest import TestCase, mock from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import DISCLOSURES, PROTOCOL_PACKAGE - from ..disclosures import Disclosures diff --git a/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_queries.py b/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_queries.py index 2089c94692..bc8d2f5e84 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_queries.py +++ b/aries_cloudagent/protocols/discovery/v2_0/messages/tests/test_queries.py @@ -1,9 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - -from ...message_types import QUERIES, PROTOCOL_PACKAGE +from ...message_types import PROTOCOL_PACKAGE, QUERIES from ..queries import Queries, QueryItem TEST_QUERY_PROTOCOL = "https://didcomm.org/tictactoe/1.*" diff --git a/aries_cloudagent/protocols/discovery/v2_0/tests/test_manager.py b/aries_cloudagent/protocols/discovery/v2_0/tests/test_manager.py index 9b3e9b4ce0..eeae52ef04 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/discovery/v2_0/tests/test_manager.py @@ -1,19 +1,18 @@ import asyncio import logging +from unittest import IsolatedAsyncioTestCase + import pytest from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from .....core.in_memory import InMemoryProfile -from .....storage.error import StorageNotFoundError from .....messaging.responder import BaseResponder, MockResponder - +from .....storage.error import StorageNotFoundError from ....didcomm_prefix import DIDCommPrefix - from ..manager import V20DiscoveryMgr, V20DiscoveryMgrError -from ..messages.queries import Queries, QueryItem from ..messages.disclosures import Disclosures +from ..messages.queries import Queries, QueryItem from ..models.discovery_record import V20DiscoveryExchangeRecord TEST_DISCOVERY_EX_REC = V20DiscoveryExchangeRecord( diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/endorsed_transaction_response_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/endorsed_transaction_response_handler.py index 0ce3a060c4..644d860571 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/endorsed_transaction_response_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/endorsed_transaction_response_handler.py @@ -7,7 +7,6 @@ RequestContext, ) from .....storage.error import StorageError - from ..manager import TransactionManager, TransactionManagerError from ..messages.endorsed_transaction_response import EndorsedTransactionResponse diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/refused_transaction_response_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/refused_transaction_response_handler.py index 46da51853e..26f4b46ae3 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/refused_transaction_response_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/refused_transaction_response_handler.py @@ -6,7 +6,6 @@ HandlerException, RequestContext, ) - from ..manager import TransactionManager, TransactionManagerError from ..messages.refused_transaction_response import RefusedTransactionResponse diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_endorsed_transaction_response_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_endorsed_transaction_response_handler.py index 64cc194d10..3205a0e2bb 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_endorsed_transaction_response_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_endorsed_transaction_response_handler.py @@ -1,10 +1,10 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import endorsed_transaction_response_handler as test_module from ...messages.endorsed_transaction_response import EndorsedTransactionResponse diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_refused_transaction_response_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_refused_transaction_response_handler.py index b2d8558cac..6670e04745 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_refused_transaction_response_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_refused_transaction_response_handler.py @@ -1,10 +1,10 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import refused_transaction_response_handler as test_module from ...messages.refused_transaction_response import RefusedTransactionResponse diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_acknowledgement_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_acknowledgement_handler.py index dc92327ef9..30994e8a03 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_acknowledgement_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_acknowledgement_handler.py @@ -1,11 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......connections.models.conn_record import ConnRecord from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import transaction_acknowledgement_handler as test_module from ...messages.transaction_acknowledgement import TransactionAcknowledgement diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_cancel_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_cancel_handler.py index 1fd36bed57..2106b6d29d 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_cancel_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_cancel_handler.py @@ -1,13 +1,13 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + +from ......connections.models.conn_record import ConnRecord from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import transaction_cancel_handler as test_module from ...messages.cancel_transaction import CancelTransaction -from ......connections.models.conn_record import ConnRecord class TestTransactionCancelHandler(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_job_to_send_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_job_to_send_handler.py index 39019ba56d..671a4d47b6 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_job_to_send_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_job_to_send_handler.py @@ -1,10 +1,10 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import transaction_job_to_send_handler as test_module from ...messages.transaction_job_to_send import TransactionJobToSend diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_request_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_request_handler.py index 10d5c7975e..5252660bda 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_request_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_request_handler.py @@ -1,13 +1,13 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + +from ......connections.models.conn_record import ConnRecord from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import transaction_request_handler as test_module from ...messages.transaction_request import TransactionRequest -from ......connections.models.conn_record import ConnRecord class TestTransactionRequestHandler(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_resend_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_resend_handler.py index 1cb00b198b..b6c625852d 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_resend_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/tests/test_transaction_resend_handler.py @@ -1,13 +1,13 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + +from ......connections.models.conn_record import ConnRecord from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import transaction_resend_handler as test_module from ...messages.transaction_resend import TransactionResend -from ......connections.models.conn_record import ConnRecord class TestTransactionResendHandler(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_acknowledgement_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_acknowledgement_handler.py index 0803a7216b..89ec50fa1b 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_acknowledgement_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_acknowledgement_handler.py @@ -6,7 +6,6 @@ HandlerException, RequestContext, ) - from ..manager import TransactionManager, TransactionManagerError from ..messages.transaction_acknowledgement import TransactionAcknowledgement diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_cancel_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_cancel_handler.py index 0154b4e723..d691959b91 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_cancel_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_cancel_handler.py @@ -6,7 +6,6 @@ HandlerException, RequestContext, ) - from ..manager import TransactionManager, TransactionManagerError from ..messages.cancel_transaction import CancelTransaction diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_request_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_request_handler.py index bc60a9a69b..f5d8448e3d 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_request_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_request_handler.py @@ -6,9 +6,7 @@ HandlerException, RequestContext, ) - from .....storage.error import StorageError - from ..manager import TransactionManager, TransactionManagerError from ..messages.transaction_request import TransactionRequest from ..models.transaction_record import TransactionRecord diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_resend_handler.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_resend_handler.py index 268b3f85f2..b47dc0ae56 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_resend_handler.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/handlers/transaction_resend_handler.py @@ -6,7 +6,6 @@ HandlerException, RequestContext, ) - from ..manager import TransactionManager, TransactionManagerError from ..messages.transaction_resend import TransactionResend diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_cancel_transaction.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_cancel_transaction.py index 034bec8356..77dd7d04c9 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_cancel_transaction.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_cancel_transaction.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CANCEL_TRANSACTION - from ..cancel_transaction import CancelTransaction diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_endorsed_transaction_response.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_endorsed_transaction_response.py index 8cc5765167..c3eca102bd 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_endorsed_transaction_response.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_endorsed_transaction_response.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import ENDORSED_TRANSACTION_RESPONSE - from ..endorsed_transaction_response import EndorsedTransactionResponse diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_messages_attach.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_messages_attach.py index 4e8b7e4c0b..460e180192 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_messages_attach.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_messages_attach.py @@ -1,11 +1,7 @@ -from unittest import mock -from unittest import TestCase - +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import ATTACHED_MESSAGE - from ..messages_attach import MessagesAttach diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_refused_transaction_response.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_refused_transaction_response.py index cf6869062d..2f20383166 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_refused_transaction_response.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_refused_transaction_response.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import REFUSED_TRANSACTION_RESPONSE - from ..refused_transaction_response import RefusedTransactionResponse diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_acknowledgement.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_acknowledgement.py index c949370ee0..902792f511 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_acknowledgement.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_acknowledgement.py @@ -1,11 +1,7 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import mock -from unittest import TestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import TRANSACTION_ACKNOWLEDGEMENT - from ..transaction_acknowledgement import TransactionAcknowledgement diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_job_to_send.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_job_to_send.py index 99d4fb094a..7503b6d35c 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_job_to_send.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_job_to_send.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import TRANSACTION_JOB_TO_SEND - from ..transaction_job_to_send import TransactionJobToSend diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_request.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_request.py index db643fe065..835ab274af 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_request.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_request.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import TRANSACTION_REQUEST - from ..transaction_request import TransactionRequest diff --git a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_resend.py b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_resend.py index 5a2a0df253..0c147d2ed7 100644 --- a/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_resend.py +++ b/aries_cloudagent/protocols/endorse_transaction/v1_0/messages/tests/test_transaction_resend.py @@ -1,12 +1,7 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import TRANSACTION_RESEND - from ..transaction_resend import TransactionResend diff --git a/aries_cloudagent/protocols/introduction/v0_1/base_service.py b/aries_cloudagent/protocols/introduction/v0_1/base_service.py index 44aad57051..493579ceea 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/base_service.py +++ b/aries_cloudagent/protocols/introduction/v0_1/base_service.py @@ -4,7 +4,6 @@ from ....core.error import BaseError from ....core.profile import ProfileSession - from .messages.invitation import Invitation diff --git a/aries_cloudagent/protocols/introduction/v0_1/demo_service.py b/aries_cloudagent/protocols/introduction/v0_1/demo_service.py index 9050fd2305..bc682ce3f2 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/demo_service.py +++ b/aries_cloudagent/protocols/introduction/v0_1/demo_service.py @@ -5,12 +5,7 @@ from ....connections.models.conn_record import ConnRecord from ....core.profile import ProfileSession -from ....storage.base import ( - BaseStorage, - StorageRecord, - StorageNotFoundError, -) - +from ....storage.base import BaseStorage, StorageNotFoundError, StorageRecord from .base_service import BaseIntroductionService, IntroductionError from .messages.forward_invitation import ForwardInvitation from .messages.invitation import Invitation as IntroInvitation diff --git a/aries_cloudagent/protocols/introduction/v0_1/handlers/forward_invitation_handler.py b/aries_cloudagent/protocols/introduction/v0_1/handlers/forward_invitation_handler.py index 2b6cbeadba..132d192f59 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/handlers/forward_invitation_handler.py +++ b/aries_cloudagent/protocols/introduction/v0_1/handlers/forward_invitation_handler.py @@ -6,10 +6,8 @@ HandlerException, RequestContext, ) - from ....connections.v1_0.manager import ConnectionManager, ConnectionManagerError from ....problem_report.v1_0.message import ProblemReport - from ..messages.forward_invitation import ForwardInvitation diff --git a/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_handler.py b/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_handler.py index 3244d2e338..ffba358f8e 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_handler.py +++ b/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_handler.py @@ -1,13 +1,13 @@ """Handler for incoming invitation messages.""" from typing import Optional + from .....messaging.base_handler import ( BaseHandler, BaseResponder, HandlerException, RequestContext, ) - from ..base_service import BaseIntroductionService from ..messages.invitation import Invitation as IntroInvitation diff --git a/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_request_handler.py b/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_request_handler.py index 0b137fc2e2..e66d7a4cef 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_request_handler.py +++ b/aries_cloudagent/protocols/introduction/v0_1/handlers/invitation_request_handler.py @@ -6,11 +6,9 @@ HandlerException, RequestContext, ) - from ....connections.v1_0.manager import ConnectionManager - -from ..messages.invitation_request import InvitationRequest as IntroInvitationRequest from ..messages.invitation import Invitation as IntroInvitation +from ..messages.invitation_request import InvitationRequest as IntroInvitationRequest class InvitationRequestHandler(BaseHandler): diff --git a/aries_cloudagent/protocols/introduction/v0_1/handlers/tests/test_invitation_handler.py b/aries_cloudagent/protocols/introduction/v0_1/handlers/tests/test_invitation_handler.py index 301b5ce77e..ff97bbce29 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/handlers/tests/test_invitation_handler.py +++ b/aries_cloudagent/protocols/introduction/v0_1/handlers/tests/test_invitation_handler.py @@ -1,4 +1,5 @@ from unittest import IsolatedAsyncioTestCase + from aries_cloudagent.tests import mock from ......messaging.base_handler import HandlerException @@ -7,9 +8,7 @@ from ......protocols.connections.v1_0.messages.connection_invitation import ( ConnectionInvitation, ) - from ...messages.invitation import Invitation - from .. import invitation_handler as test_module TEST_DID = "55GkHamhTU1ZbTbV2ab9DE" diff --git a/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_forward_invitation.py b/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_forward_invitation.py index c84703c7f5..65e999ee43 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_forward_invitation.py +++ b/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_forward_invitation.py @@ -1,13 +1,8 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....connections.v1_0.messages.connection_invitation import ConnectionInvitation from .....didcomm_prefix import DIDCommPrefix - from ...message_types import FORWARD_INVITATION, PROTOCOL_PACKAGE - from ..forward_invitation import ForwardInvitation diff --git a/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation.py b/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation.py index b3aaa7cbd0..9d5ae8e226 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation.py +++ b/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation.py @@ -1,11 +1,8 @@ -from unittest import mock - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from .....connections.v1_0.messages.connection_invitation import ConnectionInvitation - -from ..invitation import Invitation as IntroInvitation from ...message_types import PROTOCOL_PACKAGE +from ..invitation import Invitation as IntroInvitation class TestInvitation(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation_request.py b/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation_request.py index 63e8b3368f..306b45c99e 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation_request.py +++ b/aries_cloudagent/protocols/introduction/v0_1/messages/tests/test_invitation_request.py @@ -1,12 +1,8 @@ -from unittest import IsolatedAsyncioTestCase - -from unittest import mock -from unittest import TestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - -from ..invitation_request import InvitationRequest from ...message_types import INVITATION_REQUEST, PROTOCOL_PACKAGE +from ..invitation_request import InvitationRequest class TestConfig: diff --git a/aries_cloudagent/protocols/introduction/v0_1/tests/test_service.py b/aries_cloudagent/protocols/introduction/v0_1/tests/test_service.py index d607913ebb..705f21a77d 100644 --- a/aries_cloudagent/protocols/introduction/v0_1/tests/test_service.py +++ b/aries_cloudagent/protocols/introduction/v0_1/tests/test_service.py @@ -2,18 +2,16 @@ from .....connections.models.conn_record import ConnRecord from .....core.in_memory import InMemoryProfile +from .....did.did_key import DIDKey from .....messaging.request_context import RequestContext from .....messaging.responder import MockResponder -from .....did.did_key import DIDKey from .....wallet.key_type import ED25519 - from ....didcomm_prefix import DIDCommPrefix from ....out_of_band.v1_0.message_types import INVITATION as OOB_INVITATION from ....out_of_band.v1_0.messages.invitation import ( InvitationMessage as OOBInvitationMessage, ) from ....out_of_band.v1_0.messages.service import Service as OOBService - from .. import base_service, demo_service TEST_DID = "55GkHamhTU1ZbTbV2ab9DE" diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/__init__.py b/aries_cloudagent/protocols/issue_credential/v1_0/__init__.py index de80027aaa..e621c27f9e 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/__init__.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/__init__.py @@ -2,7 +2,6 @@ from ....connections.models.conn_record import ConnRecord from ....core.error import BaseError - from .messages.credential_problem_report import ( CredentialProblemReport, ProblemReportReason, 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 b7220f1409..386eb28030 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 @@ -4,8 +4,7 @@ from .....messaging.base_handler import BaseHandler, HandlerException from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from ..manager import CredentialManager from ..messages.credential_ack import CredentialAck 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 8018c80e2d..109ce07f85 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 @@ -7,8 +7,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import CredentialManager, CredentialManagerError from ..messages.credential_issue import CredentialIssue 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 e7a736c0ea..2be8c2478c 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 from .....ledger.error import LedgerError @@ -9,8 +8,8 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event +from .....wallet.util import default_did_from_verkey from .. import problem_report_for_record from ..manager import CredentialManager, CredentialManagerError from ..messages.credential_offer import CredentialOffer diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_problem_report_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_problem_report_handler.py index 3936dece50..2582b11b9b 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_problem_report_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_problem_report_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError - from ..manager import CredentialManager from ..messages.credential_problem_report import CredentialProblemReport diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_proposal_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_proposal_handler.py index 354c82012c..bbae16aa04 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_proposal_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_proposal_handler.py @@ -7,8 +7,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import CredentialManager, CredentialManagerError from ..messages.credential_problem_report import ProblemReportReason diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_request_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_request_handler.py index c61dda7dd7..5b3fcc9d48 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_request_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/credential_request_handler.py @@ -8,8 +8,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import CredentialManager, CredentialManagerError from ..messages.credential_problem_report import ProblemReportReason diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_ack_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_ack_handler.py index 861fbcda8f..840ea3823b 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_ack_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_ack_handler.py @@ -1,14 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.credential_ack import CredentialAck - from .. import credential_ack_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_issue_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_issue_handler.py index c0c6e46ce5..11ca5a209b 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_issue_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_issue_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.credential_issue import CredentialIssue - from .. import credential_issue_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_offer_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_offer_handler.py index c5323518d0..9809124d14 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_offer_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_offer_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.credential_offer import CredentialOffer - from .. import credential_offer_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_problem_report_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_problem_report_handler.py index ef9253a439..a8837bd01c 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_problem_report_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_problem_report_handler.py @@ -1,15 +1,14 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.credential_problem_report import ( CredentialProblemReport, ProblemReportReason, ) - from .. import credential_problem_report_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_proposal_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_proposal_handler.py index 47637ccfce..37cd074fe7 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_proposal_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_proposal_handler.py @@ -1,12 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.credential_proposal import CredentialProposal - from .. import credential_proposal_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_request_handler.py b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_request_handler.py index bc4b5ea21d..3c8e54cece 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_request_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_request_handler.py @@ -1,15 +1,14 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.credential_request import CredentialRequest from ...messages.inner.credential_preview import CredAttrSpec, CredentialPreview from ...models.credential_exchange import V10CredentialExchange - from .. import credential_request_handler as test_module CD_ID = "LjgpST2rjsoxYegQDRm7EL:3:CL:18:tag" diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/manager.py b/aries_cloudagent/protocols/issue_credential/v1_0/manager.py index e0d52fd81c..9a0d1265a1 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/manager.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/manager.py @@ -38,9 +38,7 @@ from .messages.credential_proposal import CredentialProposal from .messages.credential_request import CredentialRequest from .messages.inner.credential_preview import CredentialPreview -from .models.credential_exchange import ( - V10CredentialExchange, -) +from .models.credential_exchange import V10CredentialExchange LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_ack.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_ack.py index 5457e72079..9f9319214f 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_ack.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_ack.py @@ -3,7 +3,6 @@ from marshmallow import EXCLUDE from ....notification.v1_0.messages.ack import V10Ack, V10AckSchema - from ..message_types import CREDENTIAL_ACK, PROTOCOL_PACKAGE HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.credential_ack_handler.CredentialAckHandler" diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/tests/test_credential_preview.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/tests/test_credential_preview.py index 89e393a902..27adfb5b23 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/tests/test_credential_preview.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/inner/tests/test_credential_preview.py @@ -2,10 +2,7 @@ from ......didcomm_prefix import DIDCommPrefix from ....message_types import CREDENTIAL_PREVIEW -from ..credential_preview import ( - CredAttrSpec, - CredentialPreview, -) +from ..credential_preview import CredAttrSpec, CredentialPreview CRED_PREVIEW = CredentialPreview( attributes=( diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_ack.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_ack.py index b6c44ad524..0a66c27bfb 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_ack.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_ack.py @@ -1,10 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CREDENTIAL_ACK, PROTOCOL_PACKAGE - from ..credential_ack import CredentialAck diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_issue.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_issue.py index 5221bea457..ede71853d1 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_issue.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_issue.py @@ -1,12 +1,8 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from ......messaging.decorators.attach_decorator import AttachDecorator - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import ATTACH_DECO_IDS, CREDENTIAL_ISSUE, PROTOCOL_PACKAGE - from ..credential_issue import CredentialIssue diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_offer.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_offer.py index 150329ac3d..a4f1b1f63e 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_offer.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_offer.py @@ -1,10 +1,7 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from ......messaging.decorators.attach_decorator import AttachDecorator - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import ATTACH_DECO_IDS, CREDENTIAL_OFFER, PROTOCOL_PACKAGE from ..credential_offer import CredentialOffer from ..inner.credential_preview import CredAttrSpec, CredentialPreview diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_problem_report.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_problem_report.py index 86a8ef4c2c..2e2e5eb02a 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_problem_report.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_problem_report.py @@ -1,14 +1,11 @@ -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CREDENTIAL_PROBLEM_REPORT, PROTOCOL_PACKAGE - +from .. import credential_problem_report as test_module from ..credential_problem_report import ( CredentialProblemReport, CredentialProblemReportSchema, @@ -16,8 +13,6 @@ ValidationError, ) -from .. import credential_problem_report as test_module - class TestCredentialProblemReport(TestCase): """Problem report tests.""" diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_request.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_request.py index 836876ec0d..4276d06480 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_request.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/tests/test_credential_request.py @@ -1,12 +1,8 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from ......messaging.decorators.attach_decorator import AttachDecorator - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import ATTACH_DECO_IDS, CREDENTIAL_REQUEST, PROTOCOL_PACKAGE - from ..credential_request import CredentialRequest diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py index f769d9b1f5..ca1df030ee 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py @@ -1,28 +1,27 @@ import json - from copy import deepcopy from time import time +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase -from .....core.in_memory import InMemoryProfile from .....cache.base import BaseCache from .....cache.in_memory import InMemoryCache +from .....core.in_memory import InMemoryProfile from .....indy.holder import IndyHolder from .....indy.issuer import IndyIssuer -from .....messaging.decorators.thread_decorator import ThreadDecorator -from .....messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE -from .....messaging.responder import BaseResponder, MockResponder from .....ledger.base import BaseLedger from .....ledger.multiple_ledger.ledger_requests_executor import ( IndyLedgerRequestsExecutor, ) +from .....messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE +from .....messaging.decorators.thread_decorator import ThreadDecorator +from .....messaging.responder import BaseResponder, MockResponder from .....multitenant.base import BaseMultitenantManager from .....multitenant.manager import MultitenantManager from .....storage.base import StorageRecord from .....storage.error import StorageNotFoundError - +from .. import manager as test_module from ..manager import CredentialManager, CredentialManagerError from ..messages.credential_ack import CredentialAck from ..messages.credential_issue import CredentialIssue @@ -30,17 +29,14 @@ from ..messages.credential_problem_report import CredentialProblemReport from ..messages.credential_proposal import CredentialProposal from ..messages.credential_request import CredentialRequest -from ..messages.inner.credential_preview import CredentialPreview, CredAttrSpec +from ..messages.inner.credential_preview import CredAttrSpec, CredentialPreview from ..models.credential_exchange import V10CredentialExchange - -from .. import manager as test_module - from . import ( CRED_DEF, CRED_DEF_ID, - INDY_CRED_REQ, INDY_CRED, INDY_CRED_INFO, + INDY_CRED_REQ, INDY_OFFER, REV_REG_DEF, REV_REG_ID, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/handler.py index ba9ac7af83..4d0794c94c 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/handler.py @@ -6,17 +6,14 @@ from marshmallow import RAISE -from ......anoncreds.revocation import AnonCredsRevocation - -from ......anoncreds.registry import AnonCredsRegistry from ......anoncreds.holder import AnonCredsHolder, AnonCredsHolderError -from ......anoncreds.issuer import ( - AnonCredsIssuer, -) +from ......anoncreds.issuer import AnonCredsIssuer +from ......anoncreds.registry import AnonCredsRegistry +from ......anoncreds.revocation import AnonCredsRevocation +from ......cache.base import BaseCache from ......indy.models.cred import IndyCredentialSchema from ......indy.models.cred_abstract import IndyCredAbstractSchema from ......indy.models.cred_request import IndyCredRequestSchema -from ......cache.base import BaseCache from ......ledger.base import BaseLedger from ......ledger.multiple_ledger.ledger_requests_executor import ( GET_CRED_DEF, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/tests/test_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/tests/test_handler.py index c75b0cf8ce..7bf6d4e703 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/tests/test_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/anoncreds/tests/test_handler.py @@ -1,13 +1,13 @@ -from copy import deepcopy import json -import pytest +from copy import deepcopy from time import time - from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock + +import pytest from marshmallow import ValidationError -from .. import handler as test_module +from aries_cloudagent.tests import mock + from .......anoncreds.holder import AnonCredsHolder from .......anoncreds.issuer import AnonCredsIssuer from .......anoncreds.revocation import AnonCredsRevocationRegistryFullError @@ -23,17 +23,6 @@ from .......multitenant.base import BaseMultitenantManager from .......multitenant.manager import MultitenantManager from .......storage.record import StorageRecord - -from ....models.detail.indy import V20CredExRecordIndy -from ....messages.cred_proposal import V20CredProposal -from ....messages.cred_format import V20CredFormat -from ....messages.cred_issue import V20CredIssue -from ....messages.inner.cred_preview import V20CredPreview, V20CredAttrSpec -from ....messages.cred_offer import V20CredOffer -from ....messages.cred_request import ( - V20CredRequest, -) -from ....models.cred_ex_record import V20CredExRecord from ....message_types import ( ATTACHMENT_FORMAT, CRED_20_ISSUE, @@ -41,9 +30,18 @@ CRED_20_PROPOSAL, CRED_20_REQUEST, ) +from ....messages.cred_format import V20CredFormat +from ....messages.cred_issue import V20CredIssue +from ....messages.cred_offer import V20CredOffer +from ....messages.cred_proposal import V20CredProposal +from ....messages.cred_request import V20CredRequest +from ....messages.inner.cred_preview import V20CredAttrSpec, V20CredPreview +from ....models.cred_ex_record import V20CredExRecord +from ....models.detail.indy import V20CredExRecordIndy from ...handler import V20CredFormatError -from ..handler import AnonCredsCredFormatHandler +from .. import handler as test_module from ..handler import LOGGER as INDY_LOGGER +from ..handler import AnonCredsCredFormatHandler TEST_DID = "LjgpST2rjsoxYegQDRm7EL" SCHEMA_NAME = "bc-reg" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/handler.py index b8cd77302e..d280c820c5 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/handler.py @@ -1,19 +1,17 @@ """V2.0 issue-credential base credential format handler.""" -from abc import ABC, abstractclassmethod, abstractmethod import logging - +from abc import ABC, abstractclassmethod, abstractmethod from typing import Mapping, Tuple from .....core.error import BaseError from .....core.profile import Profile from .....messaging.decorators.attach_decorator import AttachDecorator - from ..messages.cred_format import V20CredFormat -from ..messages.cred_proposal import V20CredProposal +from ..messages.cred_issue import V20CredIssue from ..messages.cred_offer import V20CredOffer +from ..messages.cred_proposal import V20CredProposal from ..messages.cred_request import V20CredRequest -from ..messages.cred_issue import V20CredIssue from ..models.cred_ex_record import V20CredExRecord LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py index 92c470e3a3..33cec49bd0 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py @@ -1,48 +1,45 @@ +import json from copy import deepcopy from time import time -import json from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock + from marshmallow import ValidationError -from .. import handler as test_module +from aries_cloudagent.tests import mock +from .......cache.base import BaseCache +from .......cache.in_memory import InMemoryCache from .......core.in_memory import InMemoryProfile +from .......indy.holder import IndyHolder +from .......indy.issuer import IndyIssuer from .......ledger.base import BaseLedger from .......ledger.multiple_ledger.ledger_requests_executor import ( IndyLedgerRequestsExecutor, ) +from .......messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE +from .......messaging.decorators.attach_decorator import AttachDecorator from .......multitenant.base import BaseMultitenantManager from .......multitenant.manager import MultitenantManager -from .......indy.issuer import IndyIssuer -from .......cache.in_memory import InMemoryCache -from .......cache.base import BaseCache from .......storage.record import StorageRecord -from .......messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE -from .......messaging.decorators.attach_decorator import AttachDecorator -from .......indy.holder import IndyHolder -from ....models.detail.indy import V20CredExRecordIndy -from ....messages.cred_proposal import V20CredProposal -from ....messages.cred_format import V20CredFormat -from ....messages.cred_issue import V20CredIssue -from ....messages.inner.cred_preview import V20CredPreview, V20CredAttrSpec -from ....messages.cred_offer import V20CredOffer -from ....messages.cred_request import ( - V20CredRequest, -) -from ....models.cred_ex_record import V20CredExRecord from ....message_types import ( ATTACHMENT_FORMAT, - CRED_20_PROPOSAL, + CRED_20_ISSUE, CRED_20_OFFER, + CRED_20_PROPOSAL, CRED_20_REQUEST, - CRED_20_ISSUE, ) - +from ....messages.cred_format import V20CredFormat +from ....messages.cred_issue import V20CredIssue +from ....messages.cred_offer import V20CredOffer +from ....messages.cred_proposal import V20CredProposal +from ....messages.cred_request import V20CredRequest +from ....messages.inner.cred_preview import V20CredAttrSpec, V20CredPreview +from ....models.cred_ex_record import V20CredExRecord +from ....models.detail.indy import V20CredExRecordIndy from ...handler import V20CredFormatError - -from ..handler import IndyCredFormatHandler +from .. import handler as test_module from ..handler import LOGGER as INDY_LOGGER +from ..handler import IndyCredFormatHandler TEST_DID = "LjgpST2rjsoxYegQDRm7EL" SCHEMA_NAME = "bc-reg" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/models/cred_detail.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/models/cred_detail.py index 2e1f05f326..b923f57eca 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/models/cred_detail.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/ld_proof/models/cred_detail.py @@ -4,7 +4,6 @@ from marshmallow import INCLUDE, fields - from .......messaging.models.base import BaseModel, BaseModelSchema from .......vc.vc_ld import CredentialSchema from .......vc.vc_ld.models.credential import VerifiableCredential 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 833aba09bf..3c6b53f6a3 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 @@ -7,40 +7,14 @@ import json import logging from typing import Mapping, Tuple -from ...models.cred_ex_record import V20CredExRecord -from anoncreds import W3cCredential -from ...models.detail.indy import ( - V20CredExRecordIndy, -) -from .models.cred import ( - VCDIIndyCredentialSchema, -) -from .models.cred_request import ( - AnoncredsLinkSecretRequest, - BindingProof, - DidcommSignedAttachmentRequest, - VCDICredRequest, - VCDICredRequestSchema, -) -from ......vc.vc_ld import VerifiableCredential - -from .models.cred_offer import ( - AnoncredsLinkSecret, - BindingMethod, - DidcommSignedAttachment, - VCDICredAbstract, - VCDICredAbstractSchema, -) +from anoncreds import W3cCredential from marshmallow import RAISE -from ......anoncreds.revocation import AnonCredsRevocation - -from ......anoncreds.registry import AnonCredsRegistry from ......anoncreds.holder import AnonCredsHolder, AnonCredsHolderError -from ......anoncreds.issuer import ( - AnonCredsIssuer, -) +from ......anoncreds.issuer import AnonCredsIssuer +from ......anoncreds.registry import AnonCredsRegistry +from ......anoncreds.revocation import AnonCredsRevocation from ......cache.base import BaseCache from ......ledger.base import BaseLedger from ......ledger.multiple_ledger.ledger_requests_executor import ( @@ -55,6 +29,7 @@ from ......multitenant.base import BaseMultitenantManager from ......revocation_anoncreds.models.issuer_cred_rev_record import IssuerCredRevRecord from ......storage.base import BaseStorage +from ......vc.vc_ld import VerifiableCredential from ......wallet.base import BaseWallet from ...message_types import ( ATTACHMENT_FORMAT, @@ -68,8 +43,24 @@ from ...messages.cred_offer import V20CredOffer from ...messages.cred_proposal import V20CredProposal from ...messages.cred_request import V20CredRequest - +from ...models.cred_ex_record import V20CredExRecord +from ...models.detail.indy import V20CredExRecordIndy from ..handler import CredFormatAttachment, V20CredFormatError, V20CredFormatHandler +from .models.cred import VCDIIndyCredentialSchema +from .models.cred_offer import ( + AnoncredsLinkSecret, + BindingMethod, + DidcommSignedAttachment, + VCDICredAbstract, + VCDICredAbstractSchema, +) +from .models.cred_request import ( + AnoncredsLinkSecretRequest, + BindingProof, + DidcommSignedAttachmentRequest, + VCDICredRequest, + VCDICredRequestSchema, +) LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py index caf6b7d9dc..6345a2eeb0 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_offer.py @@ -12,10 +12,7 @@ NUM_STR_WHOLE_EXAMPLE, NUM_STR_WHOLE_VALIDATE, ) -from .......vc.vc_ld.models.credential import ( - CredentialSchema, - VerifiableCredential, -) +from .......vc.vc_ld.models.credential import CredentialSchema, VerifiableCredential class AnoncredsLinkSecret(BaseModel): diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py index a922ec1e22..454805d6a3 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/models/cred_request.py @@ -1,6 +1,9 @@ """Cred request artifacts to attach to RFC 453 messages.""" from typing import Mapping, Union + +from marshmallow import EXCLUDE, fields + from .......messaging.models.base import BaseModel, BaseModelSchema from .......messaging.valid import ( INDY_CRED_DEF_ID_EXAMPLE, @@ -10,8 +13,6 @@ NUM_STR_WHOLE_VALIDATE, ) -from marshmallow import EXCLUDE, fields - class AnoncredsLinkSecretRequest(BaseModel): """Binding proof model.""" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py index d2dec27a41..37cd0c75ab 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/vc_di/tests/test_handler.py @@ -1,7 +1,12 @@ +import json from copy import deepcopy from time import time -import json +from unittest import IsolatedAsyncioTestCase + +import pytest from anoncreds import W3cCredential +from marshmallow import ValidationError + from aries_cloudagent.anoncreds.models.anoncreds_cred_def import ( CredDef, GetCredDefResult, @@ -18,30 +23,29 @@ from aries_cloudagent.protocols.issue_credential.v2_0.models.cred_ex_record import ( V20CredExRecord, ) +from aries_cloudagent.tests import mock from aries_cloudagent.wallet.did_info import DIDInfo -import pytest + from .......anoncreds.holder import AnonCredsHolder, AnonCredsHolderError -from .......messaging.credential_definitions.util import ( - CRED_DEF_SENT_RECORD_TYPE, +from .......anoncreds.issuer import AnonCredsIssuer +from .......cache.base import BaseCache +from .......cache.in_memory import InMemoryCache +from .......core.in_memory import InMemoryProfile +from .......ledger.base import BaseLedger +from .......ledger.multiple_ledger.ledger_requests_executor import ( + IndyLedgerRequestsExecutor, ) +from .......messaging.credential_definitions.util import CRED_DEF_SENT_RECORD_TYPE from .......messaging.decorators.attach_decorator import AttachDecorator from .......multitenant.base import BaseMultitenantManager from .......multitenant.manager import MultitenantManager -from .......protocols.issue_credential.v2_0.formats.handler import ( - V20CredFormatError, -) -from .......protocols.issue_credential.v2_0.messages.cred_format import ( - V20CredFormat, -) -from .......protocols.issue_credential.v2_0.messages.cred_offer import ( - V20CredOffer, -) +from .......protocols.issue_credential.v2_0.formats.handler import V20CredFormatError +from .......protocols.issue_credential.v2_0.messages.cred_format import V20CredFormat +from .......protocols.issue_credential.v2_0.messages.cred_offer import V20CredOffer from .......protocols.issue_credential.v2_0.messages.cred_proposal import ( V20CredProposal, ) -from .......protocols.issue_credential.v2_0.messages.cred_request import ( - V20CredRequest, -) +from .......protocols.issue_credential.v2_0.messages.cred_request import V20CredRequest from .......protocols.issue_credential.v2_0.messages.inner.cred_preview import ( V20CredAttrSpec, V20CredPreview, @@ -49,24 +53,7 @@ from .......protocols.issue_credential.v2_0.models.detail.indy import ( V20CredExRecordIndy, ) - from .......storage.record import StorageRecord - -from unittest import IsolatedAsyncioTestCase - -from marshmallow import ValidationError - -from aries_cloudagent.tests import mock - -from .......core.in_memory import InMemoryProfile -from .......ledger.base import BaseLedger -from .......ledger.multiple_ledger.ledger_requests_executor import ( - IndyLedgerRequestsExecutor, -) -from .......cache.in_memory import InMemoryCache -from .......cache.base import BaseCache -from .......anoncreds.issuer import AnonCredsIssuer - from ....message_types import ( ATTACHMENT_FORMAT, CRED_20_ISSUE, @@ -74,9 +61,9 @@ CRED_20_PROPOSAL, CRED_20_REQUEST, ) -from ..handler import VCDICredFormatHandler -from ..handler import LOGGER as VCDI_LOGGER from .. import handler as test_module +from ..handler import LOGGER as VCDI_LOGGER +from ..handler import VCDICredFormatHandler # these are from faber CRED_PREVIEW_TYPE = "https://didcomm.org/issue-credential/2.0/credential-preview" 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 7104b08bbd..fb0b8eb207 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 @@ -4,8 +4,7 @@ from .....messaging.base_handler import BaseHandler, HandlerException from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from ..manager import V20CredManager from ..messages.cred_ack import V20CredAck 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 1b6bd7398f..180913e959 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 @@ -1,15 +1,14 @@ """Credential issue message handler.""" -from .....core.oob_processor import OobMessageProcessor from .....anoncreds.holder import AnonCredsHolderError +from .....core.oob_processor import OobMessageProcessor from .....indy.holder import IndyHolderError from .....messaging.base_handler import BaseHandler, HandlerException from .....messaging.models.base import BaseModelError from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import V20CredManager, V20CredManagerError from ..messages.cred_issue import V20CredIssue diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_offer_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_offer_handler.py index e280675e43..712b826069 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_offer_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_offer_handler.py @@ -1,8 +1,7 @@ """Credential offer message handler.""" -from .....wallet.util import default_did_from_verkey -from .....core.oob_processor import OobMessageProcessor from .....anoncreds.holder import AnonCredsHolderError +from .....core.oob_processor import OobMessageProcessor from .....indy.holder import IndyHolderError from .....ledger.error import LedgerError from .....messaging.base_handler import BaseHandler, HandlerException @@ -10,8 +9,8 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event +from .....wallet.util import default_did_from_verkey from .. import problem_report_for_record from ..manager import V20CredManager, V20CredManagerError from ..messages.cred_offer import V20CredOffer diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_problem_report_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_problem_report_handler.py index d3b85ecacd..b8f56f119d 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_problem_report_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_problem_report_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError - from ..manager import V20CredManager from ..messages.cred_problem_report import V20CredProblemReport diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_proposal_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_proposal_handler.py index 7bdf3d77a4..2dd62508bf 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_proposal_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_proposal_handler.py @@ -8,8 +8,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import V20CredManager, V20CredManagerError from ..messages.cred_problem_report import ProblemReportReason diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_request_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_request_handler.py index 06a45fb8c6..182625353d 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_request_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_request_handler.py @@ -1,7 +1,7 @@ """Credential request message handler.""" -from .....core.oob_processor import OobMessageProcessor from .....anoncreds.issuer import AnonCredsIssuerError +from .....core.oob_processor import OobMessageProcessor from .....indy.issuer import IndyIssuerError from .....ledger.error import LedgerError from .....messaging.base_handler import BaseHandler, HandlerException @@ -9,8 +9,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import V20CredManager, V20CredManagerError from ..messages.cred_problem_report import ProblemReportReason diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_ack_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_ack_handler.py index d9b6e4cae0..ab42f2d0c4 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_ack_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_ack_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.cred_ack import V20CredAck - from .. import cred_ack_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_issue_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_issue_handler.py index b82bc846f7..f5d068705f 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_issue_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_issue_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.cred_issue import V20CredIssue - from .. import cred_issue_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_offer_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_offer_handler.py index aa21834a5a..9b14600119 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_offer_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_offer_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.cred_offer import V20CredOffer - from .. import cred_offer_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_problem_report_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_problem_report_handler.py index df1df7cf58..aef9a0d130 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_problem_report_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_problem_report_handler.py @@ -1,12 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - -from ...messages.cred_problem_report import V20CredProblemReport, ProblemReportReason - +from ...messages.cred_problem_report import ProblemReportReason, V20CredProblemReport from .. import cred_problem_report_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_proposal_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_proposal_handler.py index c7f3b8c935..5e636720d4 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_proposal_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_proposal_handler.py @@ -1,12 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.cred_proposal import V20CredProposal - from .. import cred_proposal_handler as test_module diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_request_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_request_handler.py index d89ee0d5fd..838299c3a9 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_request_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/handlers/tests/test_cred_request_handler.py @@ -1,14 +1,13 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.cred_request import V20CredRequest from ...models.cred_ex_record import V20CredExRecord - from .. import cred_request_handler as test_module CD_ID = "LjgpST2rjsoxYegQDRm7EL:3:CL:18:tag" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py b/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py index de7d225fcc..1ee2095431 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/message_types.py @@ -1,10 +1,8 @@ """Message and inner object type identifiers for Connections.""" from ...didcomm_prefix import DIDCommPrefix - from .messages.cred_format import V20CredFormat - SPEC_URI = ( "https://github.com/hyperledger/aries-rfcs/tree/" "cd27fc64aa2805f756a118043d7c880354353047/features/0453-issue-credential-v2" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/cred_ack.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/cred_ack.py index 79bdc1e1a9..c173529197 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/cred_ack.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/cred_ack.py @@ -3,7 +3,6 @@ from marshmallow import EXCLUDE from ....notification.v1_0.messages.ack import V10Ack, V10AckSchema - from ..message_types import CRED_20_ACK, PROTOCOL_PACKAGE HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.cred_ack_handler.V20CredAckHandler" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/tests/test_cred_preview.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/tests/test_cred_preview.py index 82098d1842..c3dfb68fa3 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/tests/test_cred_preview.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/inner/tests/test_cred_preview.py @@ -2,10 +2,7 @@ from ......didcomm_prefix import DIDCommPrefix from ....message_types import CRED_20_PREVIEW -from ..cred_preview import ( - V20CredAttrSpec, - V20CredPreview, -) +from ..cred_preview import V20CredAttrSpec, V20CredPreview TEST_PREVIEW = V20CredPreview( attributes=( diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_ack.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_ack.py index a2b363edcf..b7e6019a9d 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_ack.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_ack.py @@ -1,10 +1,7 @@ -from unittest import mock -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CRED_20_ACK - from .. import cred_ack as test_module from ..cred_ack import V20CredAck diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_format.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_format.py index b067118aee..671e70e099 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_format.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_format.py @@ -1,11 +1,9 @@ from unittest import TestCase from ......messaging.decorators.attach_decorator import AttachDecorator - from ..cred_format import V20CredFormat from ..inner.cred_preview import V20CredAttrSpec, V20CredPreview - TEST_PREVIEW = V20CredPreview( attributes=( V20CredAttrSpec.list_plain({"test": "123", "hello": "world"}) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_problem_report.py b/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_problem_report.py index 4459ec4bc9..a1b6bc31d1 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_problem_report.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/messages/tests/test_cred_problem_report.py @@ -1,23 +1,18 @@ -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import CRED_20_PROBLEM_REPORT, PROTOCOL_PACKAGE - +from .. import cred_problem_report as test_module from ..cred_problem_report import ( + ProblemReportReason, V20CredProblemReport, V20CredProblemReportSchema, - ProblemReportReason, ValidationError, ) -from .. import cred_problem_report as test_module - class TestCredProblemReport(TestCase): """Problem report tests.""" diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_manager.py b/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_manager.py index 1508fac3c9..0cddba3532 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_manager.py @@ -1,39 +1,36 @@ import json - +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase +from .....anoncreds.issuer import AnonCredsIssuer from .....cache.base import BaseCache from .....cache.in_memory import InMemoryCache from .....core.in_memory import InMemoryProfile -from .....anoncreds.issuer import AnonCredsIssuer from .....indy.issuer import IndyIssuer -from .....messaging.decorators.thread_decorator import ThreadDecorator +from .....ledger.base import BaseLedger from .....messaging.decorators.attach_decorator import AttachDecorator +from .....messaging.decorators.thread_decorator import ThreadDecorator from .....messaging.responder import BaseResponder, MockResponder -from .....ledger.base import BaseLedger from .....storage.error import StorageNotFoundError - from .. import manager as test_module from ..manager import V20CredManager, V20CredManagerError from ..message_types import ( ATTACHMENT_FORMAT, - CRED_20_PROPOSAL, + CRED_20_ISSUE, CRED_20_OFFER, + CRED_20_PROPOSAL, CRED_20_REQUEST, - CRED_20_ISSUE, ) from ..messages.cred_ack import V20CredAck -from ..messages.cred_issue import V20CredIssue from ..messages.cred_format import V20CredFormat +from ..messages.cred_issue import V20CredIssue from ..messages.cred_offer import V20CredOffer from ..messages.cred_problem_report import V20CredProblemReport from ..messages.cred_proposal import V20CredProposal from ..messages.cred_request import V20CredRequest -from ..messages.inner.cred_preview import V20CredPreview, V20CredAttrSpec +from ..messages.inner.cred_preview import V20CredAttrSpec, V20CredPreview from ..models.cred_ex_record import V20CredExRecord - from . import ( CRED_DEF, CRED_DEF_ID, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_routes.py index f221db4250..4689a31266 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/tests/test_routes.py @@ -9,10 +9,7 @@ from ..formats.indy.handler import IndyCredFormatHandler from ..formats.ld_proof.handler import LDProofCredFormatHandler from ..messages.cred_format import V20CredFormat -from . import ( - LD_PROOF_VC_DETAIL, - TEST_DID, -) +from . import LD_PROOF_VC_DETAIL, TEST_DID class TestV20CredRoutes(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/problem_report_handler.py b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/problem_report_handler.py index 9602d5ce7d..2c39a3ff1c 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/problem_report_handler.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/problem_report_handler.py @@ -3,7 +3,6 @@ from .....messaging.base_handler import BaseHandler from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder - from ..manager import OutOfBandManager, OutOfBandManagerError from ..messages.problem_report import OOBProblemReport diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/reuse_accept_handler.py b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/reuse_accept_handler.py index ae19d16441..4e84a2d064 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/handlers/reuse_accept_handler.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/handlers/reuse_accept_handler.py @@ -3,7 +3,6 @@ from .....messaging.base_handler import BaseHandler from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder - from ..manager import OutOfBandManager, OutOfBandManagerError from ..messages.reuse_accept import HandshakeReuseAccept 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 5e4d6bedb4..f659d7a1e2 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 @@ -9,7 +9,6 @@ from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import problem_report_handler as test_module from ...manager import OutOfBandManagerError from ...messages.problem_report import OOBProblemReport, ProblemReportReason 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 660c3b7688..849134b429 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 @@ -9,7 +9,6 @@ from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers import reuse_accept_handler as test_module from ...manager import OutOfBandManagerError from ...messages.reuse_accept import HandshakeReuseAccept diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/message_types.py b/aries_cloudagent/protocols/out_of_band/v1_0/message_types.py index 6ca6555b74..bf99f42016 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/message_types.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/message_types.py @@ -1,9 +1,7 @@ """Message and inner object type identifiers for Out of Band messages.""" from ....messaging.util import get_proto_default_version - from ...didcomm_prefix import DIDCommPrefix - from ..definition import versions SPEC_URI = ( diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_invitation.py b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_invitation.py index 7452b17a28..dd359b0e2a 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_invitation.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/messages/tests/test_invitation.py @@ -1,17 +1,15 @@ -import pytest - from unittest import TestCase -from ......messaging.models.base import BaseModelError +import pytest + from ......did.did_key import DIDKey +from ......messaging.models.base import BaseModelError from ......wallet.key_type import ED25519 - from .....connections.v1_0.message_types import ARIES_PROTOCOL as CONN_PROTO from .....didcomm_prefix import DIDCommPrefix -from .....didexchange.v1_0.message_types import ARIES_PROTOCOL as DIDEX_1_1, DIDEX_1_0 +from .....didexchange.v1_0.message_types import ARIES_PROTOCOL as DIDEX_1_1 +from .....didexchange.v1_0.message_types import DIDEX_1_0 from .....didexchange.v1_0.messages.request import DIDXRequest - - from .. import invitation as test_module from ..invitation import HSProto, InvitationMessage, InvitationMessageSchema from ..service import Service 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 daec556722..078496f16a 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,12 +1,11 @@ """Test Problem Report Message.""" -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from ......messaging.models.base import BaseModelError - +from .. import problem_report as test_module from ..problem_report import ( OOBProblemReport, OOBProblemReportSchema, @@ -14,8 +13,6 @@ ValidationError, ) -from .. import problem_report as test_module - class TestOOBProblemReportMessage(TestCase): """Test problem report.""" 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 53789417f8..b2d3a75edd 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,11 +1,10 @@ """Test Reuse Message.""" -import pytest - from unittest import TestCase -from ......messaging.models.base import BaseModelError +import pytest +from ......messaging.models.base import BaseModelError from ..reuse import HandshakeReuse 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 667abb4160..f6184ddd88 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,13 +1,11 @@ """Test Reuse Accept Message.""" -import pytest - from unittest import TestCase -from ......messaging.models.base import BaseModelError +import pytest +from ......messaging.models.base import BaseModelError from .....didcomm_prefix import DIDCommPrefix - from ..reuse_accept import HandshakeReuseAccept diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_invitation.py b/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_invitation.py index e7d95655a2..c5adcac012 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_invitation.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_invitation.py @@ -1,11 +1,8 @@ from unittest import IsolatedAsyncioTestCase from .....didcomm_prefix import DIDCommPrefix - from .....didexchange.v1_0.message_types import ARIES_PROTOCOL as DIDEX_1_1 - from ...messages.invitation import InvitationMessage - from ..invitation import InvitationRecord TEST_DID = "did:sov:55GkHamhTU1ZbTbV2ab9DE" diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_out_of_band.py b/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_out_of_band.py index 1749e4d6b9..07aa36a5df 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_out_of_band.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/models/tests/test_out_of_band.py @@ -1,9 +1,9 @@ import pytest -from ..oob_record import OobRecord -from ...messages.invitation import InvitationMessage from ......core.in_memory import InMemoryProfile from ......core.profile import ProfileSession +from ...messages.invitation import InvitationMessage +from ..oob_record import OobRecord @pytest.fixture() diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_invite_creator.py b/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_invite_creator.py index 107357dd15..0848dd8c74 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_invite_creator.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_invite_creator.py @@ -1,6 +1,7 @@ """Test the InvitationCreator class.""" from unittest.mock import MagicMock + import pytest from ..manager import InvitationCreator, OutOfBandManagerError diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py index c2bfe14bcd..2eb4ca2495 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py @@ -5,10 +5,10 @@ from copy import deepcopy from datetime import datetime, timedelta, timezone from typing import List +from unittest import IsolatedAsyncioTestCase from unittest.mock import ANY from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from .....connections.models.conn_record import ConnRecord from .....connections.models.connection_target import ConnectionTarget @@ -24,10 +24,10 @@ from .....multitenant.base import BaseMultitenantManager from .....multitenant.manager import MultitenantManager from .....protocols.coordinate_mediation.v1_0.manager import MediationManager -from .....protocols.coordinate_mediation.v1_0.route_manager import RouteManager from .....protocols.coordinate_mediation.v1_0.models.mediation_record import ( MediationRecord, ) +from .....protocols.coordinate_mediation.v1_0.route_manager import RouteManager from .....protocols.didexchange.v1_0.manager import DIDXManager from .....protocols.issue_credential.v1_0.messages.credential_offer import ( CredentialOffer as V10CredOffer, @@ -49,7 +49,6 @@ V20CredAttrSpec, V20CredPreview, ) - from .....protocols.present_proof.v1_0.message_types import ( ATTACH_DECO_IDS as V10_PRES_ATTACH_FORMAT, ) @@ -57,7 +56,6 @@ from .....protocols.present_proof.v1_0.messages.presentation_request import ( PresentationRequest, ) - from .....protocols.present_proof.v2_0.message_types import ( ATTACHMENT_FORMAT as V20_PRES_ATTACH_FORMAT, ) diff --git a/aries_cloudagent/protocols/present_proof/dif/pres_exch.py b/aries_cloudagent/protocols/present_proof/dif/pres_exch.py index ad62e169d3..1b37e2c105 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_exch.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_exch.py @@ -13,7 +13,7 @@ ) from ....messaging.models.base import BaseModel, BaseModelSchema -from ....messaging.valid import StrOrNumberField, UUID4_EXAMPLE, UUID4_VALIDATE +from ....messaging.valid import UUID4_EXAMPLE, UUID4_VALIDATE, StrOrNumberField from ....vc.vc_ld.models.presentation import ( VerifiablePresentation, VerifiablePresentationSchema, 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 2c67bdffff..9a4a9f9104 100644 --- a/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py +++ b/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py @@ -37,8 +37,8 @@ EXPANDED_TYPE_CREDENTIALS_CONTEXT_V1_VC_TYPE, SECURITY_CONTEXT_BBS_URL, ) -from ....vc.vc_ld.prove import create_presentation, derive_credential, sign_presentation from ....vc.vc_di.prove import create_signed_anoncreds_presentation +from ....vc.vc_ld.prove import create_presentation, derive_credential, sign_presentation from ....wallet.base import BaseWallet, DIDInfo from ....wallet.default_verification_key_strategy import BaseVerificationKeyStrategy from ....wallet.error import WalletError, WalletNotFoundError 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 e9920c3299..18563be569 100644 --- a/aries_cloudagent/protocols/present_proof/dif/tests/test_data.py +++ b/aries_cloudagent/protocols/present_proof/dif/tests/test_data.py @@ -3,7 +3,6 @@ import json from .....storage.vc_holder.vc_record import VCRecord - from ..pres_exch import PresentationDefinition 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 0c8ac25e0d..d1dceabed6 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,19 +1,17 @@ """Test for DIF PresExch Schemas.""" import json - from unittest import TestCase from .....messaging.models.base import BaseModelError - from ..pres_exch import ( ClaimFormat, - SubmissionRequirements, + Constraints, DIFHolder, Filter, - Constraints, - VPWithSubmission, SchemasInputDescriptorFilter, + SubmissionRequirements, + VPWithSubmission, ) diff --git a/aries_cloudagent/protocols/present_proof/v1_0/__init__.py b/aries_cloudagent/protocols/present_proof/v1_0/__init__.py index 8bcc3e0dc9..0102a32839 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/__init__.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/__init__.py @@ -2,7 +2,6 @@ from ....connections.models.conn_record import ConnRecord from ....core.error import BaseError - from .messages.presentation_problem_report import ( PresentationProblemReport, ProblemReportReason, diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_ack_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_ack_handler.py index 6a3dfa9eef..b5de11c169 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_ack_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_ack_handler.py @@ -4,8 +4,7 @@ from .....messaging.base_handler import BaseHandler, HandlerException from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from ..manager import PresentationManager from ..messages.presentation_ack import PresentationAck diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_handler.py index 7aa96f7f27..2329215b8e 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_handler.py @@ -7,8 +7,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import PresentationManager from ..messages.presentation import Presentation 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 7a0f9e4060..c0dc0d5fae 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 @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError - from ..manager import PresentationManager from ..messages.presentation_problem_report import PresentationProblemReport diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_proposal_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_proposal_handler.py index 6716fbd4fd..952c830c00 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_proposal_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_proposal_handler.py @@ -6,8 +6,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import PresentationManager from ..messages.presentation_problem_report import ProblemReportReason 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 9651f986bc..b026d5628c 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 @@ -9,13 +9,12 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError -from .....utils.tracing import trace_event, get_timer +from .....utils.tracing import get_timer, trace_event from .....wallet.error import WalletNotFoundError - from .. import problem_report_for_record from ..manager import PresentationManager -from ..messages.presentation_request import PresentationRequest from ..messages.presentation_problem_report import ProblemReportReason +from ..messages.presentation_request import PresentationRequest from ..models.presentation_exchange import V10PresentationExchange diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_ack_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_ack_handler.py index ae963a3ef1..4421ee9f2c 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_ack_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_ack_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.presentation_ack import PresentationAck - from .. import presentation_ack_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_handler.py index 0ce2d5ab5d..97910ccaa1 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.presentation import Presentation - from .. import presentation_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_problem_report_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_problem_report_handler.py index 99a756785b..f0df55c1f3 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_problem_report_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_problem_report_handler.py @@ -1,15 +1,14 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.presentation_problem_report import ( PresentationProblemReport, ProblemReportReason, ) - from .. import presentation_problem_report_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_proposal_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_proposal_handler.py index a2318dde40..012763e58c 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_proposal_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_proposal_handler.py @@ -1,12 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.presentation_proposal import PresentationProposal - from .. import presentation_proposal_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_request_handler.py b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_request_handler.py index 7afbcc0bc5..87eb0fc978 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_request_handler.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_request_handler.py @@ -1,6 +1,6 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock from ......core.oob_processor import OobMessageProcessor from ......indy.holder import IndyHolder @@ -13,12 +13,9 @@ from ......messaging.responder import MockResponder from ......storage.error import StorageNotFoundError from ......transport.inbound.receipt import MessageReceipt - from .....didcomm_prefix import DIDCommPrefix - from ...messages.presentation_proposal import PresentationProposal from ...messages.presentation_request import PresentationRequest - from .. import presentation_request_handler as test_module S_ID = "NcYxiDXkpYi6ov5FcYDi1e:2:vidya:1.0" diff --git a/aries_cloudagent/protocols/present_proof/v1_0/messages/tests/test_presentation_problem_report.py b/aries_cloudagent/protocols/present_proof/v1_0/messages/tests/test_presentation_problem_report.py index 325bf8cbe5..15b4ba8054 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/messages/tests/test_presentation_problem_report.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/messages/tests/test_presentation_problem_report.py @@ -1,14 +1,10 @@ -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import PRESENTATION_PROBLEM_REPORT, PROTOCOL_PACKAGE - from ..presentation_problem_report import PresentationProblemReport, ProblemReportReason diff --git a/aries_cloudagent/protocols/present_proof/v1_0/models/tests/test_record.py b/aries_cloudagent/protocols/present_proof/v1_0/models/tests/test_record.py index 55577fb6bb..571deee4b2 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/models/tests/test_record.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/models/tests/test_record.py @@ -1,6 +1,7 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.in_memory import InMemoryProfile from ......indy.models.pres_preview import ( IndyPresAttrSpec, @@ -8,9 +9,7 @@ IndyPresPreview, ) from ......messaging.models.base_record import BaseExchangeRecord, BaseExchangeSchema - from ...messages.presentation_proposal import PresentationProposal - from .. import presentation_exchange as test_module from ..presentation_exchange import V10PresentationExchange diff --git a/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py index 75f909e0e4..1a48dba753 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py @@ -1,22 +1,20 @@ import json - from time import time - -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase from aries_cloudagent.protocols.issue_credential.v1_0.models.credential_exchange import ( V10CredentialExchange, ) +from aries_cloudagent.tests import mock from .....core.in_memory import InMemoryProfile from .....indy.holder import IndyHolder, IndyHolderError -from .....indy.models.xform import indy_proof_req_preview2indy_requested_creds from .....indy.models.pres_preview import ( IndyPresAttrSpec, - IndyPresPreview, IndyPresPredSpec, + IndyPresPreview, ) +from .....indy.models.xform import indy_proof_req_preview2indy_requested_creds from .....indy.verifier import IndyVerifier from .....ledger.base import BaseLedger from .....ledger.multiple_ledger.ledger_requests_executor import ( @@ -24,11 +22,8 @@ ) from .....messaging.decorators.attach_decorator import AttachDecorator from .....messaging.responder import BaseResponder, MockResponder - from ....didcomm_prefix import DIDCommPrefix - from ...indy import pres_exch_handler as test_indy_util_module - from .. import manager as test_module from ..manager import PresentationManager, PresentationManagerError from ..message_types import ATTACH_DECO_IDS, PRESENTATION, PRESENTATION_REQUEST @@ -38,7 +33,6 @@ from ..messages.presentation_request import PresentationRequest from ..models.presentation_exchange import V10PresentationExchange - NOW = int(time()) CONN_ID = "connection_id" ISSUER_DID = "NcYxiDXkpYi6ov5FcYDi1e" diff --git a/aries_cloudagent/protocols/present_proof/v2_0/__init__.py b/aries_cloudagent/protocols/present_proof/v2_0/__init__.py index 04d58ea726..28bcbea5aa 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/__init__.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/__init__.py @@ -2,11 +2,7 @@ from ....connections.models.conn_record import ConnRecord from ....core.error import BaseError - -from .messages.pres_problem_report import ( - V20PresProblemReport, - ProblemReportReason, -) +from .messages.pres_problem_report import ProblemReportReason, V20PresProblemReport from .models.pres_exchange import V20PresExRecord 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 a3b5862a5c..7c3fb5815a 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 @@ -2,32 +2,29 @@ import json import logging +from typing import Mapping, Tuple from marshmallow import RAISE -from typing import Mapping, Tuple from ......anoncreds.holder import AnonCredsHolder +from ......anoncreds.util import generate_pr_nonce +from ......anoncreds.verifier import AnonCredsVerifier from ......indy.models.predicate import Predicate from ......indy.models.proof import IndyProofSchema from ......indy.models.proof_request import IndyProofRequestSchema from ......indy.models.xform import indy_proof_req_preview2indy_requested_creds -from ......anoncreds.util import generate_pr_nonce -from ......anoncreds.verifier import AnonCredsVerifier from ......messaging.decorators.attach_decorator import AttachDecorator from ......messaging.util import canon - from ....anoncreds.pres_exch_handler import AnonCredsPresExchHandler - from ...message_types import ( ATTACHMENT_FORMAT, - PRES_20_REQUEST, PRES_20, PRES_20_PROPOSAL, + PRES_20_REQUEST, ) from ...messages.pres import V20Pres from ...messages.pres_format import V20PresFormat from ...models.pres_exchange import V20PresExRecord - from ..handler import V20PresFormatHandler, V20PresFormatHandlerError LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/protocols/present_proof/v2_0/formats/dif/tests/test_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/formats/dif/tests/test_handler.py index 8cb8b891b1..f925a6322c 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/formats/dif/tests/test_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/formats/dif/tests/test_handler.py @@ -1,11 +1,12 @@ from copy import deepcopy from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock -from aries_cloudagent.vc.vc_di.manager import VcDiManager + from marshmallow import ValidationError from pyld import jsonld -from .. import handler as test_module +from aries_cloudagent.tests import mock +from aries_cloudagent.vc.vc_di.manager import VcDiManager + from .......core.in_memory import InMemoryProfile from .......messaging.decorators.attach_decorator import AttachDecorator from .......messaging.responder import BaseResponder, MockResponder @@ -35,6 +36,7 @@ from ....messages.pres_request import V20PresRequest from ....models.pres_exchange import V20PresExRecord from ...handler import V20PresFormatHandlerError +from .. import handler as test_module from ..handler import DIFPresFormatHandler TEST_DID_SOV = "did:sov:LjgpST2rjsoxYegQDRm7EL" 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 1173ddb936..7d0de6467f 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/formats/handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/formats/handler.py @@ -1,14 +1,12 @@ """present-proof-v2 format handler - supports DIF and INDY.""" -from abc import ABC, abstractclassmethod, abstractmethod import logging - +from abc import ABC, abstractclassmethod, abstractmethod from typing import Tuple from .....core.error import BaseError from .....core.profile import Profile from .....messaging.decorators.attach_decorator import AttachDecorator - from ..messages.pres import V20Pres from ..messages.pres_format import V20PresFormat from ..models.pres_exchange import V20PresExRecord diff --git a/aries_cloudagent/protocols/present_proof/v2_0/formats/indy/handler.py b/aries_cloudagent/protocols/present_proof/v2_0/formats/indy/handler.py index abddabecf0..8646c86754 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/formats/indy/handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/formats/indy/handler.py @@ -2,9 +2,9 @@ import json import logging +from typing import Mapping, Tuple from marshmallow import RAISE -from typing import Mapping, Tuple from ......core.profile import Profile from ......indy.holder import IndyHolder @@ -16,19 +16,16 @@ from ......indy.verifier import IndyVerifier from ......messaging.decorators.attach_decorator import AttachDecorator from ......messaging.util import canon - from ....indy.pres_exch_handler import IndyPresExchHandler - from ...message_types import ( ATTACHMENT_FORMAT, - PRES_20_REQUEST, PRES_20, PRES_20_PROPOSAL, + PRES_20_REQUEST, ) from ...messages.pres import V20Pres from ...messages.pres_format import V20PresFormat from ...models.pres_exchange import V20PresExRecord - from ..anoncreds.handler import AnonCredsPresExchangeHandler from ..handler import V20PresFormatHandler, V20PresFormatHandlerError diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_ack_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_ack_handler.py index 2534a65c4f..a793272d70 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_ack_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_ack_handler.py @@ -4,8 +4,7 @@ from .....messaging.base_handler import BaseHandler, HandlerException from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from ..manager import V20PresManager from ..messages.pres_ack import V20PresAck diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_handler.py index 9a93d68cc0..39779408ce 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_handler.py @@ -7,8 +7,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import V20PresManager from ..messages.pres import V20Pres diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_problem_report_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_problem_report_handler.py index 7e9a6a82ab..be4aab8620 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_problem_report_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_problem_report_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError - from ..manager import V20PresManager from ..messages.pres_problem_report import V20PresProblemReport diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_proposal_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_proposal_handler.py index a9bd71cc7a..5e4c0e983e 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_proposal_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_proposal_handler.py @@ -6,8 +6,7 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError -from .....utils.tracing import trace_event, get_timer - +from .....utils.tracing import get_timer, trace_event from .. import problem_report_for_record from ..manager import V20PresManager from ..messages.pres_problem_report import ProblemReportReason diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_request_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_request_handler.py index dfd4b9ac34..f7dbd81276 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_request_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/pres_request_handler.py @@ -9,14 +9,13 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder from .....storage.error import StorageError, StorageNotFoundError -from .....utils.tracing import trace_event, get_timer +from .....utils.tracing import get_timer, trace_event from .....wallet.error import WalletNotFoundError - from .. import problem_report_for_record from ..formats.handler import V20PresFormatHandlerError from ..manager import V20PresManager -from ..messages.pres_request import V20PresRequest from ..messages.pres_problem_report import ProblemReportReason +from ..messages.pres_request import V20PresRequest from ..models.pres_exchange import V20PresExRecord diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_ack_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_ack_handler.py index 57ee46f7ac..41f9de08d6 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_ack_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_ack_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.pres_ack import V20PresAck - from .. import pres_ack_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_handler.py index 03bd117c5d..66ba24fa85 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_handler.py @@ -1,13 +1,12 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.oob_processor import OobMessageProcessor from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.pres import V20Pres - from .. import pres_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_problem_report_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_problem_report_handler.py index 2984b2ec9f..93de1ccb16 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_problem_report_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_problem_report_handler.py @@ -1,12 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - -from ...messages.pres_problem_report import V20PresProblemReport, ProblemReportReason - +from ...messages.pres_problem_report import ProblemReportReason, V20PresProblemReport from .. import pres_problem_report_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_proposal_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_proposal_handler.py index b8de7f3e55..ffc1f780ca 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_proposal_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_proposal_handler.py @@ -1,12 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...messages.pres_proposal import V20PresProposal - from .. import pres_proposal_handler as test_module diff --git a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_request_handler.py b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_request_handler.py index 671f469823..7f6bbd12ca 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_request_handler.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/handlers/tests/test_pres_request_handler.py @@ -1,6 +1,7 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......anoncreds.holder import AnonCredsHolder from ......core.oob_processor import OobMessageProcessor from ......indy.holder import IndyHolder @@ -9,13 +10,10 @@ from ......messaging.responder import MockResponder from ......storage.error import StorageNotFoundError from ......transport.inbound.receipt import MessageReceipt - from ...formats.indy import handler as test_indy_handler - from ...messages.pres_format import V20PresFormat from ...messages.pres_proposal import V20PresProposal from ...messages.pres_request import V20PresRequest - from .. import pres_request_handler as test_module S_ID = "NcYxiDXkpYi6ov5FcYDi1e:2:vidya:1.0" diff --git a/aries_cloudagent/protocols/present_proof/v2_0/message_types.py b/aries_cloudagent/protocols/present_proof/v2_0/message_types.py index dffb446d2a..0d8865103f 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/message_types.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/message_types.py @@ -1,7 +1,6 @@ """Message and inner object type identifiers for present-proof protocol v2.0.""" from ...didcomm_prefix import DIDCommPrefix - from .messages.pres_format import V20PresFormat SPEC_URI = ( diff --git a/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_format.py b/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_format.py index dcdaae3c36..a870bcf02e 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_format.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_format.py @@ -1,8 +1,6 @@ from unittest import TestCase - from ......messaging.decorators.attach_decorator import AttachDecorator - from ..pres_format import V20PresFormat CD_ID = "GMm4vMw8LLrLJjp81kRRLp:3:CL:12:tag" diff --git a/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_problem_report.py b/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_problem_report.py index 7a026ea628..10b197b5e0 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_problem_report.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/messages/tests/test_pres_problem_report.py @@ -1,15 +1,11 @@ -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from ......messaging.models.base import BaseModelError - from .....didcomm_prefix import DIDCommPrefix - from ...message_types import PRES_20_PROBLEM_REPORT, PROTOCOL_PACKAGE - -from ..pres_problem_report import V20PresProblemReport, ProblemReportReason +from ..pres_problem_report import ProblemReportReason, V20PresProblemReport class TestV20PresProblemReport(TestCase): diff --git a/aries_cloudagent/protocols/present_proof/v2_0/models/tests/test_record.py b/aries_cloudagent/protocols/present_proof/v2_0/models/tests/test_record.py index c4bf6d8e67..96ce7573f9 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/models/tests/test_record.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/models/tests/test_record.py @@ -1,14 +1,13 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ......core.in_memory import InMemoryProfile from ......messaging.decorators.attach_decorator import AttachDecorator from ......messaging.models.base_record import BaseExchangeRecord, BaseExchangeSchema - from ...message_types import ATTACHMENT_FORMAT, PRES_20_PROPOSAL from ...messages.pres_format import V20PresFormat from ...messages.pres_proposal import V20PresProposal - from .. import pres_exchange as test_module from ..pres_exchange import V20PresExRecord diff --git a/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py b/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py index 9edef6a3d1..0762691d5c 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py @@ -1,11 +1,10 @@ -from copy import deepcopy import json +from copy import deepcopy from time import time from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from .. import manager as test_module from .....core.in_memory import InMemoryProfile from .....indy.holder import IndyHolder from .....indy.models.pres_preview import ( @@ -29,11 +28,10 @@ from .....vc.vc_ld.manager import VcLdpManager from .....vc.vc_ld.validation_result import PresentationVerificationResult from ...indy import pres_exch_handler as test_indy_util_module +from .. import manager as test_module from ..formats.dif.handler import DIFPresFormatHandler -from ..formats.dif.tests.test_handler import ( - DIF_PRES, - DIF_PRES_REQUEST_B as DIF_PRES_REQ, -) +from ..formats.dif.tests.test_handler import DIF_PRES +from ..formats.dif.tests.test_handler import DIF_PRES_REQUEST_B as DIF_PRES_REQ from ..formats.handler import V20PresFormatHandlerError from ..formats.indy import handler as test_indy_handler from ..manager import V20PresManager, V20PresManagerError diff --git a/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager_anoncreds.py b/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager_anoncreds.py index eb2aae61be..f81023155e 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager_anoncreds.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager_anoncreds.py @@ -1,21 +1,21 @@ import json -import pytest - from copy import deepcopy from time import time +from unittest import IsolatedAsyncioTestCase + +import pytest from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase -from .....core.in_memory import InMemoryProfile from .....anoncreds.holder import AnonCredsHolder -from .....indy.models.xform import indy_proof_req_preview2indy_requested_creds +from .....anoncreds.verifier import AnonCredsVerifier +from .....core.in_memory import InMemoryProfile from .....indy.models.pres_preview import ( IndyPresAttrSpec, - IndyPresPreview, IndyPresPredSpec, + IndyPresPreview, ) -from .....anoncreds.verifier import AnonCredsVerifier +from .....indy.models.xform import indy_proof_req_preview2indy_requested_creds from .....ledger.base import BaseLedger from .....ledger.multiple_ledger.ledger_requests_executor import ( IndyLedgerRequestsExecutor, @@ -25,23 +25,22 @@ from .....multitenant.base import BaseMultitenantManager from .....multitenant.manager import MultitenantManager from .....storage.error import StorageNotFoundError - +from .....vc.ld_proofs import DocumentLoader +from .....vc.tests.document_loader import custom_document_loader +from .....vc.vc_ld.validation_result import PresentationVerificationResult from ...indy import pres_exch_handler as test_indy_util_module - from .. import manager as test_module -from ..formats.handler import V20PresFormatHandlerError from ..formats.dif.handler import DIFPresFormatHandler -from ..formats.dif.tests.test_handler import ( - DIF_PRES_REQUEST_B as DIF_PRES_REQ, - DIF_PRES, -) +from ..formats.dif.tests.test_handler import DIF_PRES +from ..formats.dif.tests.test_handler import DIF_PRES_REQUEST_B as DIF_PRES_REQ +from ..formats.handler import V20PresFormatHandlerError from ..formats.indy import handler as test_indy_handler from ..manager import V20PresManager, V20PresManagerError from ..message_types import ( ATTACHMENT_FORMAT, + PRES_20, PRES_20_PROPOSAL, PRES_20_REQUEST, - PRES_20, ) from ..messages.pres import V20Pres from ..messages.pres_format import V20PresFormat @@ -50,10 +49,6 @@ from ..messages.pres_request import V20PresRequest from ..models.pres_exchange import V20PresExRecord -from .....vc.vc_ld.validation_result import PresentationVerificationResult -from .....vc.tests.document_loader import custom_document_loader -from .....vc.ld_proofs import DocumentLoader - CONN_ID = "connection_id" ISSUER_DID = "NcYxiDXkpYi6ov5FcYDi1e" S_ID = f"{ISSUER_DID}:2:vidya:1.0" diff --git a/aries_cloudagent/protocols/problem_report/v1_0/handler.py b/aries_cloudagent/protocols/problem_report/v1_0/handler.py index 33a5c793e4..c4253782c6 100644 --- a/aries_cloudagent/protocols/problem_report/v1_0/handler.py +++ b/aries_cloudagent/protocols/problem_report/v1_0/handler.py @@ -1,11 +1,6 @@ """Generic problem report handler.""" -from ....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) - +from ....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from .message import ProblemReport diff --git a/aries_cloudagent/protocols/problem_report/v1_0/tests/test_handler.py b/aries_cloudagent/protocols/problem_report/v1_0/tests/test_handler.py index 85d35137d4..dca10f9525 100644 --- a/aries_cloudagent/protocols/problem_report/v1_0/tests/test_handler.py +++ b/aries_cloudagent/protocols/problem_report/v1_0/tests/test_handler.py @@ -4,7 +4,6 @@ from .....messaging.request_context import RequestContext from .....messaging.responder import MockResponder from .....transport.inbound.receipt import MessageReceipt - from ..handler import ProblemReportHandler from ..message import ProblemReport diff --git a/aries_cloudagent/protocols/problem_report/v1_0/tests/test_message.py b/aries_cloudagent/protocols/problem_report/v1_0/tests/test_message.py index c9f586533e..f7ac2064bc 100644 --- a/aries_cloudagent/protocols/problem_report/v1_0/tests/test_message.py +++ b/aries_cloudagent/protocols/problem_report/v1_0/tests/test_message.py @@ -1,14 +1,11 @@ -import pytest +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest from .....messaging.models.base import BaseModelError - from ....didcomm_prefix import DIDCommPrefix - -from ..message_types import PROBLEM_REPORT from ..message import ProblemReport, ProblemReportSchema +from ..message_types import PROBLEM_REPORT class TestProblemReport(TestCase): diff --git a/aries_cloudagent/protocols/revocation_notification/v1_0/message_types.py b/aries_cloudagent/protocols/revocation_notification/v1_0/message_types.py index 36106e3029..4bd96b2429 100644 --- a/aries_cloudagent/protocols/revocation_notification/v1_0/message_types.py +++ b/aries_cloudagent/protocols/revocation_notification/v1_0/message_types.py @@ -2,7 +2,6 @@ from ...didcomm_prefix import DIDCommPrefix - SPEC_URI = ( "https://github.com/hyperledger/aries-rfcs/blob/main/features/" "0183-revocation-notification/README.md" diff --git a/aries_cloudagent/protocols/revocation_notification/v2_0/message_types.py b/aries_cloudagent/protocols/revocation_notification/v2_0/message_types.py index 4033d5c8b7..c1e73a5220 100644 --- a/aries_cloudagent/protocols/revocation_notification/v2_0/message_types.py +++ b/aries_cloudagent/protocols/revocation_notification/v2_0/message_types.py @@ -2,7 +2,6 @@ from ...didcomm_prefix import DIDCommPrefix - SPEC_URI = ( "https://github.com/hyperledger/aries-rfcs/blob/main/features/" "0721-revocation-notification-v2/README.md" diff --git a/aries_cloudagent/protocols/routing/v1_0/handlers/tests/test_forward_handler.py b/aries_cloudagent/protocols/routing/v1_0/handlers/tests/test_forward_handler.py index 6daade22c9..972479f025 100644 --- a/aries_cloudagent/protocols/routing/v1_0/handlers/tests/test_forward_handler.py +++ b/aries_cloudagent/protocols/routing/v1_0/handlers/tests/test_forward_handler.py @@ -1,16 +1,15 @@ +import json from unittest import IsolatedAsyncioTestCase + from aries_cloudagent.tests import mock -import json from ......connections.models.connection_target import ConnectionTarget from ......messaging.base_handler import HandlerException from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - -from ...models.route_record import RouteRecord from ...messages.forward import Forward - +from ...models.route_record import RouteRecord from .. import forward_handler as test_module TEST_CONN_ID = "conn-id" diff --git a/aries_cloudagent/protocols/routing/v1_0/manager.py b/aries_cloudagent/protocols/routing/v1_0/manager.py index a5fe48c924..67b80839fa 100644 --- a/aries_cloudagent/protocols/routing/v1_0/manager.py +++ b/aries_cloudagent/protocols/routing/v1_0/manager.py @@ -6,14 +6,9 @@ from ....core.error import BaseError from ....core.profile import Profile -from ....storage.error import ( - StorageDuplicateError, - StorageNotFoundError, -) - +from ....storage.error import StorageDuplicateError, StorageNotFoundError from .models.route_record import RouteRecord - LOGGER = logging.getLogger(__name__) RECIP_ROUTE_PAUSE = 0.1 diff --git a/aries_cloudagent/protocols/routing/v1_0/messages/tests/test_forward.py b/aries_cloudagent/protocols/routing/v1_0/messages/tests/test_forward.py index 833622ebde..092b4f7d4e 100644 --- a/aries_cloudagent/protocols/routing/v1_0/messages/tests/test_forward.py +++ b/aries_cloudagent/protocols/routing/v1_0/messages/tests/test_forward.py @@ -1,10 +1,7 @@ import json - -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import FORWARD, PROTOCOL_PACKAGE from ..forward import Forward, ForwardSchema diff --git a/aries_cloudagent/protocols/routing/v1_0/models/tests/test_route_record.py b/aries_cloudagent/protocols/routing/v1_0/models/tests/test_route_record.py index 22846bcd3d..8f981ab2d4 100644 --- a/aries_cloudagent/protocols/routing/v1_0/models/tests/test_route_record.py +++ b/aries_cloudagent/protocols/routing/v1_0/models/tests/test_route_record.py @@ -1,4 +1,5 @@ from unittest import IsolatedAsyncioTestCase + from marshmallow.exceptions import ValidationError from ..route_record import RouteRecordSchema diff --git a/aries_cloudagent/protocols/routing/v1_0/tests/test_routing_manager.py b/aries_cloudagent/protocols/routing/v1_0/tests/test_routing_manager.py index 2f6ae835f4..e005391b18 100644 --- a/aries_cloudagent/protocols/routing/v1_0/tests/test_routing_manager.py +++ b/aries_cloudagent/protocols/routing/v1_0/tests/test_routing_manager.py @@ -1,16 +1,13 @@ from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock from marshmallow import ValidationError +from aries_cloudagent.tests import mock + from .....messaging.request_context import RequestContext -from .....storage.error import ( - StorageDuplicateError, - StorageNotFoundError, -) +from .....storage.error import StorageDuplicateError, StorageNotFoundError from .....transport.inbound.receipt import MessageReceipt - -from ..manager import RoutingManager, RoutingManagerError, RouteNotFoundError +from ..manager import RouteNotFoundError, RoutingManager, RoutingManagerError from ..models.route_record import RouteRecord, RouteRecordSchema TEST_CONN_ID = "conn-id" diff --git a/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_handler.py b/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_handler.py index 7963109e43..d8df9b96ed 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_handler.py +++ b/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_handler.py @@ -1,11 +1,6 @@ """Ping handler.""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) - +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ..messages.ping import Ping from ..messages.ping_response import PingResponse diff --git a/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_response_handler.py b/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_response_handler.py index c66c68158a..dacf3b5eba 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_response_handler.py +++ b/aries_cloudagent/protocols/trustping/v1_0/handlers/ping_response_handler.py @@ -1,11 +1,6 @@ """Ping response handler.""" -from .....messaging.base_handler import ( - BaseHandler, - BaseResponder, - RequestContext, -) - +from .....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ..messages.ping_response import PingResponse diff --git a/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_handler.py b/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_handler.py index ccf75fdfa7..cff9186181 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_handler.py +++ b/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_handler.py @@ -3,7 +3,6 @@ from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers.ping_handler import PingHandler from ...messages.ping import Ping from ...messages.ping_response import PingResponse diff --git a/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_response_handler.py b/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_response_handler.py index 5cb29c6f7b..40793af26f 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_response_handler.py +++ b/aries_cloudagent/protocols/trustping/v1_0/handlers/tests/test_ping_response_handler.py @@ -3,7 +3,6 @@ from ......messaging.request_context import RequestContext from ......messaging.responder import MockResponder from ......transport.inbound.receipt import MessageReceipt - from ...handlers.ping_response_handler import PingResponseHandler from ...messages.ping_response import PingResponse diff --git a/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping.py b/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping.py index 8e200f3edb..90c8d51fcd 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping.py +++ b/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping.py @@ -1,10 +1,6 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import PING from ..ping import Ping diff --git a/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping_reponse.py b/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping_reponse.py index 3a6bd7cbf6..d7c1f41191 100644 --- a/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping_reponse.py +++ b/aries_cloudagent/protocols/trustping/v1_0/messages/tests/test_trust_ping_reponse.py @@ -1,10 +1,6 @@ -from unittest import mock -from unittest import TestCase - -from unittest import IsolatedAsyncioTestCase +from unittest import IsolatedAsyncioTestCase, TestCase, mock from .....didcomm_prefix import DIDCommPrefix - from ...message_types import PING_RESPONSE from ..ping_response import PingResponse diff --git a/aries_cloudagent/resolver/default/jwk.py b/aries_cloudagent/resolver/default/jwk.py index ba1bc71393..badccdbba7 100644 --- a/aries_cloudagent/resolver/default/jwk.py +++ b/aries_cloudagent/resolver/default/jwk.py @@ -2,9 +2,10 @@ import re from typing import Optional, Pattern, Sequence, Text + from aries_cloudagent.config.injection_context import InjectionContext from aries_cloudagent.core.profile import Profile -from aries_cloudagent.resolver.base import BaseDIDResolver, ResolverType, ResolverError +from aries_cloudagent.resolver.base import BaseDIDResolver, ResolverError, ResolverType from aries_cloudagent.wallet.jwt import b64_to_dict diff --git a/aries_cloudagent/resolver/default/key.py b/aries_cloudagent/resolver/default/key.py index 0217156f81..7a70046ba3 100644 --- a/aries_cloudagent/resolver/default/key.py +++ b/aries_cloudagent/resolver/default/key.py @@ -5,11 +5,10 @@ from typing import Optional, Pattern, Sequence, Text -from ...did.did_key import DIDKey from ...config.injection_context import InjectionContext from ...core.profile import Profile +from ...did.did_key import DIDKey from ...messaging.valid import DIDKey as DIDKeyType - from ..base import BaseDIDResolver, DIDNotFound, ResolverType diff --git a/aries_cloudagent/resolver/default/legacy_peer.py b/aries_cloudagent/resolver/default/legacy_peer.py index a3fbad9848..e34b5178b3 100644 --- a/aries_cloudagent/resolver/default/legacy_peer.py +++ b/aries_cloudagent/resolver/default/legacy_peer.py @@ -3,9 +3,9 @@ Resolution is performed by looking up a stored DID Document. """ +import logging from copy import deepcopy from dataclasses import asdict, dataclass -import logging from typing import List, Optional, Sequence, Text, Union from pydid import DID @@ -20,7 +20,6 @@ from ...wallet.key_type import ED25519 from ..base import BaseDIDResolver, DIDNotFound, ResolverType - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/resolver/default/peer1.py b/aries_cloudagent/resolver/default/peer1.py index 840581ea87..9df6ee5e29 100644 --- a/aries_cloudagent/resolver/default/peer1.py +++ b/aries_cloudagent/resolver/default/peer1.py @@ -12,7 +12,6 @@ from ...resolver.base import BaseDIDResolver, DIDNotFound, ResolverType from ...storage.error import StorageNotFoundError - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/resolver/default/peer2.py b/aries_cloudagent/resolver/default/peer2.py index aa2b41cd1c..7f5536f66d 100644 --- a/aries_cloudagent/resolver/default/peer2.py +++ b/aries_cloudagent/resolver/default/peer2.py @@ -5,7 +5,7 @@ from typing import Optional, Pattern, Sequence, Text -from did_peer_2 import resolve, PATTERN +from did_peer_2 import PATTERN, resolve from ...config.injection_context import InjectionContext from ...core.profile import Profile diff --git a/aries_cloudagent/resolver/default/peer3.py b/aries_cloudagent/resolver/default/peer3.py index 63c81b95f4..3a16dc7a44 100644 --- a/aries_cloudagent/resolver/default/peer3.py +++ b/aries_cloudagent/resolver/default/peer3.py @@ -8,7 +8,8 @@ import re from typing import Optional, Pattern, Sequence, Text -from did_peer_2 import PATTERN as PEER2_PATTERN, PEER3_PATTERN, peer2to3, resolve_peer3 +from did_peer_2 import PATTERN as PEER2_PATTERN +from did_peer_2 import PEER3_PATTERN, peer2to3, resolve_peer3 from ...config.injection_context import InjectionContext from ...core.event_bus import Event, EventBus @@ -18,7 +19,6 @@ from ...storage.record import StorageRecord from ..base import BaseDIDResolver, DIDNotFound, ResolverType - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/resolver/default/tests/test_indy.py b/aries_cloudagent/resolver/default/tests/test_indy.py index 60c6ada8c8..4c234242e6 100644 --- a/aries_cloudagent/resolver/default/tests/test_indy.py +++ b/aries_cloudagent/resolver/default/tests/test_indy.py @@ -14,7 +14,6 @@ from ....messaging.valid import IndyDID from ....multitenant.base import BaseMultitenantManager from ....multitenant.manager import MultitenantManager - from ...base import DIDNotFound, ResolverError from ..indy import IndyDIDResolver, _routing_keys_as_did_key_urls diff --git a/aries_cloudagent/resolver/default/tests/test_jwk.py b/aries_cloudagent/resolver/default/tests/test_jwk.py index 9298c41d51..12a880950c 100644 --- a/aries_cloudagent/resolver/default/tests/test_jwk.py +++ b/aries_cloudagent/resolver/default/tests/test_jwk.py @@ -4,7 +4,6 @@ from ....core.in_memory import InMemoryProfile from ....core.profile import Profile - from ...base import DIDMethodNotSupported from ..jwk import JwkDIDResolver diff --git a/aries_cloudagent/resolver/default/tests/test_key.py b/aries_cloudagent/resolver/default/tests/test_key.py index 2ec6587006..4aa190ad88 100644 --- a/aries_cloudagent/resolver/default/tests/test_key.py +++ b/aries_cloudagent/resolver/default/tests/test_key.py @@ -5,7 +5,6 @@ from ....core.in_memory import InMemoryProfile from ....core.profile import Profile from ....messaging.valid import DIDKey - from ...base import DIDNotFound from ..key import KeyDIDResolver diff --git a/aries_cloudagent/resolver/default/tests/test_legacy_peer.py b/aries_cloudagent/resolver/default/tests/test_legacy_peer.py index e26478a43e..7e27470c2b 100644 --- a/aries_cloudagent/resolver/default/tests/test_legacy_peer.py +++ b/aries_cloudagent/resolver/default/tests/test_legacy_peer.py @@ -1,19 +1,19 @@ """Test LegacyPeerDIDResolver.""" -from aries_cloudagent.tests import mock import pydid import pytest -from .. import legacy_peer as test_module +from aries_cloudagent.tests import mock + from ....cache.base import BaseCache from ....cache.in_memory import InMemoryCache from ....connections.models.diddoc.diddoc import DIDDoc from ....core.in_memory import InMemoryProfile from ....core.profile import Profile from ....storage.error import StorageNotFoundError +from .. import legacy_peer as test_module from ..legacy_peer import LegacyPeerDIDResolver - TEST_DID0 = "did:sov:WgWxqztrNooG92RXvxSTWv" TEST_DID1 = "did:example:abc123" TEST_DID2 = "did:sov:5No7f9KvpsfSqd6xsGxABh" diff --git a/aries_cloudagent/resolver/default/tests/test_peer2.py b/aries_cloudagent/resolver/default/tests/test_peer2.py index 01a5c57245..2416e706d5 100644 --- a/aries_cloudagent/resolver/default/tests/test_peer2.py +++ b/aries_cloudagent/resolver/default/tests/test_peer2.py @@ -6,7 +6,6 @@ from ....core.profile import Profile from ..peer2 import PeerDID2Resolver - TEST_DID0 = "did:peer:2.Ez6LSpkcni2KTTxf4nAp6cPxjRbu26Tj4b957BgHcknVeNFEj.Vz6MksXhfmxm2i3RnoHH2mKQcx7EY4tToJR9JziUs6bp8a6FM.SeyJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJzIjoiaHR0cDovL2hvc3QuZG9ja2VyLmludGVybmFsOjkwNzAiLCJyZWNpcGllbnRfa2V5cyI6W119" diff --git a/aries_cloudagent/resolver/default/tests/test_peer3.py b/aries_cloudagent/resolver/default/tests/test_peer3.py index 431c17ffbc..9cdf949d10 100644 --- a/aries_cloudagent/resolver/default/tests/test_peer3.py +++ b/aries_cloudagent/resolver/default/tests/test_peer3.py @@ -1,17 +1,16 @@ """Test PeerDIDResolver.""" import pytest -from aries_cloudagent.connections.models.conn_record import ConnRecord +from did_peer_2 import peer2to3 +from aries_cloudagent.connections.models.conn_record import ConnRecord from aries_cloudagent.core.event_bus import EventBus -from .. import peer3 as test_module from ....core.in_memory import InMemoryProfile from ....core.profile import Profile +from .. import peer3 as test_module from ..peer2 import PeerDID2Resolver from ..peer3 import PeerDID3Resolver -from did_peer_2 import peer2to3 - TEST_DP2 = "did:peer:2.Ez6LSpkcni2KTTxf4nAp6cPxjRbu26Tj4b957BgHcknVeNFEj.Vz6MksXhfmxm2i3RnoHH2mKQcx7EY4tToJR9JziUs6bp8a6FM.SeyJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJzIjoiaHR0cDovL2hvc3QuZG9ja2VyLmludGVybmFsOjkwNzAiLCJyZWNpcGllbnRfa2V5cyI6W119" diff --git a/aries_cloudagent/resolver/default/tests/test_universal.py b/aries_cloudagent/resolver/default/tests/test_universal.py index 5e45b9a044..ab7a353d1b 100644 --- a/aries_cloudagent/resolver/default/tests/test_universal.py +++ b/aries_cloudagent/resolver/default/tests/test_universal.py @@ -3,14 +3,14 @@ import re from typing import Dict, Union -from aries_cloudagent.tests import mock import pytest +from aries_cloudagent.tests import mock + from ....config.settings import Settings from ....core.in_memory import InMemoryProfile - -from .. import universal as test_module from ...base import DIDNotFound, ResolverError +from .. import universal as test_module from ..universal import UniversalResolver diff --git a/aries_cloudagent/resolver/default/tests/test_web.py b/aries_cloudagent/resolver/default/tests/test_web.py index 3ff7098d75..9106649cee 100644 --- a/aries_cloudagent/resolver/default/tests/test_web.py +++ b/aries_cloudagent/resolver/default/tests/test_web.py @@ -1,6 +1,7 @@ """Test did:web Resolver.""" import pytest + from ..web import WebDIDResolver diff --git a/aries_cloudagent/resolver/default/universal.py b/aries_cloudagent/resolver/default/universal.py index 2efee46009..4d359a9a6e 100644 --- a/aries_cloudagent/resolver/default/universal.py +++ b/aries_cloudagent/resolver/default/universal.py @@ -2,7 +2,7 @@ import logging import re -from typing import Iterable, Optional, Pattern, Sequence, Union, Text +from typing import Iterable, Optional, Pattern, Sequence, Text, Union import aiohttp diff --git a/aries_cloudagent/resolver/default/web.py b/aries_cloudagent/resolver/default/web.py index 9fdf1b09de..0fd52fc506 100644 --- a/aries_cloudagent/resolver/default/web.py +++ b/aries_cloudagent/resolver/default/web.py @@ -1,23 +1,15 @@ """Web DID Resolver.""" import urllib.parse - from typing import Optional, Pattern, Sequence, Text import aiohttp - from pydid import DID, DIDDocument from ...config.injection_context import InjectionContext from ...core.profile import Profile from ...messaging.valid import DIDWeb - -from ..base import ( - BaseDIDResolver, - DIDNotFound, - ResolverError, - ResolverType, -) +from ..base import BaseDIDResolver, DIDNotFound, ResolverError, ResolverType class WebDIDResolver(BaseDIDResolver): diff --git a/aries_cloudagent/resolver/did_resolver.py b/aries_cloudagent/resolver/did_resolver.py index ee8f9f419b..c32337f4ce 100644 --- a/aries_cloudagent/resolver/did_resolver.py +++ b/aries_cloudagent/resolver/did_resolver.py @@ -5,13 +5,13 @@ """ import asyncio +import logging from datetime import datetime, timezone from itertools import chain -import logging from typing import List, Optional, Sequence, Text, Tuple, Union -from pydid import DID, DIDError, DIDUrl, Resource, VerificationMethod import pydid +from pydid import DID, DIDError, DIDUrl, Resource, VerificationMethod from pydid.doc.doc import BaseDIDDocument, IDNotFoundError from ..core.profile import Profile diff --git a/aries_cloudagent/resolver/tests/test_base.py b/aries_cloudagent/resolver/tests/test_base.py index 5d3a77e159..3412e17c6c 100644 --- a/aries_cloudagent/resolver/tests/test_base.py +++ b/aries_cloudagent/resolver/tests/test_base.py @@ -1,9 +1,9 @@ """Test Base DID Resolver methods.""" -import pytest import re - from unittest import mock + +import pytest from pydid import DIDDocument from ..base import BaseDIDResolver, DIDMethodNotSupported, ResolverType diff --git a/aries_cloudagent/resolver/tests/test_did_resolver.py b/aries_cloudagent/resolver/tests/test_did_resolver.py index 26d984a12b..c8a964c0f9 100644 --- a/aries_cloudagent/resolver/tests/test_did_resolver.py +++ b/aries_cloudagent/resolver/tests/test_did_resolver.py @@ -1,12 +1,10 @@ """Test did resolver registry.""" -from typing import Pattern - import re +from typing import Pattern import pytest - -from pydid import DID, DIDDocument, VerificationMethod, BasicDIDDocument +from pydid import DID, BasicDIDDocument, DIDDocument, VerificationMethod from ...core.in_memory import InMemoryProfile from ..base import ( @@ -18,7 +16,6 @@ ResolverType, ) from ..did_resolver import DIDResolver - from . import DOC TEST_DID0 = "did:sov:Kkyqu7CJFuQSvBp468uaDe" diff --git a/aries_cloudagent/revocation/manager.py b/aries_cloudagent/revocation/manager.py index e90b1faa63..00479c3c08 100644 --- a/aries_cloudagent/revocation/manager.py +++ b/aries_cloudagent/revocation/manager.py @@ -11,9 +11,7 @@ from ..protocols.issue_credential.v1_0.models.credential_exchange import ( V10CredentialExchange, ) -from ..protocols.issue_credential.v2_0.models.cred_ex_record import ( - V20CredExRecord, -) +from ..protocols.issue_credential.v2_0.models.cred_ex_record import V20CredExRecord from ..protocols.revocation_notification.v1_0.models.rev_notification_record import ( RevNotificationRecord, ) diff --git a/aries_cloudagent/revocation/models/revocation_registry.py b/aries_cloudagent/revocation/models/revocation_registry.py index 24665faece..05528c445a 100644 --- a/aries_cloudagent/revocation/models/revocation_registry.py +++ b/aries_cloudagent/revocation/models/revocation_registry.py @@ -1,21 +1,19 @@ """Classes for managing a revocation registry.""" +import hashlib import http import logging import os import re - from os.path import join from pathlib import Path +import base58 from requests import Session from requests.exceptions import RequestException from ...indy.util import indy_client_dir - from ..error import RevocationError -import hashlib -import base58 LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/revocation/models/tests/test_revocation_registry.py b/aries_cloudagent/revocation/models/tests/test_revocation_registry.py index c6b2af5970..e500074071 100644 --- a/aries_cloudagent/revocation/models/tests/test_revocation_registry.py +++ b/aries_cloudagent/revocation/models/tests/test_revocation_registry.py @@ -1,19 +1,14 @@ -from unittest import mock -from unittest import IsolatedAsyncioTestCase from copy import deepcopy from pathlib import Path from shutil import rmtree +from unittest import IsolatedAsyncioTestCase, mock import base58 from ....indy.util import indy_client_dir - from ...error import RevocationError - -from ..revocation_registry import RevocationRegistry - from .. import revocation_registry as test_module - +from ..revocation_registry import RevocationRegistry TEST_DID = "FkjWznKwA4N1JEp2iPiKPG" CRED_DEF_ID = f"{TEST_DID}:3:CL:12:tag1" diff --git a/aries_cloudagent/revocation/recover.py b/aries_cloudagent/revocation/recover.py index 7643d53119..52f3a53a89 100644 --- a/aries_cloudagent/revocation/recover.py +++ b/aries_cloudagent/revocation/recover.py @@ -9,7 +9,6 @@ import aiohttp import base58 - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/revocation_anoncreds/manager.py b/aries_cloudagent/revocation_anoncreds/manager.py index 1b81136731..11d67f697b 100644 --- a/aries_cloudagent/revocation_anoncreds/manager.py +++ b/aries_cloudagent/revocation_anoncreds/manager.py @@ -14,9 +14,7 @@ from ..protocols.revocation_notification.v1_0.models.rev_notification_record import ( RevNotificationRecord, ) -from ..revocation.util import ( - notify_pending_cleared_event, -) +from ..revocation.util import notify_pending_cleared_event from ..storage.error import StorageNotFoundError from .models.issuer_cred_rev_record import IssuerCredRevRecord diff --git a/aries_cloudagent/revocation_anoncreds/models/issuer_cred_rev_record.py b/aries_cloudagent/revocation_anoncreds/models/issuer_cred_rev_record.py index 8a6aa3475c..8d8a9d0639 100644 --- a/aries_cloudagent/revocation_anoncreds/models/issuer_cred_rev_record.py +++ b/aries_cloudagent/revocation_anoncreds/models/issuer_cred_rev_record.py @@ -6,9 +6,7 @@ from ...core.profile import ProfileSession from ...messaging.models.base_record import BaseRecord, BaseRecordSchema -from ...messaging.valid import ( - UUID4_EXAMPLE, -) +from ...messaging.valid import UUID4_EXAMPLE class IssuerCredRevRecord(BaseRecord): diff --git a/aries_cloudagent/revocation_anoncreds/recover.py b/aries_cloudagent/revocation_anoncreds/recover.py index b77a4474db..9ef27d5683 100644 --- a/aries_cloudagent/revocation_anoncreds/recover.py +++ b/aries_cloudagent/revocation_anoncreds/recover.py @@ -9,7 +9,6 @@ import aiohttp import base58 - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/revocation_anoncreds/tests/test_manager.py b/aries_cloudagent/revocation_anoncreds/tests/test_manager.py index 827c5aaa86..187ba9953d 100644 --- a/aries_cloudagent/revocation_anoncreds/tests/test_manager.py +++ b/aries_cloudagent/revocation_anoncreds/tests/test_manager.py @@ -1,24 +1,21 @@ import json +from unittest import IsolatedAsyncioTestCase import pytest -from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from aries_cloudagent.revocation.models.issuer_cred_rev_record import ( IssuerCredRevRecord, ) +from aries_cloudagent.tests import mock -from ...core.in_memory import InMemoryProfile from ...anoncreds.issuer import AnonCredsIssuer +from ...core.in_memory import InMemoryProfile from ...protocols.issue_credential.v1_0.models.credential_exchange import ( V10CredentialExchange, ) from ...protocols.issue_credential.v2_0.models.cred_ex_record import V20CredExRecord - - -from ..manager import RevocationManager, RevocationManagerError - from .. import manager as test_module +from ..manager import RevocationManager, RevocationManagerError TEST_DID = "LjgpST2rjsoxYegQDRm7EL" SCHEMA_NAME = "bc-reg" diff --git a/aries_cloudagent/storage/tests/conftest.py b/aries_cloudagent/storage/tests/conftest.py index ea37361764..024dbf4667 100644 --- a/aries_cloudagent/storage/tests/conftest.py +++ b/aries_cloudagent/storage/tests/conftest.py @@ -1,4 +1,5 @@ import pytest + from ...storage.record import StorageRecord diff --git a/aries_cloudagent/storage/tests/test_askar_storage.py b/aries_cloudagent/storage/tests/test_askar_storage.py index 8610f98f39..acfe4cc5dd 100644 --- a/aries_cloudagent/storage/tests/test_askar_storage.py +++ b/aries_cloudagent/storage/tests/test_askar_storage.py @@ -1,20 +1,18 @@ import json -import pytest import os +from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock +import pytest -from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock from ...askar.profile import AskarProfileManager from ...config.injection_context import InjectionContext - +from .. import askar as test_module from ..askar import AskarStorage from ..base import BaseStorage from ..error import StorageError, StorageSearchError from ..record import StorageRecord -from .. import askar as test_module - from . import test_in_memory_storage diff --git a/aries_cloudagent/storage/vc_holder/tests/conftest.py b/aries_cloudagent/storage/vc_holder/tests/conftest.py index 62ed6f92f6..cb1f5a658b 100644 --- a/aries_cloudagent/storage/vc_holder/tests/conftest.py +++ b/aries_cloudagent/storage/vc_holder/tests/conftest.py @@ -1,6 +1,7 @@ """Fixtures for vc holder tests.""" import pytest + from ..vc_record import VCRecord VC_CONTEXT = "https://www.w3.org/2018/credentials/v1" diff --git a/aries_cloudagent/storage/vc_holder/tests/test_askar_vc_holder.py b/aries_cloudagent/storage/vc_holder/tests/test_askar_vc_holder.py index 468726da54..f5228bb5d0 100644 --- a/aries_cloudagent/storage/vc_holder/tests/test_askar_vc_holder.py +++ b/aries_cloudagent/storage/vc_holder/tests/test_askar_vc_holder.py @@ -1,12 +1,9 @@ import pytest - from ....askar.profile import AskarProfileManager from ....config.injection_context import InjectionContext - from ..base import VCHolder from ..vc_record import VCRecord - from . import test_in_memory_vc_holder as in_memory diff --git a/aries_cloudagent/storage/vc_holder/tests/test_in_memory_vc_holder.py b/aries_cloudagent/storage/vc_holder/tests/test_in_memory_vc_holder.py index c74178a776..ea764826ed 100644 --- a/aries_cloudagent/storage/vc_holder/tests/test_in_memory_vc_holder.py +++ b/aries_cloudagent/storage/vc_holder/tests/test_in_memory_vc_holder.py @@ -2,11 +2,9 @@ from ....core.in_memory import InMemoryProfile from ...error import StorageDuplicateError, StorageNotFoundError - from ..base import VCHolder from ..vc_record import VCRecord - VC_CONTEXT = "https://www.w3.org/2018/credentials/v1" VC_TYPE = "https://www.w3.org/2018/credentials#VerifiableCredential" VC_SUBJECT_ID = "did:example:ebfeb1f712ebc6f1c276e12ec21" diff --git a/aries_cloudagent/storage/vc_holder/tests/test_vc_record.py b/aries_cloudagent/storage/vc_holder/tests/test_vc_record.py index 33dcd061bb..383ce6eb78 100644 --- a/aries_cloudagent/storage/vc_holder/tests/test_vc_record.py +++ b/aries_cloudagent/storage/vc_holder/tests/test_vc_record.py @@ -3,10 +3,8 @@ import pytest from ....messaging.models.base import BaseModelError - from ..vc_record import VCRecord - sample_json_cred_1 = """ { "@context": ["https://www.w3.org/2018/credentials/v1"], diff --git a/aries_cloudagent/storage/vc_holder/xform.py b/aries_cloudagent/storage/vc_holder/xform.py index 1254fd1e83..738ce44ae1 100644 --- a/aries_cloudagent/storage/vc_holder/xform.py +++ b/aries_cloudagent/storage/vc_holder/xform.py @@ -3,7 +3,6 @@ import json from ...storage.record import StorageRecord - from .vc_record import VCRecord VC_CRED_RECORD_TYPE = "vc_cred" diff --git a/aries_cloudagent/tails/anoncreds_tails_server.py b/aries_cloudagent/tails/anoncreds_tails_server.py index 2e7675b96b..f0f794b42a 100644 --- a/aries_cloudagent/tails/anoncreds_tails_server.py +++ b/aries_cloudagent/tails/anoncreds_tails_server.py @@ -1,16 +1,13 @@ """AnonCreds tails server interface class.""" import logging - from typing import Tuple from ..config.injection_context import InjectionContext -from ..utils.http import put_file, PutError - +from ..utils.http import PutError, put_file from .base import BaseTailsServer from .error import TailsServerNotConfiguredError - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/tails/indy_tails_server.py b/aries_cloudagent/tails/indy_tails_server.py index c41840786f..88617e521b 100644 --- a/aries_cloudagent/tails/indy_tails_server.py +++ b/aries_cloudagent/tails/indy_tails_server.py @@ -1,18 +1,15 @@ """Indy tails server interface class.""" import logging - from typing import Tuple from ..config.injection_context import InjectionContext from ..ledger.base import BaseLedger from ..ledger.multiple_ledger.base_manager import BaseMultipleLedgerManager -from ..utils.http import put_file, PutError - +from ..utils.http import PutError, put_file from .base import BaseTailsServer from .error import TailsServerNotConfiguredError - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/tails/tests/test_indy.py b/aries_cloudagent/tails/tests/test_indy.py index 040fb7d40e..dec660e2b2 100644 --- a/aries_cloudagent/tails/tests/test_indy.py +++ b/aries_cloudagent/tails/tests/test_indy.py @@ -1,11 +1,11 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase +from aries_cloudagent.tests import mock + from ...config.injection_context import InjectionContext from ...core.in_memory import InMemoryProfile from ...ledger.base import BaseLedger from ...ledger.multiple_ledger.base_manager import BaseMultipleLedgerManager - from .. import indy_tails_server as test_module TEST_DID = "55GkHamhTU1ZbTbV2ab9DE" diff --git a/aries_cloudagent/tests/mock.py b/aries_cloudagent/tests/mock.py index 4948274cdb..1ca77c2253 100644 --- a/aries_cloudagent/tests/mock.py +++ b/aries_cloudagent/tests/mock.py @@ -1,6 +1,6 @@ """Mock utilities.""" -from unittest.mock import AsyncMock, MagicMock, patch, create_autospec, Mock, ANY +from unittest.mock import ANY, AsyncMock, MagicMock, Mock, create_autospec, patch def CoroutineMock(*args, **kwargs): diff --git a/aries_cloudagent/tests/test_main.py b/aries_cloudagent/tests/test_main.py index 70c0589d43..897d1b21db 100644 --- a/aries_cloudagent/tests/test_main.py +++ b/aries_cloudagent/tests/test_main.py @@ -1,5 +1,4 @@ -from unittest import mock -from unittest import TestCase +from unittest import TestCase, mock from .. import __main__ as test_module diff --git a/aries_cloudagent/transport/inbound/receipt.py b/aries_cloudagent/transport/inbound/receipt.py index 9031772577..5c68d43386 100644 --- a/aries_cloudagent/transport/inbound/receipt.py +++ b/aries_cloudagent/transport/inbound/receipt.py @@ -2,6 +2,7 @@ from datetime import datetime from typing import Optional + from ...messaging.base_message import DIDCommVersion diff --git a/aries_cloudagent/transport/inbound/session.py b/aries_cloudagent/transport/inbound/session.py index 5bfadb5aec..dee7441981 100644 --- a/aries_cloudagent/transport/inbound/session.py +++ b/aries_cloudagent/transport/inbound/session.py @@ -8,11 +8,9 @@ from ...core.profile import Profile from ...messaging.responder import BaseResponder from ...multitenant.base import BaseMultitenantManager - from ..error import WireFormatError from ..outbound.message import OutboundMessage from ..wire_format import BaseWireFormat - from .message import InboundMessage from .receipt import MessageReceipt diff --git a/aries_cloudagent/transport/inbound/tests/test_delivery_queue.py b/aries_cloudagent/transport/inbound/tests/test_delivery_queue.py index e60ddcfcea..f74a5cdf09 100644 --- a/aries_cloudagent/transport/inbound/tests/test_delivery_queue.py +++ b/aries_cloudagent/transport/inbound/tests/test_delivery_queue.py @@ -2,7 +2,6 @@ from ....connections.models.connection_target import ConnectionTarget from ....transport.outbound.message import OutboundMessage - from ..delivery_queue import DeliveryQueue diff --git a/aries_cloudagent/transport/inbound/tests/test_http_transport.py b/aries_cloudagent/transport/inbound/tests/test_http_transport.py index 702b4faad2..bca3b4beb2 100644 --- a/aries_cloudagent/transport/inbound/tests/test_http_transport.py +++ b/aries_cloudagent/transport/inbound/tests/test_http_transport.py @@ -1,20 +1,19 @@ import asyncio -import pytest import json +import pytest from aiohttp.test_utils import AioHTTPTestCase, unused_port + from aries_cloudagent.tests import mock from ....core.in_memory import InMemoryProfile from ....core.profile import Profile - from ...outbound.message import OutboundMessage from ...wire_format import JsonWireFormat - +from .. import http as test_module from ..http import HttpTransport from ..message import InboundMessage from ..session import InboundSession -from .. import http as test_module class TestHttpTransport(AioHTTPTestCase): diff --git a/aries_cloudagent/transport/inbound/tests/test_manager.py b/aries_cloudagent/transport/inbound/tests/test_manager.py index 4f0f3a0b27..1856bb9183 100644 --- a/aries_cloudagent/transport/inbound/tests/test_manager.py +++ b/aries_cloudagent/transport/inbound/tests/test_manager.py @@ -1,10 +1,9 @@ -from aries_cloudagent.tests import mock from unittest import IsolatedAsyncioTestCase -from ....core.in_memory import InMemoryProfile +from aries_cloudagent.tests import mock +from ....core.in_memory import InMemoryProfile from ...outbound.message import OutboundMessage - from ...wire_format import BaseWireFormat from ..base import InboundTransportConfiguration, InboundTransportRegistrationError from ..manager import InboundTransportManager diff --git a/aries_cloudagent/transport/inbound/tests/test_message.py b/aries_cloudagent/transport/inbound/tests/test_message.py index 3472ff300b..d6a8f1ccfd 100644 --- a/aries_cloudagent/transport/inbound/tests/test_message.py +++ b/aries_cloudagent/transport/inbound/tests/test_message.py @@ -1,5 +1,4 @@ import asyncio - from unittest import IsolatedAsyncioTestCase from ..message import InboundMessage diff --git a/aries_cloudagent/transport/inbound/tests/test_session.py b/aries_cloudagent/transport/inbound/tests/test_session.py index ae6424ed3e..0c937756d3 100644 --- a/aries_cloudagent/transport/inbound/tests/test_session.py +++ b/aries_cloudagent/transport/inbound/tests/test_session.py @@ -1,18 +1,17 @@ import asyncio +from unittest import IsolatedAsyncioTestCase + import pytest from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from ....admin.server import AdminResponder from ....core.in_memory import InMemoryProfile from ....messaging.responder import BaseResponder from ....multitenant.base import BaseMultitenantManager from ....multitenant.manager import MultitenantManager - from ...error import WireFormatError from ...outbound.message import OutboundMessage - from ..message import InboundMessage from ..receipt import MessageReceipt from ..session import InboundSession diff --git a/aries_cloudagent/transport/inbound/tests/test_ws_transport.py b/aries_cloudagent/transport/inbound/tests/test_ws_transport.py index 90a5f0c688..7a64732c52 100644 --- a/aries_cloudagent/transport/inbound/tests/test_ws_transport.py +++ b/aries_cloudagent/transport/inbound/tests/test_ws_transport.py @@ -1,20 +1,19 @@ import asyncio import json -import pytest +import pytest from aiohttp.test_utils import AioHTTPTestCase, unused_port + from aries_cloudagent.tests import mock +from ....config.injection_context import InjectionContext from ....core.in_memory import InMemoryProfile - from ...outbound.message import OutboundMessage from ...wire_format import JsonWireFormat -from ....config.injection_context import InjectionContext - +from .. import ws as test_module from ..message import InboundMessage from ..session import InboundSession from ..ws import WsTransport -from .. import ws as test_module class TestWsTransport(AioHTTPTestCase): diff --git a/aries_cloudagent/transport/outbound/tests/test_http_transport.py b/aries_cloudagent/transport/outbound/tests/test_http_transport.py index 12f4038c8a..5e164ff88f 100644 --- a/aries_cloudagent/transport/outbound/tests/test_http_transport.py +++ b/aries_cloudagent/transport/outbound/tests/test_http_transport.py @@ -1,15 +1,14 @@ import asyncio -import pytest -from aiohttp.test_utils import AioHTTPTestCase +import pytest from aiohttp import web +from aiohttp.test_utils import AioHTTPTestCase + from aries_cloudagent.tests import mock from ....core.in_memory import InMemoryProfile from ....utils.stats import Collector - from ...wire_format import JsonWireFormat - from ..base import OutboundTransportError from ..http import HttpTransport diff --git a/aries_cloudagent/transport/outbound/tests/test_manager.py b/aries_cloudagent/transport/outbound/tests/test_manager.py index d2ea9c945f..aaad6dd2d1 100644 --- a/aries_cloudagent/transport/outbound/tests/test_manager.py +++ b/aries_cloudagent/transport/outbound/tests/test_manager.py @@ -1,12 +1,11 @@ import json +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase -from ....core.in_memory import InMemoryProfile from ....connections.models.connection_target import ConnectionTarget +from ....core.in_memory import InMemoryProfile from ...wire_format import BaseWireFormat - from .. import manager as test_module from ..manager import ( OutboundDeliveryError, diff --git a/aries_cloudagent/transport/outbound/tests/test_ws_transport.py b/aries_cloudagent/transport/outbound/tests/test_ws_transport.py index c1e1084d07..7dde7c981f 100644 --- a/aries_cloudagent/transport/outbound/tests/test_ws_transport.py +++ b/aries_cloudagent/transport/outbound/tests/test_ws_transport.py @@ -1,11 +1,10 @@ import asyncio import json +from aiohttp import WSMsgType, web from aiohttp.test_utils import AioHTTPTestCase -from aiohttp import web, WSMsgType from ....core.in_memory import InMemoryProfile - from ..ws import WsTransport diff --git a/aries_cloudagent/transport/pack_format.py b/aries_cloudagent/transport/pack_format.py index 80729827d2..a4400c0dfe 100644 --- a/aries_cloudagent/transport/pack_format.py +++ b/aries_cloudagent/transport/pack_format.py @@ -5,18 +5,14 @@ from typing import List, Sequence, Tuple, Union from ..core.profile import ProfileSession - -from ..protocols.routing.v1_0.messages.forward import Forward - -from ..messaging.util import time_now from ..messaging.base_message import DIDCommVersion +from ..messaging.util import time_now +from ..protocols.routing.v1_0.messages.forward import Forward from ..wallet.base import BaseWallet from ..wallet.error import WalletError from ..wallet.util import b64_to_str - -from .error import WireFormatParseError, WireFormatEncodeError, RecipientKeysError +from .error import RecipientKeysError, WireFormatEncodeError, WireFormatParseError from .inbound.receipt import MessageReceipt - from .wire_format import BaseWireFormat try: diff --git a/aries_cloudagent/transport/queue/base.py b/aries_cloudagent/transport/queue/base.py index e390c02d8b..da0978e843 100644 --- a/aries_cloudagent/transport/queue/base.py +++ b/aries_cloudagent/transport/queue/base.py @@ -1,7 +1,7 @@ """Abstract message queue.""" -from abc import ABC, abstractmethod import asyncio +from abc import ABC, abstractmethod class BaseMessageQueue(ABC): diff --git a/aries_cloudagent/transport/queue/tests/test_basic_queue.py b/aries_cloudagent/transport/queue/tests/test_basic_queue.py index 4ce073e4ab..e29c42794c 100644 --- a/aries_cloudagent/transport/queue/tests/test_basic_queue.py +++ b/aries_cloudagent/transport/queue/tests/test_basic_queue.py @@ -1,7 +1,7 @@ import asyncio +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from .. import basic as test_module from ..basic import BasicMessageQueue diff --git a/aries_cloudagent/transport/tests/test_pack_format.py b/aries_cloudagent/transport/tests/test_pack_format.py index 7ebf823ca6..4a7c95b929 100644 --- a/aries_cloudagent/transport/tests/test_pack_format.py +++ b/aries_cloudagent/transport/tests/test_pack_format.py @@ -1,7 +1,10 @@ import json from base64 import b64encode - from unittest import IsolatedAsyncioTestCase + +from didcomm_messaging import DIDCommMessaging, PackResult +from didcomm_messaging.crypto.backend.askar import CryptoServiceError + from aries_cloudagent.tests import mock from aries_cloudagent.transport.v2_pack_format import V2PackWireFormat @@ -16,10 +19,6 @@ from ..error import RecipientKeysError, WireFormatEncodeError, WireFormatParseError from ..pack_format import PackWireFormat -from didcomm_messaging import DIDCommMessaging -from didcomm_messaging.crypto.backend.askar import CryptoServiceError -from didcomm_messaging import PackResult - class TestPackWireFormat(IsolatedAsyncioTestCase): test_message_type = DIDCommPrefix.qualify_current("PROTOCOL/MESSAGE") diff --git a/aries_cloudagent/transport/tests/test_stats.py b/aries_cloudagent/transport/tests/test_stats.py index acddd20d2d..43dd9e2bca 100644 --- a/aries_cloudagent/transport/tests/test_stats.py +++ b/aries_cloudagent/transport/tests/test_stats.py @@ -1,6 +1,4 @@ -from unittest import mock -from unittest import IsolatedAsyncioTestCase - +from unittest import IsolatedAsyncioTestCase, mock from .. import stats as test_module diff --git a/aries_cloudagent/transport/v2_pack_format.py b/aries_cloudagent/transport/v2_pack_format.py index 64b5bc4812..266c0b8b08 100644 --- a/aries_cloudagent/transport/v2_pack_format.py +++ b/aries_cloudagent/transport/v2_pack_format.py @@ -9,21 +9,15 @@ raise ImportError("Install the didcommv2 extra to use this module.") from err import json - from typing import Sequence, Tuple, Union from ..core.profile import ProfileSession - - -from ..messaging.util import time_now from ..messaging.base_message import DIDCommVersion +from ..messaging.util import time_now from ..wallet.base import BaseWallet from ..wallet.error import WalletNotFoundError - - from .error import WireFormatParseError from .inbound.receipt import MessageReceipt - from .wire_format import BaseWireFormat LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/transport/wire_format.py b/aries_cloudagent/transport/wire_format.py index 045ba66737..ac7f446ce8 100644 --- a/aries_cloudagent/transport/wire_format.py +++ b/aries_cloudagent/transport/wire_format.py @@ -2,15 +2,13 @@ import json import logging - from abc import abstractmethod from typing import List, Sequence, Tuple, Union from ..core.profile import ProfileSession from ..messaging.util import time_now - -from .inbound.receipt import MessageReceipt from .error import WireFormatParseError +from .inbound.receipt import MessageReceipt LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/utils/classloader.py b/aries_cloudagent/utils/classloader.py index 912b5c061f..3d437fa417 100644 --- a/aries_cloudagent/utils/classloader.py +++ b/aries_cloudagent/utils/classloader.py @@ -1,10 +1,8 @@ """The classloader provides utilities to dynamically load classes and modules.""" import inspect -from importlib import resources import sys - -from importlib import import_module +from importlib import import_module, resources from importlib.util import find_spec, resolve_name from types import ModuleType from typing import Optional, Sequence, Type diff --git a/aries_cloudagent/utils/env.py b/aries_cloudagent/utils/env.py index ecf63fe46e..ef2a507a00 100644 --- a/aries_cloudagent/utils/env.py +++ b/aries_cloudagent/utils/env.py @@ -1,7 +1,7 @@ """Environment utility methods.""" -from pathlib import Path from os import getenv +from pathlib import Path def storage_path(*subpaths, create: bool = False) -> Path: diff --git a/aries_cloudagent/utils/http.py b/aries_cloudagent/utils/http.py index dc37f4cb69..9f45ccb411 100644 --- a/aries_cloudagent/utils/http.py +++ b/aries_cloudagent/utils/http.py @@ -4,20 +4,12 @@ import logging import urllib.parse -from aiohttp import ( - BaseConnector, - ClientError, - ClientResponse, - ClientSession, - FormData, -) +from aiohttp import BaseConnector, ClientError, ClientResponse, ClientSession, FormData from aiohttp.web import HTTPConflict from ..core.error import BaseError - from .repeat import RepeatSequence - LOGGER = logging.getLogger(__name__) diff --git a/aries_cloudagent/utils/multi_ledger.py b/aries_cloudagent/utils/multi_ledger.py index 8b5b277bdd..acfcc30132 100644 --- a/aries_cloudagent/utils/multi_ledger.py +++ b/aries_cloudagent/utils/multi_ledger.py @@ -2,8 +2,8 @@ from collections import OrderedDict -from ..core.error import ProfileError from ..config.settings import BaseSettings +from ..core.error import ProfileError def get_write_ledger_config_for_profile(settings: BaseSettings) -> dict: diff --git a/aries_cloudagent/utils/outofband.py b/aries_cloudagent/utils/outofband.py index 47743b601b..619ebacae6 100644 --- a/aries_cloudagent/utils/outofband.py +++ b/aries_cloudagent/utils/outofband.py @@ -1,7 +1,6 @@ """Utilities for creating out-of-band messages.""" import json - from urllib.parse import quote, urljoin from ..messaging.agent_message import AgentMessage diff --git a/aries_cloudagent/utils/tests/test_classloader.py b/aries_cloudagent/utils/tests/test_classloader.py index 41ae1fbbce..7d86ae5744 100644 --- a/aries_cloudagent/utils/tests/test_classloader.py +++ b/aries_cloudagent/utils/tests/test_classloader.py @@ -1,8 +1,6 @@ -from unittest import TestCase -from unittest import mock +from unittest import TestCase, mock from ...core.error import BaseError - from .. import classloader as test_module from ..classloader import ClassLoader, ClassNotFoundError, ModuleLoadError diff --git a/aries_cloudagent/utils/tests/test_http.py b/aries_cloudagent/utils/tests/test_http.py index 2fa4ad0225..43133171db 100644 --- a/aries_cloudagent/utils/tests/test_http.py +++ b/aries_cloudagent/utils/tests/test_http.py @@ -4,7 +4,7 @@ from aiohttp import web from aiohttp.test_utils import AioHTTPTestCase -from ..http import fetch, fetch_stream, FetchError, put_file, PutError +from ..http import FetchError, PutError, fetch, fetch_stream, put_file class TempFile: diff --git a/aries_cloudagent/utils/tests/test_jwe.py b/aries_cloudagent/utils/tests/test_jwe.py index cd406976ca..c7374903b4 100644 --- a/aries_cloudagent/utils/tests/test_jwe.py +++ b/aries_cloudagent/utils/tests/test_jwe.py @@ -1,8 +1,7 @@ import json - from unittest import TestCase -from ..jwe import b64url, JweEnvelope, JweRecipient, from_b64url +from ..jwe import JweEnvelope, JweRecipient, b64url, from_b64url IV = b"test nonce" TAG = b"test tag" diff --git a/aries_cloudagent/utils/tests/test_multiformats.py b/aries_cloudagent/utils/tests/test_multiformats.py index 5ef8ce4308..0283a7a927 100644 --- a/aries_cloudagent/utils/tests/test_multiformats.py +++ b/aries_cloudagent/utils/tests/test_multiformats.py @@ -1,4 +1,5 @@ import pytest + from ..multiformats import multibase, multicodec diff --git a/aries_cloudagent/utils/tests/test_repeat.py b/aries_cloudagent/utils/tests/test_repeat.py index 7f221270d5..bd9488d824 100644 --- a/aries_cloudagent/utils/tests/test_repeat.py +++ b/aries_cloudagent/utils/tests/test_repeat.py @@ -1,5 +1,4 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock from .. import repeat as test_module diff --git a/aries_cloudagent/utils/tests/test_stats.py b/aries_cloudagent/utils/tests/test_stats.py index d984b93785..60e48baf4f 100644 --- a/aries_cloudagent/utils/tests/test_stats.py +++ b/aries_cloudagent/utils/tests/test_stats.py @@ -1,5 +1,4 @@ from tempfile import NamedTemporaryFile - from unittest import IsolatedAsyncioTestCase from ..stats import Collector diff --git a/aries_cloudagent/utils/tests/test_task_queue.py b/aries_cloudagent/utils/tests/test_task_queue.py index 0d1a5cfd88..3b7d052249 100644 --- a/aries_cloudagent/utils/tests/test_task_queue.py +++ b/aries_cloudagent/utils/tests/test_task_queue.py @@ -1,7 +1,7 @@ import asyncio +from unittest import IsolatedAsyncioTestCase from aries_cloudagent.tests import mock -from unittest import IsolatedAsyncioTestCase from ..task_queue import CompletedTask, PendingTask, TaskQueue, task_exc_info diff --git a/aries_cloudagent/utils/tests/test_tracing.py b/aries_cloudagent/utils/tests/test_tracing.py index 55cd60465b..5a6c8433c0 100644 --- a/aries_cloudagent/utils/tests/test_tracing.py +++ b/aries_cloudagent/utils/tests/test_tracing.py @@ -1,18 +1,16 @@ import json -import requests - from unittest import IsolatedAsyncioTestCase -from ...protocols.out_of_band.v1_0.messages.invitation import InvitationMessage +import requests + +from ...messaging.decorators.trace_decorator import TRACE_MESSAGE_TARGET, TraceDecorator from ...protocols.issue_credential.v1_0.models.credential_exchange import ( V10CredentialExchange, ) +from ...protocols.out_of_band.v1_0.messages.invitation import InvitationMessage +from ...protocols.trustping.v1_0.messages.ping import Ping from ...transport.inbound.message import InboundMessage from ...transport.outbound.message import OutboundMessage - -from ...messaging.decorators.trace_decorator import TraceDecorator, TRACE_MESSAGE_TARGET -from ...protocols.trustping.v1_0.messages.ping import Ping - from .. import tracing as test_module diff --git a/aries_cloudagent/vc/ld_proofs/__init__.py b/aries_cloudagent/vc/ld_proofs/__init__.py index 00402ae378..64c84915e8 100644 --- a/aries_cloudagent/vc/ld_proofs/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/__init__.py @@ -1,32 +1,23 @@ -from .ld_proofs import sign, verify, derive -from .proof_set import ProofSet -from .purposes import ( - _ProofPurpose as ProofPurpose, - _ControllerProofPurpose as ControllerProofPurpose, - _AuthenticationProofPurpose as AuthenticationProofPurpose, - _CredentialIssuancePurpose as CredentialIssuancePurpose, - _AssertionProofPurpose as AssertionProofPurpose, -) -from .suites import ( - _LinkedDataProof as LinkedDataProof, - _LinkedDataSignature as LinkedDataSignature, - _JwsLinkedDataSignature as JwsLinkedDataSignature, - _Ed25519Signature2018 as Ed25519Signature2018, - _Ed25519Signature2020 as Ed25519Signature2020, - _BbsBlsSignature2020 as BbsBlsSignature2020, - _BbsBlsSignatureProof2020 as BbsBlsSignatureProof2020, -) -from .crypto import ( - _KeyPair as KeyPair, - _WalletKeyPair as WalletKeyPair, -) -from .document_loader import ( - DocumentLoader, - DocumentLoaderMethod, -) +from .check import get_properties_without_context +from .crypto import _KeyPair as KeyPair +from .crypto import _WalletKeyPair as WalletKeyPair +from .document_loader import DocumentLoader, DocumentLoaderMethod from .error import LinkedDataProofException +from .ld_proofs import derive, sign, verify +from .proof_set import ProofSet +from .purposes import _AssertionProofPurpose as AssertionProofPurpose +from .purposes import _AuthenticationProofPurpose as AuthenticationProofPurpose +from .purposes import _ControllerProofPurpose as ControllerProofPurpose +from .purposes import _CredentialIssuancePurpose as CredentialIssuancePurpose +from .purposes import _ProofPurpose as ProofPurpose +from .suites import _BbsBlsSignature2020 as BbsBlsSignature2020 +from .suites import _BbsBlsSignatureProof2020 as BbsBlsSignatureProof2020 +from .suites import _Ed25519Signature2018 as Ed25519Signature2018 +from .suites import _Ed25519Signature2020 as Ed25519Signature2020 +from .suites import _JwsLinkedDataSignature as JwsLinkedDataSignature +from .suites import _LinkedDataProof as LinkedDataProof +from .suites import _LinkedDataSignature as LinkedDataSignature from .validation_result import DocumentVerificationResult, ProofResult, PurposeResult -from .check import get_properties_without_context __all__ = [ "sign", diff --git a/aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py b/aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py index e920fb9774..b668c3f107 100644 --- a/aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py +++ b/aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py @@ -1,12 +1,11 @@ from unittest import IsolatedAsyncioTestCase -from aries_cloudagent.tests import mock +from aries_cloudagent.tests import mock from aries_cloudagent.wallet.key_type import ED25519 from .....core.in_memory import InMemoryProfile from .....wallet.in_memory import InMemoryWallet from ...error import LinkedDataProofException - from ..wallet_key_pair import WalletKeyPair diff --git a/aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py b/aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py index 189a1086d4..8797e450b2 100644 --- a/aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py +++ b/aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py @@ -6,9 +6,7 @@ from ....wallet.base import BaseWallet from ....wallet.key_type import KeyType from ....wallet.util import b58_to_bytes - from ..error import LinkedDataProofException - from .key_pair import KeyPair diff --git a/aries_cloudagent/vc/ld_proofs/document_downloader.py b/aries_cloudagent/vc/ld_proofs/document_downloader.py index 21149ccefe..553e00dd39 100644 --- a/aries_cloudagent/vc/ld_proofs/document_downloader.py +++ b/aries_cloudagent/vc/ld_proofs/document_downloader.py @@ -6,14 +6,15 @@ import logging import re import string -from typing import Dict, Optional import urllib.parse as urllib_parse from importlib import resources -from ...version import __version__ +from typing import Dict, Optional import requests from pyld import jsonld -from pyld.jsonld import JsonLdError, parse_link_header, LINK_HEADER_REL +from pyld.jsonld import LINK_HEADER_REL, JsonLdError, parse_link_header + +from ...version import __version__ logger = logging.getLogger(__name__) diff --git a/aries_cloudagent/vc/ld_proofs/document_loader.py b/aries_cloudagent/vc/ld_proofs/document_loader.py index 029da19763..521de31036 100644 --- a/aries_cloudagent/vc/ld_proofs/document_loader.py +++ b/aries_cloudagent/vc/ld_proofs/document_loader.py @@ -2,21 +2,18 @@ import asyncio import concurrent.futures - from typing import Callable +import nest_asyncio from pydid.did_url import DIDUrl from pyld.documentloader import requests -from .document_downloader import StaticCacheJsonLdDownloader from ...cache.base import BaseCache from ...core.profile import Profile from ...resolver.did_resolver import DIDResolver - +from .document_downloader import StaticCacheJsonLdDownloader from .error import LinkedDataProofException -import nest_asyncio - nest_asyncio.apply() diff --git a/aries_cloudagent/vc/ld_proofs/purposes/__init__.py b/aries_cloudagent/vc/ld_proofs/purposes/__init__.py index 47865d613a..fc114956d7 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/__init__.py @@ -1,4 +1,3 @@ -from .proof_purpose import ProofPurpose as _ProofPurpose from .assertion_proof_purpose import AssertionProofPurpose as _AssertionProofPurpose from .authentication_proof_purpose import ( AuthenticationProofPurpose as _AuthenticationProofPurpose, @@ -7,6 +6,7 @@ from .credential_issuance_purpose import ( CredentialIssuancePurpose as _CredentialIssuancePurpose, ) +from .proof_purpose import ProofPurpose as _ProofPurpose __all__ = [ "_ProofPurpose", diff --git a/aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py index 1322e9712e..ef6a24787a 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py @@ -6,7 +6,6 @@ from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException from ..validation_result import PurposeResult - from .controller_proof_purpose import ControllerProofPurpose # Avoid circular dependency diff --git a/aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py index 8ee1306408..53634c7c19 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py @@ -2,14 +2,13 @@ from typing import TYPE_CHECKING -from pyld.jsonld import JsonLdProcessor from pyld import jsonld +from pyld.jsonld import JsonLdProcessor from ..constants import SECURITY_CONTEXT_URL from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException from ..validation_result import PurposeResult - from .proof_purpose import ProofPurpose # Avoid circular dependency diff --git a/aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py index e4150a962e..a60a3545f0 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py @@ -1,15 +1,14 @@ """Credential Issuance proof purpose class.""" -from typing import List, TYPE_CHECKING +from typing import TYPE_CHECKING, List -from pyld.jsonld import JsonLdProcessor from pyld import jsonld +from pyld.jsonld import JsonLdProcessor from ..constants import CREDENTIALS_ISSUER_URL from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException from ..validation_result import PurposeResult - from .assertion_proof_purpose import AssertionProofPurpose # Avoid circular dependency diff --git a/aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py index 1a6be5ac34..9c6d6e6f01 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py @@ -4,7 +4,6 @@ from typing import TYPE_CHECKING, Optional from ....messaging.util import str_to_datetime - from ..document_loader import DocumentLoaderMethod from ..validation_result import PurposeResult diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py index 3e6b030c5c..23740f5344 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py @@ -1,10 +1,9 @@ from datetime import datetime, timedelta -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock from ...validation_result import PurposeResult -from ..controller_proof_purpose import ControllerProofPurpose from ..authentication_proof_purpose import AuthenticationProofPurpose +from ..controller_proof_purpose import ControllerProofPurpose class TestAuthenticationProofPurpose(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py index 85ae8a279b..33ac403043 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py @@ -1,11 +1,10 @@ from datetime import datetime, timedelta -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock from ....tests.data import TEST_VC_DOCUMENT_SIGNED_DID_KEY_ED25519 from ....tests.document_loader import custom_document_loader -from ..proof_purpose import ProofPurpose from ..controller_proof_purpose import ControllerProofPurpose +from ..proof_purpose import ProofPurpose class TestControllerProofPurpose(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py index 5ca98670b3..8d2d371bb1 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py @@ -1,12 +1,11 @@ from datetime import datetime, timedelta -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock +from ....tests.data import TEST_VC_DOCUMENT_SIGNED_ED25519 +from ....tests.document_loader import custom_document_loader from ...validation_result import PurposeResult from ..assertion_proof_purpose import AssertionProofPurpose from ..credential_issuance_purpose import CredentialIssuancePurpose -from ....tests.data import TEST_VC_DOCUMENT_SIGNED_ED25519 -from ....tests.document_loader import custom_document_loader class TestCredentialIssuancePurpose(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py index ee01358587..4865f9c9c4 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py @@ -1,6 +1,5 @@ from datetime import datetime, timedelta -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock from .....messaging.util import datetime_to_str from ..proof_purpose import ProofPurpose diff --git a/aries_cloudagent/vc/ld_proofs/suites/__init__.py b/aries_cloudagent/vc/ld_proofs/suites/__init__.py index 594295ebc6..f70151f473 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/suites/__init__.py @@ -1,12 +1,12 @@ -from .linked_data_proof import LinkedDataProof as _LinkedDataProof -from .linked_data_signature import LinkedDataSignature as _LinkedDataSignature -from .jws_linked_data_signature import JwsLinkedDataSignature as _JwsLinkedDataSignature -from .ed25519_signature_2018 import Ed25519Signature2018 as _Ed25519Signature2018 -from .ed25519_signature_2020 import Ed25519Signature2020 as _Ed25519Signature2020 from .bbs_bls_signature_2020 import BbsBlsSignature2020 as _BbsBlsSignature2020 from .bbs_bls_signature_proof_2020 import ( BbsBlsSignatureProof2020 as _BbsBlsSignatureProof2020, ) +from .ed25519_signature_2018 import Ed25519Signature2018 as _Ed25519Signature2018 +from .ed25519_signature_2020 import Ed25519Signature2020 as _Ed25519Signature2020 +from .jws_linked_data_signature import JwsLinkedDataSignature as _JwsLinkedDataSignature +from .linked_data_proof import LinkedDataProof as _LinkedDataProof +from .linked_data_signature import LinkedDataSignature as _LinkedDataSignature __all__ = [ "_LinkedDataProof", diff --git a/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py index 4c0a1e8938..7791fb5f2c 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py +++ b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py @@ -6,10 +6,8 @@ from pyld import jsonld from ....utils.dependencies import is_ursa_bbs_signatures_module_installed - from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException - from .linked_data_proof import LinkedDataProof diff --git a/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py index 2133168397..86fecc648c 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py @@ -1,7 +1,6 @@ """BbsBlsSignatureProof2020 class.""" import re - from os import urandom from typing import List @@ -11,25 +10,27 @@ if BbsBlsSignature2020Base.BBS_SUPPORTED: from ursa_bbs_signatures import ( - create_proof as bls_create_proof, - verify_proof as bls_verify_proof, + BlsKeyPair, CreateProofRequest, - VerifyProofRequest, - get_total_message_count, ProofMessage, - BlsKeyPair, ProofMessageType, + VerifyProofRequest, + get_total_message_count, + ) + from ursa_bbs_signatures import ( + create_proof as bls_create_proof, + ) + from ursa_bbs_signatures import ( + verify_proof as bls_verify_proof, ) from ....utils.dependencies import assert_ursa_bbs_signatures_installed from ....wallet.util import b64_to_bytes, bytes_to_b64 - from ..crypto import _KeyPair as KeyPair -from ..error import LinkedDataProofException -from ..validation_result import ProofResult from ..document_loader import DocumentLoaderMethod +from ..error import LinkedDataProofException from ..purposes import _ProofPurpose as ProofPurpose - +from ..validation_result import ProofResult from .bbs_bls_signature_2020 import BbsBlsSignature2020 from .linked_data_proof import DeriveProofResult diff --git a/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py b/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py index a3fe2a6eef..abc812ee12 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py +++ b/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py @@ -4,7 +4,6 @@ from typing import Optional, Union from ..crypto import _KeyPair as KeyPair - from .jws_linked_data_signature import JwsLinkedDataSignature diff --git a/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2020.py b/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2020.py index d0a83b6930..85df38bf52 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2020.py @@ -1,7 +1,7 @@ """Ed25519Signature2018 suite.""" from datetime import datetime -from typing import Optional, Union, List +from typing import List, Optional, Union from ....utils.multiformats import multibase from ..crypto import _KeyPair as KeyPair diff --git a/aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py b/aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py index d20c60b594..10a4253e68 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py +++ b/aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py @@ -1,18 +1,15 @@ """JWS Linked Data class.""" import json - from datetime import datetime from typing import Optional, Union from pyld.jsonld import JsonLdProcessor -from ....wallet.util import b64_to_bytes, bytes_to_b64, str_to_b64, b64_to_str - +from ....wallet.util import b64_to_bytes, b64_to_str, bytes_to_b64, str_to_b64 from ..crypto import _KeyPair as KeyPair from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException - from .linked_data_signature import LinkedDataSignature diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py index 11d7649453..bc32f17e35 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py @@ -1,5 +1,5 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock + import pytest from aries_cloudagent.wallet.key_type import BLS12381G2 @@ -7,20 +7,18 @@ from .....core.in_memory import InMemoryProfile from .....did.did_key import DIDKey from .....wallet.in_memory import InMemoryWallet -from ....tests.document_loader import custom_document_loader from ....tests.data import ( TEST_LD_DOCUMENT, - TEST_LD_DOCUMENT_SIGNED_BBS, TEST_LD_DOCUMENT_BAD_SIGNED_BBS, + TEST_LD_DOCUMENT_SIGNED_BBS, TEST_VC_DOCUMENT, TEST_VC_DOCUMENT_SIGNED_BBS, ) - -from ...error import LinkedDataProofException +from ....tests.document_loader import custom_document_loader from ...crypto.wallet_key_pair import WalletKeyPair -from ...purposes.assertion_proof_purpose import AssertionProofPurpose +from ...error import LinkedDataProofException from ...ld_proofs import sign, verify - +from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ..bbs_bls_signature_2020 import BbsBlsSignature2020 diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py index 54abb9f7e0..7cb69a7d82 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py @@ -1,5 +1,5 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import mock +from unittest import IsolatedAsyncioTestCase, mock + import pytest from aries_cloudagent.wallet.key_type import BLS12381G2 @@ -7,29 +7,27 @@ from .....core.in_memory import InMemoryProfile from .....did.did_key import DIDKey from .....wallet.in_memory import InMemoryWallet -from ....tests.document_loader import custom_document_loader from ....tests.data import ( - TEST_LD_DOCUMENT_SIGNED_BBS, - TEST_LD_DOCUMENT_PROOF_BBS, TEST_LD_DOCUMENT_BAD_PARTIAL_PROOF_BBS, TEST_LD_DOCUMENT_PARTIAL_PROOF_BBS, - TEST_LD_DOCUMENT_REVEAL_ALL, + TEST_LD_DOCUMENT_PROOF_BBS, TEST_LD_DOCUMENT_REVEAL, - TEST_VC_DOCUMENT_SIGNED_BBS, - TEST_VC_DOCUMENT_REVEAL, + TEST_LD_DOCUMENT_REVEAL_ALL, + TEST_LD_DOCUMENT_SIGNED_BBS, TEST_VC_DOCUMENT_NESTED_PARTIAL_PROOF_BBS, TEST_VC_DOCUMENT_NESTED_PROOF_BBS, + TEST_VC_DOCUMENT_NESTED_REVEAL, TEST_VC_DOCUMENT_NESTED_SIGNED_BBS, TEST_VC_DOCUMENT_PARTIAL_PROOF_BBS, - TEST_VC_DOCUMENT_NESTED_REVEAL, + TEST_VC_DOCUMENT_REVEAL, + TEST_VC_DOCUMENT_SIGNED_BBS, ) +from ....tests.document_loader import custom_document_loader from ....vc_ld import derive_credential, verify_credential - from ...crypto.wallet_key_pair import WalletKeyPair -from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ...error import LinkedDataProofException -from ...ld_proofs import verify, derive - +from ...ld_proofs import derive, verify +from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ..bbs_bls_signature_proof_2020 import BbsBlsSignatureProof2020 diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py index e9dfba0d33..3d23e8f325 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py @@ -1,23 +1,20 @@ from unittest import IsolatedAsyncioTestCase +from .....core.in_memory import InMemoryProfile from .....did.did_key import DIDKey -from .....wallet.key_type import ED25519 from .....wallet.in_memory import InMemoryWallet -from .....core.in_memory import InMemoryProfile - -from ....tests.document_loader import custom_document_loader +from .....wallet.key_type import ED25519 from ....tests.data import ( TEST_LD_DOCUMENT, - TEST_LD_DOCUMENT_SIGNED_ED25519, TEST_LD_DOCUMENT_BAD_SIGNED_ED25519, + TEST_LD_DOCUMENT_SIGNED_ED25519, TEST_VC_DOCUMENT, TEST_VC_DOCUMENT_SIGNED_ED25519, ) - +from ....tests.document_loader import custom_document_loader from ...crypto.wallet_key_pair import WalletKeyPair -from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ...ld_proofs import sign, verify - +from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ..ed25519_signature_2018 import Ed25519Signature2018 diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2020.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2020.py index 68950bf3d3..c3d28250c2 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2020.py @@ -1,21 +1,21 @@ from unittest import IsolatedAsyncioTestCase -from ..ed25519_signature_2020 import Ed25519Signature2020 -from ...crypto.wallet_key_pair import WalletKeyPair -from ...ld_proofs import sign, verify -from ...purposes.assertion_proof_purpose import AssertionProofPurpose +from .....core.in_memory import InMemoryProfile +from .....did.did_key import DIDKey +from .....wallet.in_memory import InMemoryWallet +from .....wallet.key_type import ED25519 from ....tests.data import ( TEST_LD_DOCUMENT, - TEST_LD_DOCUMENT_SIGNED_ED25519_2020, TEST_LD_DOCUMENT_BAD_SIGNED_ED25519_2020, + TEST_LD_DOCUMENT_SIGNED_ED25519_2020, TEST_VC_DOCUMENT, TEST_VC_DOCUMENT_SIGNED_ED25519_2020, ) from ....tests.document_loader import custom_document_loader -from .....core.in_memory import InMemoryProfile -from .....did.did_key import DIDKey -from .....wallet.in_memory import InMemoryWallet -from .....wallet.key_type import ED25519 +from ...crypto.wallet_key_pair import WalletKeyPair +from ...ld_proofs import sign, verify +from ...purposes.assertion_proof_purpose import AssertionProofPurpose +from ..ed25519_signature_2020 import Ed25519Signature2020 class TestEd25519Signature2020(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/vc/ld_proofs/tests/test_check.py b/aries_cloudagent/vc/ld_proofs/tests/test_check.py index 2505d6b4da..a57d07c204 100644 --- a/aries_cloudagent/vc/ld_proofs/tests/test_check.py +++ b/aries_cloudagent/vc/ld_proofs/tests/test_check.py @@ -1,7 +1,7 @@ from unittest import TestCase -from ..check import get_properties_without_context from ...tests.document_loader import custom_document_loader +from ..check import get_properties_without_context VALID_INPUT_DOC = { "@context": [ diff --git a/aries_cloudagent/vc/ld_proofs/tests/test_ld_proofs.py b/aries_cloudagent/vc/ld_proofs/tests/test_ld_proofs.py index 9141e48c98..1e252fdd18 100644 --- a/aries_cloudagent/vc/ld_proofs/tests/test_ld_proofs.py +++ b/aries_cloudagent/vc/ld_proofs/tests/test_ld_proofs.py @@ -1,36 +1,33 @@ -from unittest import IsolatedAsyncioTestCase -import pytest - from datetime import datetime, timezone +from unittest import IsolatedAsyncioTestCase +import pytest -from ....wallet.key_type import BLS12381G2, ED25519 +from ....core.in_memory import InMemoryProfile from ....did.did_key import DIDKey from ....wallet.in_memory import InMemoryWallet -from ....core.in_memory import InMemoryProfile - +from ....wallet.key_type import BLS12381G2, ED25519 from ...ld_proofs import ( - sign, - Ed25519Signature2018, - Ed25519Signature2020, - WalletKeyPair, AssertionProofPurpose, - verify, BbsBlsSignature2020, BbsBlsSignatureProof2020, + Ed25519Signature2018, + Ed25519Signature2020, + WalletKeyPair, derive, + sign, + verify, ) from ...tests.document_loader import custom_document_loader - from .test_doc import ( DOC_DERIVED_BBS, + DOC_FRAME_BBS, + DOC_SIGNED, + DOC_SIGNED_2020, DOC_SIGNED_BBS, DOC_TEMPLATE, DOC_TEMPLATE_2020, - DOC_SIGNED, - DOC_SIGNED_2020, DOC_TEMPLATE_BBS, - DOC_FRAME_BBS, DOC_VERIFIED, DOC_VERIFIED_2020, ) diff --git a/aries_cloudagent/vc/tests/contexts/__init__.py b/aries_cloudagent/vc/tests/contexts/__init__.py index c00106a0bd..c95ecdb8ab 100644 --- a/aries_cloudagent/vc/tests/contexts/__init__.py +++ b/aries_cloudagent/vc/tests/contexts/__init__.py @@ -1,17 +1,16 @@ +from .bbs_v1 import BBS_V1 +from .citizenship_v1 import CITIZENSHIP_V1 +from .credentials_v1 import CREDENTIALS_V1 from .did_v1 import DID_V1 from .dif_presentation_submission_v1 import DIF_PRESENTATION_SUBMISSION_V1 -from .security_v1 import SECURITY_V1 -from .security_v2 import SECURITY_V2 -from .security_v3_unstable import SECURITY_V3_UNSTABLE -from .bbs_v1 import BBS_V1 from .ed25519_2020_v1 import ED25519_2020_V1 -from .credentials_v1 import CREDENTIALS_V1 -from .citizenship_v1 import CITIZENSHIP_V1 -from .vaccination_v1 import VACCINATION_V1 from .examples_v1 import EXAMPLES_V1 from .odrl import ODRL from .schema_org import SCHEMA_ORG - +from .security_v1 import SECURITY_V1 +from .security_v2 import SECURITY_V2 +from .security_v3_unstable import SECURITY_V3_UNSTABLE +from .vaccination_v1 import VACCINATION_V1 __all__ = [ "DID_V1", diff --git a/aries_cloudagent/vc/tests/data/__init__.py b/aries_cloudagent/vc/tests/data/__init__.py index a9f6858d71..58d8e40702 100644 --- a/aries_cloudagent/vc/tests/data/__init__.py +++ b/aries_cloudagent/vc/tests/data/__init__.py @@ -2,51 +2,48 @@ BBS_NESTED_VC_FULL_REVEAL_DOCUMENT_MATTR, ) from .bbs_nested_vc_mattr import BBS_NESTED_VC_MATTR -from .bbs_nested_vc_reveal_document_mattr import ( - BBS_NESTED_VC_REVEAL_DOCUMENT_MATTR, -) +from .bbs_nested_vc_reveal_document_mattr import BBS_NESTED_VC_REVEAL_DOCUMENT_MATTR from .bbs_partial_proof_nested_vc_mattr import BBS_PARTIAL_PROOF_NESTED_VC_MATTR from .bbs_partial_proof_vc_mattr import BBS_PARTIAL_PROOF_VC_MATTR -from .bbs_proof_vc_mattr import BBS_PROOF_VC_MATTR from .bbs_proof_nested_vc_mattr import BBS_PROOF_NESTED_VC_MATTR -from .bbs_signed_vc_mattr import BBS_SIGNED_VC_MATTR +from .bbs_proof_vc_mattr import BBS_PROOF_VC_MATTR from .bbs_signed_nested_vc_mattr import BBS_SIGNED_NESTED_VC_MATTR +from .bbs_signed_vc_mattr import BBS_SIGNED_VC_MATTR from .bbs_vc_mattr import BBS_VC_MATTR from .bbs_vc_reveal_document_mattr import BBS_VC_REVEAL_DOCUMENT_MATTR - +from .test_ld_document import TEST_LD_DOCUMENT +from .test_ld_document_bad_partial_proof_bbs import ( + TEST_LD_DOCUMENT_BAD_PARTIAL_PROOF_BBS, +) from .test_ld_document_bad_signed_bbs import TEST_LD_DOCUMENT_BAD_SIGNED_BBS -from .test_ld_document_signed_bbs import TEST_LD_DOCUMENT_SIGNED_BBS from .test_ld_document_bad_signed_ed25519 import TEST_LD_DOCUMENT_BAD_SIGNED_ED25519 from .test_ld_document_bad_signed_ed25519_2020 import ( TEST_LD_DOCUMENT_BAD_SIGNED_ED25519_2020, ) -from .test_ld_document_signed_ed25519 import TEST_LD_DOCUMENT_SIGNED_ED25519 -from .test_ld_document_signed_ed25519_2020 import TEST_LD_DOCUMENT_SIGNED_ED25519_2020 -from .test_ld_document import TEST_LD_DOCUMENT +from .test_ld_document_partial_proof_bbs import TEST_LD_DOCUMENT_PARTIAL_PROOF_BBS +from .test_ld_document_proof_bbs import TEST_LD_DOCUMENT_PROOF_BBS from .test_ld_document_reveal import TEST_LD_DOCUMENT_REVEAL from .test_ld_document_reveal_all import TEST_LD_DOCUMENT_REVEAL_ALL -from .test_ld_document_proof_bbs import TEST_LD_DOCUMENT_PROOF_BBS -from .test_ld_document_partial_proof_bbs import TEST_LD_DOCUMENT_PARTIAL_PROOF_BBS -from .test_ld_document_bad_partial_proof_bbs import ( - TEST_LD_DOCUMENT_BAD_PARTIAL_PROOF_BBS, -) +from .test_ld_document_signed_bbs import TEST_LD_DOCUMENT_SIGNED_BBS +from .test_ld_document_signed_ed25519 import TEST_LD_DOCUMENT_SIGNED_ED25519 +from .test_ld_document_signed_ed25519_2020 import TEST_LD_DOCUMENT_SIGNED_ED25519_2020 +from .test_vc_document import TEST_VC_DOCUMENT +from .test_vc_document_did_key_ed25519 import TEST_VC_DOCUMENT_DID_KEY_ED25519 +from .test_vc_document_nested import TEST_VC_DOCUMENT_NESTED from .test_vc_document_nested_partial_proof_bbs import ( TEST_VC_DOCUMENT_NESTED_PARTIAL_PROOF_BBS, ) from .test_vc_document_nested_proof_bbs import TEST_VC_DOCUMENT_NESTED_PROOF_BBS +from .test_vc_document_nested_reveal import TEST_VC_DOCUMENT_NESTED_REVEAL from .test_vc_document_nested_signed_bbs import TEST_VC_DOCUMENT_NESTED_SIGNED_BBS -from .test_vc_document_nested import TEST_VC_DOCUMENT_NESTED from .test_vc_document_partial_proof_bbs import TEST_VC_DOCUMENT_PARTIAL_PROOF_BBS from .test_vc_document_reveal import TEST_VC_DOCUMENT_REVEAL from .test_vc_document_signed_bbs import TEST_VC_DOCUMENT_SIGNED_BBS -from .test_vc_document_signed_ed25519 import TEST_VC_DOCUMENT_SIGNED_ED25519 -from .test_vc_document_signed_ed25519_2020 import TEST_VC_DOCUMENT_SIGNED_ED25519_2020 -from .test_vc_document import TEST_VC_DOCUMENT -from .test_vc_document_did_key_ed25519 import TEST_VC_DOCUMENT_DID_KEY_ED25519 from .test_vc_document_signed_did_key_ed25519 import ( TEST_VC_DOCUMENT_SIGNED_DID_KEY_ED25519, ) -from .test_vc_document_nested_reveal import TEST_VC_DOCUMENT_NESTED_REVEAL +from .test_vc_document_signed_ed25519 import TEST_VC_DOCUMENT_SIGNED_ED25519 +from .test_vc_document_signed_ed25519_2020 import TEST_VC_DOCUMENT_SIGNED_ED25519_2020 __all__ = [ "BBS_NESTED_VC_FULL_REVEAL_DOCUMENT_MATTR", diff --git a/aries_cloudagent/vc/tests/dids/__init__.py b/aries_cloudagent/vc/tests/dids/__init__.py index 07ed6649c0..b2b3acff1a 100644 --- a/aries_cloudagent/vc/tests/dids/__init__.py +++ b/aries_cloudagent/vc/tests/dids/__init__.py @@ -1,11 +1,11 @@ +from .did_example_489398593 import DID_EXAMPLE_48939859 +from .did_sov_QqEfJxe752NCmWqR5TssZ5 import DID_SOV_QqEfJxe752NCmWqR5TssZ5 from .did_z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL import ( DID_z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL, ) from .did_zUC72Q7XD4PE4CrMiDVXuvZng3sBvMmaGgNeTUJuzavH2BS7ThbHL9FhsZM9QYY5fqAQ4MB8M9oudz3tfuaX36Ajr97QRW7LBt6WWmrtESe6Bs5NYzFtLWEmeVtvRYVAgjFcJSa import ( DID_zUC72Q7XD4PE4CrMiDVXuvZng3sBvMmaGgNeTUJuzavH2BS7ThbHL9FhsZM9QYY5fqAQ4MB8M9oudz3tfuaX36Ajr97QRW7LBt6WWmrtESe6Bs5NYzFtLWEmeVtvRYVAgjFcJSa, ) -from .did_example_489398593 import DID_EXAMPLE_48939859 -from .did_sov_QqEfJxe752NCmWqR5TssZ5 import DID_SOV_QqEfJxe752NCmWqR5TssZ5 __all__ = [ "DID_z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL", diff --git a/aries_cloudagent/vc/tests/document_loader.py b/aries_cloudagent/vc/tests/document_loader.py index 672fe9139a..e53c687310 100644 --- a/aries_cloudagent/vc/tests/document_loader.py +++ b/aries_cloudagent/vc/tests/document_loader.py @@ -1,32 +1,32 @@ +from ..ld_proofs.constants import ( + CREDENTIALS_CONTEXT_V1_URL, + DID_V1_CONTEXT_URL, + SECURITY_CONTEXT_BBS_URL, + SECURITY_CONTEXT_ED25519_2020_URL, + SECURITY_CONTEXT_V1_URL, + SECURITY_CONTEXT_V2_URL, + SECURITY_CONTEXT_V3_URL, +) from .contexts import ( + BBS_V1, + CITIZENSHIP_V1, + CREDENTIALS_V1, DID_V1, + DIF_PRESENTATION_SUBMISSION_V1, + ED25519_2020_V1, + EXAMPLES_V1, + ODRL, + SCHEMA_ORG, SECURITY_V1, SECURITY_V2, SECURITY_V3_UNSTABLE, - CREDENTIALS_V1, - EXAMPLES_V1, - BBS_V1, - ED25519_2020_V1, - CITIZENSHIP_V1, VACCINATION_V1, - ODRL, - SCHEMA_ORG, - DIF_PRESENTATION_SUBMISSION_V1, -) -from ..ld_proofs.constants import ( - SECURITY_CONTEXT_V2_URL, - SECURITY_CONTEXT_V1_URL, - DID_V1_CONTEXT_URL, - SECURITY_CONTEXT_BBS_URL, - CREDENTIALS_CONTEXT_V1_URL, - SECURITY_CONTEXT_V3_URL, - SECURITY_CONTEXT_ED25519_2020_URL, ) from .dids import ( - DID_z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL, - DID_zUC72Q7XD4PE4CrMiDVXuvZng3sBvMmaGgNeTUJuzavH2BS7ThbHL9FhsZM9QYY5fqAQ4MB8M9oudz3tfuaX36Ajr97QRW7LBt6WWmrtESe6Bs5NYzFtLWEmeVtvRYVAgjFcJSa, DID_EXAMPLE_48939859, DID_SOV_QqEfJxe752NCmWqR5TssZ5, + DID_z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL, + DID_zUC72Q7XD4PE4CrMiDVXuvZng3sBvMmaGgNeTUJuzavH2BS7ThbHL9FhsZM9QYY5fqAQ4MB8M9oudz3tfuaX36Ajr97QRW7LBt6WWmrtESe6Bs5NYzFtLWEmeVtvRYVAgjFcJSa, ) DOCUMENTS = { diff --git a/aries_cloudagent/vc/tests/test_bbs_mattr_interop.py b/aries_cloudagent/vc/tests/test_bbs_mattr_interop.py index d22d432b93..d893f94f70 100644 --- a/aries_cloudagent/vc/tests/test_bbs_mattr_interop.py +++ b/aries_cloudagent/vc/tests/test_bbs_mattr_interop.py @@ -1,33 +1,34 @@ from unittest import IsolatedAsyncioTestCase + import pytest +from ...core.in_memory import InMemoryProfile +from ...wallet.in_memory import InMemoryWallet from ...wallet.key_type import BLS12381G2 from ...wallet.util import b58_to_bytes -from ...wallet.in_memory import InMemoryWallet -from ...core.in_memory import InMemoryProfile from ..ld_proofs import ( - WalletKeyPair, AssertionProofPurpose, - verify, - sign, - derive, BbsBlsSignature2020, BbsBlsSignatureProof2020, + WalletKeyPair, + derive, + sign, + verify, ) -from .document_loader import custom_document_loader from .data import ( - BBS_PARTIAL_PROOF_NESTED_VC_MATTR, - BBS_VC_MATTR, + BBS_NESTED_VC_FULL_REVEAL_DOCUMENT_MATTR, BBS_NESTED_VC_MATTR, - BBS_VC_REVEAL_DOCUMENT_MATTR, + BBS_NESTED_VC_REVEAL_DOCUMENT_MATTR, + BBS_PARTIAL_PROOF_NESTED_VC_MATTR, BBS_PARTIAL_PROOF_VC_MATTR, BBS_PROOF_NESTED_VC_MATTR, BBS_PROOF_VC_MATTR, BBS_SIGNED_NESTED_VC_MATTR, BBS_SIGNED_VC_MATTR, - BBS_NESTED_VC_REVEAL_DOCUMENT_MATTR, - BBS_NESTED_VC_FULL_REVEAL_DOCUMENT_MATTR, + BBS_VC_MATTR, + BBS_VC_REVEAL_DOCUMENT_MATTR, ) +from .document_loader import custom_document_loader @pytest.mark.ursa_bbs_signatures diff --git a/aries_cloudagent/vc/vc_di/__init__.py b/aries_cloudagent/vc/vc_di/__init__.py index 2f6f01422d..8d62a6acd3 100644 --- a/aries_cloudagent/vc/vc_di/__init__.py +++ b/aries_cloudagent/vc/vc_di/__init__.py @@ -1,9 +1,9 @@ -from .verify import verify_signed_anoncredspresentation from .prove import ( + _load_w3c_credentials, create_signed_anoncreds_presentation, prepare_data_for_presentation, - _load_w3c_credentials, ) +from .verify import verify_signed_anoncredspresentation __all__ = [ "verify_signed_anoncredspresentation", diff --git a/aries_cloudagent/vc/vc_di/prove.py b/aries_cloudagent/vc/vc_di/prove.py index 7ba6d20866..779c6a581f 100644 --- a/aries_cloudagent/vc/vc_di/prove.py +++ b/aries_cloudagent/vc/vc_di/prove.py @@ -1,25 +1,24 @@ """Verifiable Credential and Presentation proving methods.""" import asyncio -from hashlib import sha256 import re +from hashlib import sha256 from typing import Any, Optional, Tuple +from anoncreds import ( + AnoncredsError, + CredentialRevocationState, + RevocationStatusList, + W3cCredential, +) + from aries_cloudagent.anoncreds.registry import AnonCredsRegistry from aries_cloudagent.revocation.models.revocation_registry import RevocationRegistry -from ..ld_proofs import ( - ProofPurpose, - LinkedDataProofException, -) + from ...anoncreds.holder import AnonCredsHolder, AnonCredsHolderError from ...anoncreds.verifier import AnonCredsVerifier from ...core.profile import Profile -from anoncreds import ( - W3cCredential, - RevocationStatusList, - CredentialRevocationState, - AnoncredsError, -) +from ..ld_proofs import LinkedDataProofException, ProofPurpose async def create_signed_anoncreds_presentation( diff --git a/aries_cloudagent/vc/vc_di/tests/test_manager.py b/aries_cloudagent/vc/vc_di/tests/test_manager.py index 7d23016cc0..2bbf1b3a98 100644 --- a/aries_cloudagent/vc/vc_di/tests/test_manager.py +++ b/aries_cloudagent/vc/vc_di/tests/test_manager.py @@ -1,10 +1,11 @@ """Test VCDIManager.""" import pytest +from anoncreds import W3cPresentation from aries_cloudagent.anoncreds.registry import AnonCredsRegistry from aries_cloudagent.tests import mock -from anoncreds import W3cPresentation + from ....core.in_memory.profile import InMemoryProfile from ....core.profile import Profile from ....resolver.default.key import KeyDIDResolver @@ -15,9 +16,8 @@ ) from ....wallet.did_method import DIDMethods from ...ld_proofs.document_loader import DocumentLoader -from ..manager import VcDiManager, VcDiManagerError from ...vc_ld.models.presentation import VerifiablePresentation - +from ..manager import VcDiManager, VcDiManagerError CHALLENGE = "3fa85f64-5717-4562-b3fc-2c963f66afa7" OPTIONS = { diff --git a/aries_cloudagent/vc/vc_di/tests/test_prove.py b/aries_cloudagent/vc/vc_di/tests/test_prove.py index a749cc9d93..404c3f621c 100644 --- a/aries_cloudagent/vc/vc_di/tests/test_prove.py +++ b/aries_cloudagent/vc/vc_di/tests/test_prove.py @@ -1,12 +1,15 @@ """test prove.py""" import pytest +from anoncreds import CredentialRevocationState, RevocationStatusList + from aries_cloudagent.anoncreds.holder import AnonCredsHolder, AnonCredsHolderError +from aries_cloudagent.anoncreds.registry import AnonCredsRegistry from aries_cloudagent.anoncreds.tests.mock_objects import MOCK_W3CPRES from aries_cloudagent.revocation.models.revocation_registry import RevocationRegistry -from aries_cloudagent.vc.ld_proofs.error import LinkedDataProofException -from aries_cloudagent.anoncreds.registry import AnonCredsRegistry from aries_cloudagent.tests import mock +from aries_cloudagent.vc.ld_proofs.error import LinkedDataProofException + from ....core.in_memory.profile import InMemoryProfile from ....core.profile import Profile from ....resolver.default.key import KeyDIDResolver @@ -17,7 +20,6 @@ ) from ....wallet.did_method import DIDMethods from ...ld_proofs.document_loader import DocumentLoader - from ..prove import ( _extract_cred_idx, _get_predicate_type_and_value, @@ -26,7 +28,6 @@ create_signed_anoncreds_presentation, ) from .test_manager import VC -from anoncreds import RevocationStatusList, CredentialRevocationState @pytest.fixture diff --git a/aries_cloudagent/vc/vc_di/verify.py b/aries_cloudagent/vc/vc_di/verify.py index 610a32ef33..8710264f74 100644 --- a/aries_cloudagent/vc/vc_di/verify.py +++ b/aries_cloudagent/vc/vc_di/verify.py @@ -1,17 +1,14 @@ """Verifiable Credential and Presentation verification methods.""" +from anoncreds import AnoncredsError + from aries_cloudagent.anoncreds.holder import AnonCredsHolderError -from ...core.profile import Profile + from ...anoncreds.verifier import AnonCredsVerifier -from ..ld_proofs import ( - ProofPurpose, -) +from ...core.profile import Profile +from ..ld_proofs import ProofPurpose from ..vc_ld.validation_result import PresentationVerificationResult -from .prove import ( - prepare_data_for_presentation, - _load_w3c_credentials, -) -from anoncreds import AnoncredsError +from .prove import _load_w3c_credentials, prepare_data_for_presentation async def verify_signed_anoncredspresentation( diff --git a/aries_cloudagent/vc/vc_ld/__init__.py b/aries_cloudagent/vc/vc_ld/__init__.py index ff20e7fea0..2ef21246b8 100644 --- a/aries_cloudagent/vc/vc_ld/__init__.py +++ b/aries_cloudagent/vc/vc_ld/__init__.py @@ -1,14 +1,12 @@ from .issue import issue as issue_vc -from .verify import verify_presentation, verify_credential -from .prove import create_presentation, sign_presentation, derive_credential +from .models import _CredentialSchema as CredentialSchema +from .models import _LDProof as LDProof +from .models import _LinkedDataProofSchema as LinkedDataProofSchema +from .models import _VerifiableCredential as VerifiableCredential +from .models import _VerifiableCredentialSchema as VerifiableCredentialSchema +from .prove import create_presentation, derive_credential, sign_presentation from .validation_result import PresentationVerificationResult -from .models import ( - _VerifiableCredential as VerifiableCredential, - _LDProof as LDProof, - _LinkedDataProofSchema as LinkedDataProofSchema, - _VerifiableCredentialSchema as VerifiableCredentialSchema, - _CredentialSchema as CredentialSchema, -) +from .verify import verify_credential, verify_presentation __all__ = [ "issue_vc", diff --git a/aries_cloudagent/vc/vc_ld/issue.py b/aries_cloudagent/vc/vc_ld/issue.py index 9fba814261..0939a108a5 100644 --- a/aries_cloudagent/vc/vc_ld/issue.py +++ b/aries_cloudagent/vc/vc_ld/issue.py @@ -1,12 +1,12 @@ """Verifiable Credential issuance methods.""" from ..ld_proofs import ( - LinkedDataProof, - ProofPurpose, - sign, CredentialIssuancePurpose, DocumentLoaderMethod, + LinkedDataProof, LinkedDataProofException, + ProofPurpose, + sign, ) from .models.credential import CredentialSchema diff --git a/aries_cloudagent/vc/vc_ld/models/__init__.py b/aries_cloudagent/vc/vc_ld/models/__init__.py index ee56cef5bd..2c097d036f 100644 --- a/aries_cloudagent/vc/vc_ld/models/__init__.py +++ b/aries_cloudagent/vc/vc_ld/models/__init__.py @@ -1,12 +1,8 @@ -from .credential import ( - VerifiableCredential as _VerifiableCredential, - VerifiableCredentialSchema as _VerifiableCredentialSchema, - CredentialSchema as _CredentialSchema, -) -from .linked_data_proof import ( - LDProof as _LDProof, - LinkedDataProofSchema as _LinkedDataProofSchema, -) +from .credential import CredentialSchema as _CredentialSchema +from .credential import VerifiableCredential as _VerifiableCredential +from .credential import VerifiableCredentialSchema as _VerifiableCredentialSchema +from .linked_data_proof import LDProof as _LDProof +from .linked_data_proof import LinkedDataProofSchema as _LinkedDataProofSchema __all__ = [ "_VerifiableCredential", diff --git a/aries_cloudagent/vc/vc_ld/models/presentation.py b/aries_cloudagent/vc/vc_ld/models/presentation.py index 44d7934783..06d437f743 100644 --- a/aries_cloudagent/vc/vc_ld/models/presentation.py +++ b/aries_cloudagent/vc/vc_ld/models/presentation.py @@ -3,6 +3,7 @@ from typing import List, Optional, Union from marshmallow import INCLUDE, ValidationError, fields, post_dump + from ....messaging.models.base import BaseModel, BaseModelSchema from ....messaging.valid import ( CREDENTIAL_CONTEXT_VALIDATE, diff --git a/aries_cloudagent/vc/vc_ld/models/web_schemas.py b/aries_cloudagent/vc/vc_ld/models/web_schemas.py index 46c7cb39e0..6bd6a93035 100644 --- a/aries_cloudagent/vc/vc_ld/models/web_schemas.py +++ b/aries_cloudagent/vc/vc_ld/models/web_schemas.py @@ -1,20 +1,12 @@ """VC-API routes web requests schemas.""" from marshmallow import fields -from ....messaging.models.openapi import OpenAPISchema -from ..validation_result import ( - PresentationVerificationResultSchema, -) +from ....messaging.models.openapi import OpenAPISchema +from ..validation_result import PresentationVerificationResultSchema +from .credential import CredentialSchema, VerifiableCredentialSchema from .options import LDProofVCOptionsSchema -from .credential import ( - CredentialSchema, - VerifiableCredentialSchema, -) -from .presentation import ( - PresentationSchema, - VerifiablePresentationSchema, -) +from .presentation import PresentationSchema, VerifiablePresentationSchema class ListCredentialsResponse(OpenAPISchema): diff --git a/aries_cloudagent/vc/vc_ld/prove.py b/aries_cloudagent/vc/vc_ld/prove.py index 056dd877a6..24b2ee9861 100644 --- a/aries_cloudagent/vc/vc_ld/prove.py +++ b/aries_cloudagent/vc/vc_ld/prove.py @@ -2,15 +2,14 @@ from typing import List - from ..ld_proofs import ( AuthenticationProofPurpose, - ProofPurpose, DocumentLoaderMethod, - sign, LinkedDataProof, LinkedDataProofException, + ProofPurpose, derive, + sign, ) from ..ld_proofs.constants import CREDENTIALS_CONTEXT_V1_URL from .models.credential import VerifiableCredentialSchema diff --git a/aries_cloudagent/vc/vc_ld/tests/test_credential.py b/aries_cloudagent/vc/vc_ld/tests/test_credential.py index b3b5851f98..c3b20e87bf 100644 --- a/aries_cloudagent/vc/vc_ld/tests/test_credential.py +++ b/aries_cloudagent/vc/vc_ld/tests/test_credential.py @@ -1,8 +1,4 @@ -from ...ld_proofs import ( - DocumentVerificationResult, - ProofResult, - PurposeResult, -) +from ...ld_proofs import DocumentVerificationResult, ProofResult, PurposeResult # All signed documents manually tested for validity on https://univerifier.io diff --git a/aries_cloudagent/vc/vc_ld/tests/test_manager.py b/aries_cloudagent/vc/vc_ld/tests/test_manager.py index fbe095ac44..677cad3a1f 100644 --- a/aries_cloudagent/vc/vc_ld/tests/test_manager.py +++ b/aries_cloudagent/vc/vc_ld/tests/test_manager.py @@ -9,14 +9,14 @@ from ....did.did_key import DIDKey from ....resolver.default.key import KeyDIDResolver from ....resolver.did_resolver import DIDResolver -from ....wallet.base import BaseWallet from ....storage.vc_holder.base import VCHolder +from ....wallet.base import BaseWallet from ....wallet.default_verification_key_strategy import ( BaseVerificationKeyStrategy, DefaultVerificationKeyStrategy, ) from ....wallet.did_info import DIDInfo -from ....wallet.did_method import DIDMethod, DIDMethods, KEY, SOV +from ....wallet.did_method import KEY, SOV, DIDMethod, DIDMethods from ....wallet.error import WalletNotFoundError from ....wallet.key_type import BLS12381G2, ED25519 from ...ld_proofs.constants import ( diff --git a/aries_cloudagent/vc/vc_ld/tests/test_vc_ld.py b/aries_cloudagent/vc/vc_ld/tests/test_vc_ld.py index 1190d7277b..78f621a2b9 100644 --- a/aries_cloudagent/vc/vc_ld/tests/test_vc_ld.py +++ b/aries_cloudagent/vc/vc_ld/tests/test_vc_ld.py @@ -1,40 +1,39 @@ -from unittest import IsolatedAsyncioTestCase -from unittest import mock from datetime import datetime +from unittest import IsolatedAsyncioTestCase, mock import pytest -from ....wallet.key_type import BLS12381G2, ED25519 +from ....core.in_memory import InMemoryProfile from ....did.did_key import DIDKey from ....wallet.in_memory import InMemoryWallet -from ....core.in_memory import InMemoryProfile +from ....wallet.key_type import BLS12381G2, ED25519 from ...ld_proofs import ( + BbsBlsSignature2020, Ed25519Signature2018, Ed25519Signature2020, WalletKeyPair, - BbsBlsSignature2020, ) +from ...ld_proofs.error import LinkedDataProofException +from ...tests.document_loader import custom_document_loader from ...vc_ld import ( - issue_vc as issue, - verify_credential, create_presentation, + derive_credential, sign_presentation, + verify_credential, verify_presentation, - derive_credential, ) -from ...ld_proofs.error import LinkedDataProofException -from ...tests.document_loader import custom_document_loader +from ...vc_ld import issue_vc as issue from .test_credential import ( - CREDENTIAL_TEMPLATE, CREDENTIAL_ISSUED, - CREDENTIAL_VERIFIED, - CREDENTIAL_TEMPLATE_2020, CREDENTIAL_ISSUED_2020, + CREDENTIAL_ISSUED_BBS, + CREDENTIAL_TEMPLATE, + CREDENTIAL_TEMPLATE_2020, + CREDENTIAL_TEMPLATE_BBS, + CREDENTIAL_VERIFIED, CREDENTIAL_VERIFIED_2020, PRESENTATION_SIGNED, PRESENTATION_UNSIGNED, - CREDENTIAL_TEMPLATE_BBS, - CREDENTIAL_ISSUED_BBS, ) diff --git a/aries_cloudagent/vc/vc_ld/verify.py b/aries_cloudagent/vc/vc_ld/verify.py index 4cbd0a8775..1dd3f51ec5 100644 --- a/aries_cloudagent/vc/vc_ld/verify.py +++ b/aries_cloudagent/vc/vc_ld/verify.py @@ -2,18 +2,19 @@ import asyncio from typing import List + from pyld.jsonld import JsonLdProcessor from ..ld_proofs import ( - LinkedDataProof, + AuthenticationProofPurpose, CredentialIssuancePurpose, DocumentLoaderMethod, - ProofPurpose, - AuthenticationProofPurpose, - verify as ld_proofs_verify, DocumentVerificationResult, + LinkedDataProof, LinkedDataProofException, + ProofPurpose, ) +from ..ld_proofs import verify as ld_proofs_verify from .models.credential import VerifiableCredentialSchema from .validation_result import PresentationVerificationResult diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index 5182aebb66..b885843b3b 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -5,14 +5,7 @@ import logging from typing import List, Optional, Sequence, Tuple, Union, cast -from aries_askar import ( - AskarError, - AskarErrorCode, - Entry, - Key, - KeyAlg, - SeedMethod, -) +from aries_askar import AskarError, AskarErrorCode, Entry, Key, KeyAlg, SeedMethod from ..askar.didcomm.v1 import pack_message, unpack_message from ..askar.profile import AskarProfileSession @@ -22,11 +15,7 @@ from ..storage.askar import AskarStorage from ..storage.base import StorageDuplicateError, StorageNotFoundError, StorageRecord from .base import BaseWallet, DIDInfo, KeyInfo -from .crypto import ( - sign_message, - validate_seed, - verify_signed_message, -) +from .crypto import sign_message, validate_seed, verify_signed_message from .did_info import INVITATION_REUSE_KEY from .did_method import SOV, DIDMethod, DIDMethods from .did_parameters_validation import DIDParametersValidation diff --git a/aries_cloudagent/wallet/bbs.py b/aries_cloudagent/wallet/bbs.py index 582c08d943..3fa54621ba 100644 --- a/aries_cloudagent/wallet/bbs.py +++ b/aries_cloudagent/wallet/bbs.py @@ -10,20 +10,10 @@ from ..wallet.util import random_seed if is_ursa_bbs_signatures_module_installed(): - from ursa_bbs_signatures import ( - BbsException as NativeBbsException, - ) - from ursa_bbs_signatures import ( - BlsKeyPair, - SignRequest, - VerifyRequest, - ) - from ursa_bbs_signatures import ( - sign as bbs_sign, - ) - from ursa_bbs_signatures import ( - verify as bbs_verify, - ) + from ursa_bbs_signatures import BbsException as NativeBbsException + from ursa_bbs_signatures import BlsKeyPair, SignRequest, VerifyRequest + from ursa_bbs_signatures import sign as bbs_sign + from ursa_bbs_signatures import verify as bbs_verify from ursa_bbs_signatures._ffi.FfiException import FfiException diff --git a/aries_cloudagent/wallet/default_verification_key_strategy.py b/aries_cloudagent/wallet/default_verification_key_strategy.py index 82e0dd88e5..bd0202ac8e 100644 --- a/aries_cloudagent/wallet/default_verification_key_strategy.py +++ b/aries_cloudagent/wallet/default_verification_key_strategy.py @@ -1,13 +1,11 @@ """Utilities for specifying which verification method is in use for a given DID.""" from abc import ABC, abstractmethod -from typing import Optional, List +from typing import List, Optional from aries_cloudagent.core.profile import Profile - -from aries_cloudagent.wallet.key_type import KeyType - from aries_cloudagent.did.did_key import DIDKey +from aries_cloudagent.wallet.key_type import KeyType class BaseVerificationKeyStrategy(ABC): diff --git a/aries_cloudagent/wallet/did_info.py b/aries_cloudagent/wallet/did_info.py index fb25ebe9b4..3ef891a966 100644 --- a/aries_cloudagent/wallet/did_info.py +++ b/aries_cloudagent/wallet/did_info.py @@ -5,7 +5,6 @@ from .did_method import DIDMethod from .key_type import KeyType - INVITATION_REUSE_KEY = "invitation_reuse" KeyInfo = NamedTuple( diff --git a/aries_cloudagent/wallet/did_parameters_validation.py b/aries_cloudagent/wallet/did_parameters_validation.py index 93f72194e2..f5e79c27f5 100644 --- a/aries_cloudagent/wallet/did_parameters_validation.py +++ b/aries_cloudagent/wallet/did_parameters_validation.py @@ -4,11 +4,11 @@ from aries_cloudagent.did.did_key import DIDKey from aries_cloudagent.wallet.did_method import ( - DIDMethods, - DIDMethod, - HolderDefinedDid, KEY, SOV, + DIDMethod, + DIDMethods, + HolderDefinedDid, ) from aries_cloudagent.wallet.error import WalletError from aries_cloudagent.wallet.key_type import KeyType diff --git a/aries_cloudagent/wallet/jwt.py b/aries_cloudagent/wallet/jwt.py index ee4bd574e3..bf16bfb790 100644 --- a/aries_cloudagent/wallet/jwt.py +++ b/aries_cloudagent/wallet/jwt.py @@ -12,8 +12,8 @@ from ..messaging.jsonld.routes import SUPPORTED_VERIFICATION_METHOD_TYPES from ..messaging.models.base import BaseModel, BaseModelSchema from ..resolver.did_resolver import DIDResolver -from .default_verification_key_strategy import BaseVerificationKeyStrategy from .base import BaseWallet +from .default_verification_key_strategy import BaseVerificationKeyStrategy from .key_type import ED25519 from .util import b64_to_bytes, bytes_to_b64 diff --git a/aries_cloudagent/wallet/models/tests/test_wallet_record.py b/aries_cloudagent/wallet/models/tests/test_wallet_record.py index bc1b51bdb1..70299b93d9 100644 --- a/aries_cloudagent/wallet/models/tests/test_wallet_record.py +++ b/aries_cloudagent/wallet/models/tests/test_wallet_record.py @@ -1,7 +1,7 @@ from unittest import IsolatedAsyncioTestCase -from ..wallet_record import WalletRecord from ...error import WalletSettingsError +from ..wallet_record import WalletRecord class TestWalletRecord(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/wallet/tests/conftest.py b/aries_cloudagent/wallet/tests/conftest.py index eed9e1aef7..2f83179484 100644 --- a/aries_cloudagent/wallet/tests/conftest.py +++ b/aries_cloudagent/wallet/tests/conftest.py @@ -1,4 +1,5 @@ import pytest + from aries_cloudagent.resolver.did_resolver import DIDResolver from aries_cloudagent.resolver.tests.test_did_resolver import MockResolver from aries_cloudagent.wallet.default_verification_key_strategy import ( diff --git a/aries_cloudagent/wallet/tests/test_bbs.py b/aries_cloudagent/wallet/tests/test_bbs.py index 3061b8d4bc..54c703e16c 100644 --- a/aries_cloudagent/wallet/tests/test_bbs.py +++ b/aries_cloudagent/wallet/tests/test_bbs.py @@ -1,11 +1,12 @@ from unittest import TestCase + import pytest from ..bbs import ( + BbsException, + create_bls12381g2_keypair, sign_messages_bls12381g2, verify_signed_messages_bls12381g2, - create_bls12381g2_keypair, - BbsException, ) PUBLIC_KEY_BYTES = b"\x8c\xa2\xbe \xad\x9c\xf9\x98\x04e\x17\xec\x00\xf9J\xd7\xed\xdb\xa4\x0el\x9fG\x94\x9b+d\xac\xf5\x0f{\xf3\xa1\xc7\xd9\xa7*YZ\xa78\x86\x8b\xcc\xb8\x9d\x86\xcb\x07\x8b\xfak9\xd8\xb8\\\x93\x86\xc8\xf7\xb1O\x88\x17\xa4\xc9x5\xdd\x04e\xee'\xff\x05\xf8&EU\xfa\x8f\x83\xa3#\xca\x9b\xdf\xa8\xc2\xda\x0fz\x8f\x05@o" diff --git a/aries_cloudagent/wallet/tests/test_crypto.py b/aries_cloudagent/wallet/tests/test_crypto.py index 01dd3fefc7..0596f30821 100644 --- a/aries_cloudagent/wallet/tests/test_crypto.py +++ b/aries_cloudagent/wallet/tests/test_crypto.py @@ -1,14 +1,13 @@ -import pytest import json +from unittest import TestCase, mock -from unittest import mock -from unittest import TestCase +import pytest -from ..key_type import BLS12381G1, ED25519 -from ..error import WalletError from ...utils.jwe import JweRecipient -from ..util import str_to_b64 from .. import crypto as test_module +from ..error import WalletError +from ..key_type import BLS12381G1, ED25519 +from ..util import str_to_b64 SEED_B64 = "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=" SEED = "00000000000000000000000000000000" diff --git a/aries_cloudagent/wallet/tests/test_default_verification_key_strategy.py b/aries_cloudagent/wallet/tests/test_default_verification_key_strategy.py index 530956e044..82fbe603ec 100644 --- a/aries_cloudagent/wallet/tests/test_default_verification_key_strategy.py +++ b/aries_cloudagent/wallet/tests/test_default_verification_key_strategy.py @@ -1,9 +1,7 @@ from unittest import IsolatedAsyncioTestCase from aries_cloudagent.core.in_memory import InMemoryProfile - from aries_cloudagent.did.did_key import DIDKey - from aries_cloudagent.wallet.default_verification_key_strategy import ( DefaultVerificationKeyStrategy, ) diff --git a/aries_cloudagent/wallet/tests/test_did_method.py b/aries_cloudagent/wallet/tests/test_did_method.py index 6c84c1312b..9777cef1dc 100644 --- a/aries_cloudagent/wallet/tests/test_did_method.py +++ b/aries_cloudagent/wallet/tests/test_did_method.py @@ -1,6 +1,5 @@ from unittest import TestCase - from ..key_type import BLS12381G1, BLS12381G1G2, BLS12381G2, ED25519, X25519, KeyTypes ED25519_PREFIX_BYTES = b"\xed\x01" diff --git a/aries_cloudagent/wallet/tests/test_did_parameters_validation.py b/aries_cloudagent/wallet/tests/test_did_parameters_validation.py index 73565f827f..ad67f8c825 100644 --- a/aries_cloudagent/wallet/tests/test_did_parameters_validation.py +++ b/aries_cloudagent/wallet/tests/test_did_parameters_validation.py @@ -1,9 +1,9 @@ import pytest -from aries_cloudagent.wallet.did_method import DIDMethods, DIDMethod, HolderDefinedDid +from aries_cloudagent.wallet.did_method import DIDMethod, DIDMethods, HolderDefinedDid from aries_cloudagent.wallet.did_parameters_validation import DIDParametersValidation from aries_cloudagent.wallet.error import WalletError -from aries_cloudagent.wallet.key_type import ED25519, BLS12381G1 +from aries_cloudagent.wallet.key_type import BLS12381G1, ED25519 @pytest.fixture diff --git a/aries_cloudagent/wallet/tests/test_jwt.py b/aries_cloudagent/wallet/tests/test_jwt.py index 79470666fd..f84feb9700 100644 --- a/aries_cloudagent/wallet/tests/test_jwt.py +++ b/aries_cloudagent/wallet/tests/test_jwt.py @@ -3,7 +3,6 @@ from aries_cloudagent.wallet.key_type import ED25519 from ...wallet.did_method import KEY - from ..jwt import jwt_sign, jwt_verify, resolve_public_key_by_kid_for_verify diff --git a/aries_cloudagent/wallet/tests/test_key_pair.py b/aries_cloudagent/wallet/tests/test_key_pair.py index 9126f15d6e..df5dee848e 100644 --- a/aries_cloudagent/wallet/tests/test_key_pair.py +++ b/aries_cloudagent/wallet/tests/test_key_pair.py @@ -1,13 +1,12 @@ -from unittest import IsolatedAsyncioTestCase - import json +from unittest import IsolatedAsyncioTestCase -from ...storage.error import StorageNotFoundError -from ..util import bytes_to_b58 -from ..key_type import ED25519 from ...core.in_memory import InMemoryProfile +from ...storage.error import StorageNotFoundError from ...storage.in_memory import InMemoryStorage -from ..key_pair import KeyPairStorageManager, KEY_PAIR_STORAGE_TYPE +from ..key_pair import KEY_PAIR_STORAGE_TYPE, KeyPairStorageManager +from ..key_type import ED25519 +from ..util import bytes_to_b58 class TestKeyPairStorageManager(IsolatedAsyncioTestCase): diff --git a/aries_cloudagent/wallet/tests/test_sd_jwt.py b/aries_cloudagent/wallet/tests/test_sd_jwt.py index 9282c87b9c..c0fc3c9c32 100644 --- a/aries_cloudagent/wallet/tests/test_sd_jwt.py +++ b/aries_cloudagent/wallet/tests/test_sd_jwt.py @@ -1,10 +1,11 @@ -from base64 import urlsafe_b64decode import json +from base64 import urlsafe_b64decode + import pytest from ...wallet.did_method import KEY -from ...wallet.key_type import ED25519 from ...wallet.jwt import jwt_sign +from ...wallet.key_type import ED25519 from ..sd_jwt import SDJWTVerifyResult, sd_jwt_sign, sd_jwt_verify diff --git a/aries_cloudagent/wallet/tests/test_util.py b/aries_cloudagent/wallet/tests/test_util.py index 7548360dc1..ccd2973f18 100644 --- a/aries_cloudagent/wallet/tests/test_util.py +++ b/aries_cloudagent/wallet/tests/test_util.py @@ -8,12 +8,11 @@ bytes_to_b64, full_verkey, pad, - str_to_b64, set_urlsafe_b64, + str_to_b64, unpad, ) - BYTES = b"\xe0\xa0\xbe" # chr(2110).encode(), least with + in b64 encoding STR = "Hello World" # b64encodes to SGVsbG8gV29ybGQ= diff --git a/aries_cloudagent/wallet/util.py b/aries_cloudagent/wallet/util.py index 1d629325a8..7fe01ab7ab 100644 --- a/aries_cloudagent/wallet/util.py +++ b/aries_cloudagent/wallet/util.py @@ -1,12 +1,11 @@ """Wallet utility functions.""" +import base64 import re import base58 -import base64 - -import nacl.utils import nacl.bindings +import nacl.utils from ..core.profile import Profile diff --git a/conftest.py b/conftest.py index 5ab1eeb148..d92c54c430 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,7 @@ import os import sys from unittest import mock + import pytest STUBS = {} diff --git a/demo/features/environment.py b/demo/features/environment.py index 9ca2e341c3..12b6288895 100644 --- a/demo/features/environment.py +++ b/demo/features/environment.py @@ -1,6 +1,4 @@ -from bdd_support.agent_backchannel_client import ( - aries_container_terminate, -) +from bdd_support.agent_backchannel_client import aries_container_terminate def before_feature(context, feature): diff --git a/demo/features/steps/0160-connection.py b/demo/features/steps/0160-connection.py index a9006e3378..344e506960 100644 --- a/demo/features/steps/0160-connection.py +++ b/demo/features/steps/0160-connection.py @@ -8,18 +8,17 @@ # # ----------------------------------------------------------- -from behave import given, when, then import json import os from bdd_support.agent_backchannel_client import ( - create_agent_container_with_args, - aries_container_initialize, + aries_container_detect_connection, aries_container_generate_invitation, + aries_container_initialize, aries_container_receive_invitation, - aries_container_detect_connection, + create_agent_container_with_args, ) - +from behave import given, then, when BDD_EXTRA_AGENT_ARGS = os.getenv("BDD_EXTRA_AGENT_ARGS") AGENT_PORT = os.getenv("AGENT_PORT", "8020") diff --git a/demo/features/steps/0453-issue-credential.py b/demo/features/steps/0453-issue-credential.py index 927de8c087..97106d3e1d 100644 --- a/demo/features/steps/0453-issue-credential.py +++ b/demo/features/steps/0453-issue-credential.py @@ -13,9 +13,7 @@ read_schema_data, ) from behave import given, then, when -from runners.support.agent import ( - DID_METHOD_KEY, -) +from runners.support.agent import DID_METHOD_KEY def is_anoncreds(agent): diff --git a/demo/features/steps/0454-present-proof.py b/demo/features/steps/0454-present-proof.py index 6440ee3d1a..984ee72e63 100644 --- a/demo/features/steps/0454-present-proof.py +++ b/demo/features/steps/0454-present-proof.py @@ -1,12 +1,11 @@ -from behave import when, then - from bdd_support.agent_backchannel_client import ( - read_proof_req_data, + agent_container_POST, aries_container_request_proof, aries_container_verify_proof, - agent_container_POST, async_sleep, + read_proof_req_data, ) +from behave import then, when # This step is defined in another feature file # Given "Acme" and "Bob" have an existing connection diff --git a/demo/features/steps/taa-txn-author-agreement.py b/demo/features/steps/taa-txn-author-agreement.py index ee15b250e1..c5131fc126 100644 --- a/demo/features/steps/taa-txn-author-agreement.py +++ b/demo/features/steps/taa-txn-author-agreement.py @@ -1,10 +1,9 @@ -from behave import given, when, then - from bdd_support.agent_backchannel_client import ( agent_container_GET, agent_container_POST, agent_container_PUT, ) +from behave import given, then, when @given('"{issuer}" connects to a ledger that requires acceptance of the TAA') diff --git a/demo/features/steps/upgrade.py b/demo/features/steps/upgrade.py index fe23f2570e..c7169e779c 100644 --- a/demo/features/steps/upgrade.py +++ b/demo/features/steps/upgrade.py @@ -1,9 +1,6 @@ """Steps for upgrading the wallet to support anoncreds.""" -from bdd_support.agent_backchannel_client import ( - agent_container_POST, - async_sleep, -) +from bdd_support.agent_backchannel_client import agent_container_POST, async_sleep from behave import given, then diff --git a/demo/playground/examples/tests/__init__.py b/demo/playground/examples/tests/__init__.py index 6e1d83c693..25e55628ef 100644 --- a/demo/playground/examples/tests/__init__.py +++ b/demo/playground/examples/tests/__init__.py @@ -1,9 +1,9 @@ # pylint: disable=redefined-outer-name -from functools import wraps import logging import os import time +from functools import wraps import pytest import requests diff --git a/demo/playground/examples/tests/test_mediator_ping_agents.py b/demo/playground/examples/tests/test_mediator_ping_agents.py index 12eb0155af..d734dc14d7 100644 --- a/demo/playground/examples/tests/test_mediator_ping_agents.py +++ b/demo/playground/examples/tests/test_mediator_ping_agents.py @@ -3,14 +3,14 @@ # pylint: disable=redefined-outer-name import base64 +import json as jsonlib import os -import pytest import time import uuid -import json as jsonlib +import pytest -from . import logger, Agent, FABER, ALICE, MULTI +from . import ALICE, FABER, MULTI, Agent, logger # add a blank line... logger.info("start testing mediated connections...") diff --git a/demo/playground/examples/tests/test_ping_agents.py b/demo/playground/examples/tests/test_ping_agents.py index 86e7b65188..64cb4cdad1 100644 --- a/demo/playground/examples/tests/test_ping_agents.py +++ b/demo/playground/examples/tests/test_ping_agents.py @@ -3,11 +3,12 @@ # pylint: disable=redefined-outer-name import os -import pytest import time import uuid -from . import logger, Agent, FABER, ALICE, MULTI +import pytest + +from . import ALICE, FABER, MULTI, Agent, logger @pytest.fixture(scope="session") diff --git a/demo/runners/acme.py b/demo/runners/acme.py index b2115bfc20..61208ba8be 100644 --- a/demo/runners/acme.py +++ b/demo/runners/acme.py @@ -6,9 +6,9 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # noqa from runners.agent_container import ( # noqa:E402 + AriesAgent, arg_parser, create_agent_with_args, - AriesAgent, ) from runners.support.utils import ( # noqa:E402 check_requires, @@ -18,7 +18,6 @@ prompt_loop, ) - CRED_PREVIEW_TYPE = "https://didcomm.org/issue-credential/2.0/credential-preview" SELF_ATTESTED = os.getenv("SELF_ATTESTED") TAILS_FILE_COUNT = int(os.getenv("TAILS_FILE_COUNT", 100)) diff --git a/demo/runners/alice.py b/demo/runners/alice.py index a65baf3654..999803eb1b 100644 --- a/demo/runners/alice.py +++ b/demo/runners/alice.py @@ -10,9 +10,9 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from runners.agent_container import ( # noqa:E402 + AriesAgent, arg_parser, create_agent_with_args, - AriesAgent, ) from runners.support.utils import ( # noqa:E402 check_requires, @@ -23,7 +23,6 @@ prompt_loop, ) - DEMO_EXTRA_AGENT_ARGS = os.getenv("DEMO_EXTRA_AGENT_ARGS") logging.basicConfig(level=logging.WARNING) diff --git a/demo/runners/faber.py b/demo/runners/faber.py index 19d7ba0b05..5cecf47d37 100644 --- a/demo/runners/faber.py +++ b/demo/runners/faber.py @@ -22,12 +22,7 @@ CRED_FORMAT_VC_DI, SIG_TYPE_BLS, ) -from runners.support.utils import ( # noqa:E402 - log_msg, - log_status, - prompt, - prompt_loop, -) +from runners.support.utils import log_msg, log_status, prompt, prompt_loop # noqa:E402 CRED_PREVIEW_TYPE = "https://didcomm.org/issue-credential/2.0/credential-preview" SELF_ATTESTED = os.getenv("SELF_ATTESTED") diff --git a/demo/runners/performance.py b/demo/runners/performance.py index 629bec9e96..9776f0ae06 100644 --- a/demo/runners/performance.py +++ b/demo/runners/performance.py @@ -3,16 +3,15 @@ import os import random import sys - from typing import Tuple sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from runners.support.agent import ( # noqa:E402 DemoAgent, + connect_wallet_to_mediator, default_genesis_txns, start_mediator_agent, - connect_wallet_to_mediator, ) from runners.support.utils import ( # noqa:E402 check_requires, diff --git a/demo/runners/support/utils.py b/demo/runners/support/utils.py index b69d24b42d..ebd8c9e67b 100644 --- a/demo/runners/support/utils.py +++ b/demo/runners/support/utils.py @@ -5,17 +5,15 @@ from timeit import default_timer import prompt_toolkit +import pygments from prompt_toolkit.application import run_in_terminal from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop +from prompt_toolkit.formatted_text import FormattedText, PygmentsTokens from prompt_toolkit.patch_stdout import patch_stdout from prompt_toolkit.shortcuts import ProgressBar - -import pygments from pygments.filter import Filter from pygments.lexer import Lexer from pygments.lexers.data import JsonLdLexer -from prompt_toolkit.formatted_text import FormattedText, PygmentsTokens - COLORIZE = bool(os.getenv("COLORIZE", True))