Skip to content

Commit

Permalink
🎨 organize imports (openwallet-foundation#3169)
Browse files Browse the repository at this point in the history
* 🎨 organize imports with `isort`

Signed-off-by: ff137 <[email protected]>

* 🎨 organize imports with `ruff check --select I --fix .`

Signed-off-by: ff137 <[email protected]>

* 🎨 ruff format

Signed-off-by: ff137 <[email protected]>

---------

Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 authored Aug 15, 2024
1 parent 4d9f164 commit e1b4d67
Show file tree
Hide file tree
Showing 481 changed files with 1,012 additions and 1,786 deletions.
5 changes: 1 addition & 4 deletions aries_cloudagent/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion aries_cloudagent/admin/tests/test_request_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 0 additions & 1 deletion aries_cloudagent/anoncreds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from ..config.injection_context import InjectionContext
from ..config.provider import ClassProvider

from .registry import AnonCredsRegistry

LOGGER = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Test DIDWebRegistry."""

import pytest
import re

import pytest

from ..registry import DIDWebRegistry

DID_WEB = re.compile(
Expand Down
5 changes: 1 addition & 4 deletions aries_cloudagent/anoncreds/default/legacy_indy/recover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
8 changes: 4 additions & 4 deletions aries_cloudagent/anoncreds/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 2 additions & 8 deletions aries_cloudagent/anoncreds/issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions aries_cloudagent/anoncreds/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions aries_cloudagent/anoncreds/tests/test_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions aries_cloudagent/anoncreds/tests/test_issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions aries_cloudagent/anoncreds/tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions aries_cloudagent/anoncreds/tests/test_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/anoncreds/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down
7 changes: 2 additions & 5 deletions aries_cloudagent/askar/didcomm/tests/test_v2.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
9 changes: 2 additions & 7 deletions aries_cloudagent/askar/didcomm/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions aries_cloudagent/askar/didcomm/v2.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
7 changes: 3 additions & 4 deletions aries_cloudagent/askar/profile_anon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import asyncio
import logging
import time

# import traceback

from typing import Any, Mapping
from weakref import ref

Expand All @@ -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__)

Expand Down
4 changes: 2 additions & 2 deletions aries_cloudagent/cache/tests/test_in_memory_cache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from asyncio import sleep, wait_for

import pytest

from ..base import CacheError
from ..in_memory import InMemoryCache

Expand Down
5 changes: 3 additions & 2 deletions aries_cloudagent/commands/help.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
8 changes: 4 additions & 4 deletions aries_cloudagent/commands/provision.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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


Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
3 changes: 1 addition & 2 deletions aries_cloudagent/commands/tests/test_help.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from unittest import mock
from unittest import IsolatedAsyncioTestCase
from unittest import IsolatedAsyncioTestCase, mock

from .. import help as command

Expand Down
3 changes: 1 addition & 2 deletions aries_cloudagent/commands/tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from unittest import mock
from unittest import IsolatedAsyncioTestCase
from unittest import IsolatedAsyncioTestCase, mock

from ... import commands as test_module

Expand Down
Loading

0 comments on commit e1b4d67

Please sign in to comment.