Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move modules into core and utils packages #301

Merged
merged 3 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aries_cloudagent/admin/error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Admin error classes."""

from ..error import BaseError
from ..core.error import BaseError


class AdminError(BaseError):
Expand Down
9 changes: 4 additions & 5 deletions aries_cloudagent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
from marshmallow import fields, Schema

from ..config.injection_context import InjectionContext
from ..messaging.plugin_registry import PluginRegistry
from ..core.plugin_registry import PluginRegistry
from ..messaging.responder import BaseResponder
from ..messaging.task_queue import TaskQueue
from ..stats import Collector
from ..transport.queue.basic import BasicMessageQueue
from ..transport.outbound.message import OutboundMessage
from ..utils.stats import Collector
from ..utils.task_queue import TaskQueue
from ..version import __version__

from .base_server import BaseAdminServer
from .error import AdminSetupError

from ..version import __version__

LOGGER = logging.getLogger(__name__)


Expand Down
4 changes: 2 additions & 2 deletions aries_cloudagent/admin/tests/test_admin_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from ...config.default_context import DefaultContextBuilder
from ...config.injection_context import InjectionContext
from ...config.provider import ClassProvider
from ...messaging.plugin_registry import PluginRegistry
from ...messaging.protocol_registry import ProtocolRegistry
from ...core.plugin_registry import PluginRegistry
from ...core.protocol_registry import ProtocolRegistry
from ...transport.outbound.message import OutboundMessage

from ..server import AdminServer
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/cache/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from abc import ABC, abstractmethod
from typing import Any, Sequence, Text, Union

from ..error import BaseError
from ..core.error import BaseError


class CacheError(BaseError):
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
except ImportError:
uvloop = None

from ..conductor import Conductor
from ..core.conductor import Conductor
from ..config import argparse as arg
from ..config.default_context import DefaultContextBuilder
from ..config.util import common_config
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC, abstractmethod
from typing import Mapping

from ..error import BaseError
from ..core.error import BaseError


class ConfigError(BaseError):
Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/config/default_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

from ..cache.base import BaseCache
from ..cache.basic import BasicCache
from ..core.plugin_registry import PluginRegistry
from ..core.protocol_registry import ProtocolRegistry
from ..ledger.base import BaseLedger
from ..ledger.provider import LedgerProvider
from ..issuer.base import BaseIssuer
from ..holder.base import BaseHolder
from ..verifier.base import BaseVerifier
from ..messaging.plugin_registry import PluginRegistry
from ..messaging.protocol_registry import ProtocolRegistry
from ..protocols.actionmenu.base_service import BaseMenuService
from ..protocols.actionmenu.driver_service import DriverMenuService
from ..protocols.introduction.base_service import BaseIntroductionService
from ..protocols.introduction.demo_service import DemoIntroductionService
from ..stats import Collector
from ..storage.base import BaseStorage
from ..storage.provider import StorageProvider
from ..transport.wire_format import BaseWireFormat
from ..utils.stats import Collector
from ..wallet.base import BaseWallet
from ..wallet.provider import WalletProvider

Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/config/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from prompt_toolkit.formatted_text import HTML

from ..ledger.base import BaseLedger
from ..transport.util import http_fetch, TransportFetchError
from ..utils.http import fetch, FetchError

from .base import ConfigError
from .injection_context import InjectionContext
Expand All @@ -25,8 +25,8 @@ async def fetch_genesis_transactions(genesis_url: str) -> str:
headers["Content-Type"] = "application/json"
LOGGER.info("Fetching genesis transactions from: %s", genesis_url)
try:
return await http_fetch(genesis_url, headers=headers)
except TransportFetchError as e:
return await fetch(genesis_url, headers=headers)
except FetchError as e:
raise ConfigError("Error retrieving ledger genesis transactions") from e


Expand Down
5 changes: 3 additions & 2 deletions aries_cloudagent/config/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from typing import Sequence, Union

from ..utils.classloader import ClassLoader
from ..utils.stats import Collector

from .base import BaseProvider, BaseSettings, BaseInjector
from ..classloader import ClassLoader
from ..stats import Collector


class InstanceProvider(BaseProvider):
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/config/tests/test_default_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from asynctest import TestCase as AsyncTestCase

from ...messaging.protocol_registry import ProtocolRegistry
from ...core.protocol_registry import ProtocolRegistry
from ...storage.base import BaseStorage
from ...transport.wire_format import BaseWireFormat
from ...wallet.base import BaseWallet
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,25 @@
import hashlib
import logging

from .admin.base_server import BaseAdminServer
from .admin.server import AdminServer
from .config.default_context import ContextBuilder
from .config.injection_context import InjectionContext
from .config.ledger import ledger_config
from .config.logging import LoggingConfigurator
from .config.wallet import wallet_config
from ..admin.base_server import BaseAdminServer
from ..admin.server import AdminServer
from ..config.default_context import ContextBuilder
from ..config.injection_context import InjectionContext
from ..config.ledger import ledger_config
from ..config.logging import LoggingConfigurator
from ..config.wallet import wallet_config
from ..messaging.responder import BaseResponder
from ..protocols.connections.manager import ConnectionManager, ConnectionManagerError
from ..transport.inbound.manager import InboundTransportManager
from ..transport.inbound.message import InboundMessage
from ..transport.outbound.base import OutboundDeliveryError
from ..transport.outbound.manager import OutboundTransportManager
from ..transport.outbound.message import OutboundMessage
from ..transport.wire_format import BaseWireFormat
from ..utils.task_queue import CompletedTask, TaskQueue
from ..utils.stats import Collector

from .dispatcher import Dispatcher
from .protocols.connections.manager import ConnectionManager, ConnectionManagerError
from .messaging.responder import BaseResponder
from .messaging.task_queue import CompletedTask, TaskQueue
from .stats import Collector
from .transport.inbound.manager import InboundTransportManager
from .transport.inbound.message import InboundMessage
from .transport.outbound.base import OutboundDeliveryError
from .transport.outbound.manager import OutboundTransportManager
from .transport.outbound.message import OutboundMessage
from .transport.wire_format import BaseWireFormat

LOGGER = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

from aiohttp.web import HTTPException

from .config.injection_context import InjectionContext
from .messaging.agent_message import AgentMessage
from .messaging.error import MessageParseError
from .messaging.models.base import BaseModelError
from .protocols.connections.manager import ConnectionManager
from .protocols.problem_report.message import ProblemReport
from .messaging.protocol_registry import ProtocolRegistry
from .messaging.request_context import RequestContext
from .messaging.responder import BaseResponder
from .messaging.task_queue import CompletedTask, PendingTask, TaskQueue
from .messaging.util import datetime_now
from .stats import Collector
from .transport.inbound.message import InboundMessage
from .transport.outbound.message import OutboundMessage
from ..config.injection_context import InjectionContext
from ..core.protocol_registry import ProtocolRegistry
from ..messaging.agent_message import AgentMessage
from ..messaging.error import MessageParseError
from ..messaging.models.base import BaseModelError
from ..messaging.request_context import RequestContext
from ..messaging.responder import BaseResponder
from ..messaging.util import datetime_now
from ..protocols.connections.manager import ConnectionManager
from ..protocols.problem_report.message import ProblemReport
from ..transport.inbound.message import InboundMessage
from ..transport.outbound.message import OutboundMessage
from ..utils.stats import Collector
from ..utils.task_queue import CompletedTask, PendingTask, TaskQueue

LOGGER = logging.getLogger(__name__)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from types import ModuleType
from typing import Sequence

from ..classloader import ClassLoader, ModuleLoadError
from ..config.injection_context import InjectionContext
from ..messaging.protocol_registry import ProtocolRegistry
from ..utils.classloader import ClassLoader, ModuleLoadError

from .protocol_registry import ProtocolRegistry

LOGGER = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from typing import Mapping, Sequence

from ..classloader import ClassLoader
from ..config.injection_context import InjectionContext
from ..utils.classloader import ClassLoader


class ProtocolRegistry:
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
from asynctest import mock as async_mock

from .. import conductor as test_module
from ..admin.base_server import BaseAdminServer
from ..config.base_context import ContextBuilder
from ..config.injection_context import InjectionContext
from ..protocols.connections.manager import ConnectionManager
from ..connections.models.connection_record import ConnectionRecord
from ..connections.models.connection_target import ConnectionTarget
from ..connections.models.diddoc import (
from ...admin.base_server import BaseAdminServer
from ...config.base_context import ContextBuilder
from ...config.injection_context import InjectionContext
from ...connections.models.connection_record import ConnectionRecord
from ...connections.models.connection_target import ConnectionTarget
from ...connections.models.diddoc import (
DIDDoc,
PublicKey,
PublicKeyType,
Service,
)
from ..messaging.protocol_registry import ProtocolRegistry
from ..stats import Collector
from ..storage.base import BaseStorage
from ..storage.basic import BasicStorage
from ..transport.inbound.base import InboundTransportConfiguration
from ..transport.inbound.message import InboundMessage
from ..transport.inbound.receipt import MessageReceipt
from ..transport.outbound.base import OutboundDeliveryError
from ..transport.outbound.message import OutboundMessage
from ..transport.wire_format import BaseWireFormat
from ..wallet.base import BaseWallet
from ..wallet.basic import BasicWallet
from ...core.protocol_registry import ProtocolRegistry
from ...protocols.connections.manager import ConnectionManager
from ...storage.base import BaseStorage
from ...storage.basic import BasicStorage
from ...transport.inbound.base import InboundTransportConfiguration
from ...transport.inbound.message import InboundMessage
from ...transport.inbound.receipt import MessageReceipt
from ...transport.outbound.base import OutboundDeliveryError
from ...transport.outbound.message import OutboundMessage
from ...transport.wire_format import BaseWireFormat
from ...utils.stats import Collector
from ...wallet.base import BaseWallet
from ...wallet.basic import BasicWallet


class Config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@

from asynctest import TestCase as AsyncTestCase, mock as async_mock

from ...config.injection_context import InjectionContext
from ...connections.models.connection_record import ConnectionRecord
from ...core.protocol_registry import ProtocolRegistry
from ...messaging.agent_message import AgentMessage, AgentMessageSchema
from ...messaging.error import MessageParseError
from ...protocols.problem_report.message import ProblemReport
from ...transport.inbound.message import InboundMessage
from ...transport.inbound.receipt import MessageReceipt
from ...transport.outbound.message import OutboundMessage

from .. import dispatcher as test_module
from ..config.injection_context import InjectionContext
from ..connections.models.connection_record import ConnectionRecord
from ..messaging.agent_message import AgentMessage, AgentMessageSchema
from ..messaging.error import MessageParseError
from ..messaging.protocol_registry import ProtocolRegistry
from ..protocols.problem_report.message import ProblemReport
from ..transport.inbound.message import InboundMessage
from ..transport.inbound.receipt import MessageReceipt
from ..transport.outbound.message import OutboundMessage


def make_context() -> InjectionContext:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from asynctest import TestCase as AsyncTestCase, mock as async_mock

from ...classloader import ClassLoader
from ...config.injection_context import InjectionContext
from ...utils.classloader import ClassLoader

from ..plugin_registry import PluginRegistry

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from asynctest import TestCase as AsyncTestCase, mock as async_mock

from ...config.injection_context import InjectionContext
from ...messaging.error import MessageParseError

from ..error import MessageParseError
from ..protocol_registry import ProtocolRegistry


Expand Down
4 changes: 2 additions & 2 deletions aries_cloudagent/issuer/indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import json
import logging


import indy.anoncreds

from ..error import BaseError
from ..core.error import BaseError

from .base import BaseIssuer
from .util import encode

Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/ledger/error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Ledger related errors."""

from ..error import BaseError
from ..core.error import BaseError


class LedgerError(BaseError):
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/ledger/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import logging

from ..cache.base import BaseCache
from ..classloader import ClassLoader
from ..config.base import BaseProvider, BaseInjector, BaseSettings
from ..utils.classloader import ClassLoader
from ..wallet.base import BaseWallet

LOGGER = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion aries_cloudagent/messaging/base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from abc import ABC, abstractmethod
import logging

from ..error import BaseError
from ..core.error import BaseError

from .responder import BaseResponder
from .request_context import RequestContext

Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/messaging/decorators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from marshmallow import Schema
from marshmallow.fields import Field

from ...error import BaseError
from ...core.error import BaseError

from ..models.base import BaseModel

Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/messaging/error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Messaging-related error classes and codes."""

from ..error import BaseError
from ..core.error import BaseError


class MessageParseError(BaseError):
Expand Down
Loading