From 2cd10041b9967a3854546a5fb2d1ff9e5b74cd3a Mon Sep 17 00:00:00 2001 From: Subhash Bhushan Date: Mon, 28 Sep 2020 15:00:53 -0700 Subject: [PATCH] Fix flake8 issues with tox --- src/protean/adapters/__init__.py | 6 +++--- src/protean/adapters/broker/__init__.py | 2 ++ src/protean/adapters/broker/celery.py | 5 ++--- src/protean/adapters/broker/inline.py | 2 +- src/protean/adapters/email/__init__.py | 2 ++ src/protean/adapters/repository/__init__.py | 4 +++- src/protean/adapters/repository/elasticsearch.py | 6 ++---- src/protean/adapters/repository/memory.py | 6 ++---- src/protean/adapters/repository/sqlalchemy.py | 6 ++---- src/protean/core/aggregate.py | 2 +- src/protean/core/domain_event.py | 1 - src/protean/core/email.py | 7 +++++-- src/protean/core/entity.py | 9 +++++++-- src/protean/core/field/utils.py | 2 +- src/protean/core/model.py | 2 +- src/protean/core/repository.py | 2 +- src/protean/domain/__init__.py | 12 +++++++----- src/protean/domain/context.py | 4 ++-- src/protean/domain/registry.py | 9 ++++++--- src/protean/port/broker.py | 3 +-- src/protean/utils/__init__.py | 1 + tests/adapters/broker/celery_broker/config.py | 2 +- tests/adapters/broker/celery_broker/elements.py | 2 +- .../adapters/broker/celery_broker/test_subscriber.py | 2 +- tests/adapters/broker/celery_broker/tests.py | 2 +- tests/adapters/email/sendgrid_email/elements.py | 2 +- tests/adapters/model/dict_model/elements.py | 2 +- tests/adapters/model/elasticsearch_model/elements.py | 2 +- .../sqlalchemy_model/postgresql/test_lookups.py | 2 +- .../repository/elasticsearch_repo/test_provider.py | 2 +- tests/adapters/repository/memory/test_lookups.py | 2 +- .../sqlalchemy_repo/postgresql/test_dao.py | 2 +- .../sqlalchemy_repo/postgresql/test_provider.py | 2 +- .../repository/sqlalchemy_repo/sqlite/test_dao.py | 2 +- .../sqlalchemy_repo/sqlite/test_provider.py | 2 +- tests/broker/tests.py | 2 +- tests/configuration/tests.py | 2 +- tests/context/tests.py | 2 +- tests/domain_event/tests.py | 2 +- tests/email_provider/elements.py | 2 +- tests/email_provider/tests.py | 2 +- tests/provider/tests.py | 2 +- tests/registry/tests.py | 10 ++++++---- tests/subscriber/elements.py | 2 +- tests/view/test_view_registration.py | 3 +-- 45 files changed, 81 insertions(+), 69 deletions(-) diff --git a/src/protean/adapters/__init__.py b/src/protean/adapters/__init__.py index ae6671d6..758ccf67 100644 --- a/src/protean/adapters/__init__.py +++ b/src/protean/adapters/__init__.py @@ -1,4 +1,5 @@ # Adapters +# Protean from protean.adapters.broker import Brokers from protean.adapters.broker.celery import CeleryBroker, ProteanTask from protean.adapters.broker.inline import InlineBroker @@ -6,10 +7,9 @@ from protean.adapters.email.dummy import DummyEmailProvider from protean.adapters.email.sendgrid import SendgridEmailProvider from protean.adapters.repository import Providers -from protean.adapters.repository.elasticsearch import ESProvider, ElasticsearchModel +from protean.adapters.repository.elasticsearch import ElasticsearchModel, ESProvider +from protean.adapters.repository.memory import MemoryModel, MemoryProvider from protean.adapters.repository.sqlalchemy import SAProvider, SqlalchemyModel -from protean.adapters.repository.memory import MemoryProvider, MemoryModel - __all__ = ( "Brokers", diff --git a/src/protean/adapters/broker/__init__.py b/src/protean/adapters/broker/__init__.py index a853d82e..64e7155c 100644 --- a/src/protean/adapters/broker/__init__.py +++ b/src/protean/adapters/broker/__init__.py @@ -1,8 +1,10 @@ +# Standard Library Imports import importlib import logging from collections.abc import MutableMapping +# Protean from protean.core.exceptions import ConfigurationError from protean.globals import current_uow from protean.utils import DomainObjects diff --git a/src/protean/adapters/broker/celery.py b/src/protean/adapters/broker/celery.py index 6709f2d6..9f6041e3 100644 --- a/src/protean/adapters/broker/celery.py +++ b/src/protean/adapters/broker/celery.py @@ -7,10 +7,9 @@ # Protean from celery import Celery, Task from kombu import Queue -from protean.port.broker import BaseBroker from protean.core.domain_event import BaseDomainEvent -from protean.utils import DomainObjects -from protean.utils import fully_qualified_name +from protean.port.broker import BaseBroker +from protean.utils import DomainObjects, fully_qualified_name from protean.utils.inflection import underscore logger = logging.getLogger("protean.adapters.celery") diff --git a/src/protean/adapters/broker/inline.py b/src/protean/adapters/broker/inline.py index 094e8880..20f9f4c4 100644 --- a/src/protean/adapters/broker/inline.py +++ b/src/protean/adapters/broker/inline.py @@ -1,7 +1,7 @@ # Protean -from protean.port.broker import BaseBroker from protean.core.domain_event import BaseDomainEvent from protean.globals import current_domain +from protean.port.broker import BaseBroker from protean.utils import fully_qualified_name diff --git a/src/protean/adapters/email/__init__.py b/src/protean/adapters/email/__init__.py index be73c134..48a7ae75 100644 --- a/src/protean/adapters/email/__init__.py +++ b/src/protean/adapters/email/__init__.py @@ -1,6 +1,8 @@ +# Standard Library Imports import importlib import logging +# Protean from protean.core.exceptions import ConfigurationError from protean.globals import current_uow diff --git a/src/protean/adapters/repository/__init__.py b/src/protean/adapters/repository/__init__.py index a98b67f4..13edb479 100644 --- a/src/protean/adapters/repository/__init__.py +++ b/src/protean/adapters/repository/__init__.py @@ -1,9 +1,11 @@ """ Package for Concrete Implementations of Protean repositories """ +# Standard Library Imports import importlib import logging +# Protean from protean.core.exceptions import ConfigurationError -from protean.utils import fully_qualified_name, DomainObjects +from protean.utils import DomainObjects, fully_qualified_name logger = logging.getLogger("protean.repository") diff --git a/src/protean/adapters/repository/elasticsearch.py b/src/protean/adapters/repository/elasticsearch.py index ee6d8c50..5d492bf9 100644 --- a/src/protean/adapters/repository/elasticsearch.py +++ b/src/protean/adapters/repository/elasticsearch.py @@ -13,11 +13,9 @@ from elasticsearch_dsl import Document, Index, Search, query from protean.core.exceptions import ObjectNotFoundError from protean.core.field.association import Reference -from protean.port.provider import BaseProvider -from protean.port.dao import BaseDAO -from protean.port.dao import BaseLookup -from protean.port.dao import ResultSet from protean.globals import current_domain +from protean.port.dao import BaseDAO, BaseLookup, ResultSet +from protean.port.provider import BaseProvider from protean.utils import Database, IdentityStrategy, IdentityType from protean.utils.query import Q diff --git a/src/protean/adapters/repository/memory.py b/src/protean/adapters/repository/memory.py index 432f3b60..4f2eee8c 100644 --- a/src/protean/adapters/repository/memory.py +++ b/src/protean/adapters/repository/memory.py @@ -14,12 +14,10 @@ # Protean from protean.core.exceptions import ObjectNotFoundError -from protean.port.provider import BaseProvider -from protean.port.dao import BaseDAO -from protean.port.dao import BaseLookup from protean.core.model import BaseModel -from protean.port.dao import ResultSet from protean.globals import current_uow +from protean.port.dao import BaseDAO, BaseLookup, ResultSet +from protean.port.provider import BaseProvider from protean.utils import Database from protean.utils.query import Q diff --git a/src/protean/adapters/repository/sqlalchemy.py b/src/protean/adapters/repository/sqlalchemy.py index 5114906e..de23deda 100644 --- a/src/protean/adapters/repository/sqlalchemy.py +++ b/src/protean/adapters/repository/sqlalchemy.py @@ -22,12 +22,10 @@ String, Text, ) -from protean.port.provider import BaseProvider -from protean.port.dao import BaseDAO -from protean.port.dao import BaseLookup from protean.core.model import BaseModel -from protean.port.dao import ResultSet from protean.globals import current_domain, current_uow +from protean.port.dao import BaseDAO, BaseLookup, ResultSet +from protean.port.provider import BaseProvider from protean.utils import Database, IdentityType from protean.utils.query import Q from sqlalchemy import Column, MetaData, and_, create_engine, or_, orm diff --git a/src/protean/core/aggregate.py b/src/protean/core/aggregate.py index 0c94018d..2f555ce8 100644 --- a/src/protean/core/aggregate.py +++ b/src/protean/core/aggregate.py @@ -4,7 +4,7 @@ # Protean from protean.core.entity import BaseEntity -from protean.core.exceptions import IncorrectUsageError, NotSupportedError +from protean.core.exceptions import NotSupportedError from protean.utils import DomainObjects, derive_element_class logger = logging.getLogger("protean.domain.aggregate") diff --git a/src/protean/core/domain_event.py b/src/protean/core/domain_event.py index 564fc048..417ccc9b 100644 --- a/src/protean/core/domain_event.py +++ b/src/protean/core/domain_event.py @@ -2,7 +2,6 @@ import logging # Protean -from protean.core.exceptions import IncorrectUsageError from protean.utils import DomainObjects, derive_element_class from protean.utils.container import BaseContainer diff --git a/src/protean/core/email.py b/src/protean/core/email.py index 9865051b..3c812185 100644 --- a/src/protean/core/email.py +++ b/src/protean/core/email.py @@ -2,9 +2,12 @@ from abc import abstractmethod # Protean -from protean.utils import DomainObjects, derive_element_class from protean.globals import current_domain -from protean.utils import convert_str_values_to_list +from protean.utils import ( + DomainObjects, + convert_str_values_to_list, + derive_element_class, +) class BaseEmailProvider: diff --git a/src/protean/core/entity.py b/src/protean/core/entity.py index 4df96a03..12616e26 100644 --- a/src/protean/core/entity.py +++ b/src/protean/core/entity.py @@ -16,9 +16,14 @@ from protean.core.field.association import Association, Reference from protean.core.field.basic import Auto, Field from protean.core.field.embedded import ValueObjectField -from protean.utils import DomainObjects, derive_element_class from protean.globals import current_domain -from protean.utils import IdentityStrategy, IdentityType, inflection +from protean.utils import ( + DomainObjects, + IdentityStrategy, + IdentityType, + derive_element_class, + inflection, +) # Local/Relative Imports from ..core.field.association import _ReferenceField # Relative path to private class diff --git a/src/protean/core/field/utils.py b/src/protean/core/field/utils.py index 8a836b98..66a938af 100644 --- a/src/protean/core/field/utils.py +++ b/src/protean/core/field/utils.py @@ -1,7 +1,7 @@ """ Utility functions for the Field Module """ # Protean -from protean.utils import DomainObjects from protean.globals import current_domain +from protean.utils import DomainObjects def fetch_entity_cls_from_registry(entity): diff --git a/src/protean/core/model.py b/src/protean/core/model.py index 9ed57431..98f9b2ae 100644 --- a/src/protean/core/model.py +++ b/src/protean/core/model.py @@ -1,8 +1,8 @@ # Standard Library Imports from abc import abstractmethod -from protean.core.exceptions import IncorrectUsageError # Protean +from protean.core.exceptions import IncorrectUsageError from protean.utils import DomainObjects, derive_element_class diff --git a/src/protean/core/repository.py b/src/protean/core/repository.py index a697def7..cded7aad 100644 --- a/src/protean/core/repository.py +++ b/src/protean/core/repository.py @@ -4,8 +4,8 @@ # Protean from protean.core.exceptions import IncorrectUsageError, ValidationError from protean.core.field.association import HasMany, HasOne -from protean.utils import DomainObjects, derive_element_class from protean.globals import current_domain +from protean.utils import DomainObjects, derive_element_class logger = logging.getLogger("protean.repository") diff --git a/src/protean/domain/__init__.py b/src/protean/domain/__init__.py index c4948d8b..05e8bd75 100644 --- a/src/protean/domain/__init__.py +++ b/src/protean/domain/__init__.py @@ -5,14 +5,15 @@ import logging import sys +# Protean +from protean.adapters import Brokers, EmailProviders, Providers from protean.core.exceptions import ( IncorrectUsageError, NotSupportedError, ObjectNotFoundError, ) from protean.domain.registry import _DomainRegistry -from protean.adapters import Brokers, EmailProviders, Providers -from protean.utils import fully_qualified_name, DomainObjects +from protean.utils import DomainObjects, fully_qualified_name from werkzeug.datastructures import ImmutableDict # Local/Relative Imports @@ -85,8 +86,8 @@ class Domain(_PackageBoundObject): "AUTOLOAD_DOMAIN": True, "IDENTITY_STRATEGY": IdentityStrategy.UUID, "IDENTITY_TYPE": IdentityType.STRING, - "DATABASES": {"default": {"PROVIDER": "protean.adapters.MemoryProvider",},}, - "BROKERS": {"default": {"PROVIDER": "protean.adapters.InlineBroker",},}, + "DATABASES": {"default": {"PROVIDER": "protean.adapters.MemoryProvider"}}, + "BROKERS": {"default": {"PROVIDER": "protean.adapters.InlineBroker"}}, "EMAIL_PROVIDERS": { "default": { "PROVIDER": "protean.adapters.DummyEmailProvider", @@ -274,6 +275,7 @@ def registry(self): return self._domain_registry def factory_for(self, domain_object_type): + # Protean from protean.core.aggregate import aggregate_factory from protean.core.application_service import application_service_factory from protean.core.command import command_factory @@ -284,8 +286,8 @@ def factory_for(self, domain_object_type): from protean.core.entity import entity_factory from protean.core.model import model_factory from protean.core.repository import repository_factory - from protean.core.subscriber import subscriber_factory from protean.core.serializer import serializer_factory + from protean.core.subscriber import subscriber_factory from protean.core.value_object import value_object_factory from protean.core.view import view_factory diff --git a/src/protean/domain/context.py b/src/protean/domain/context.py index c74efee3..37da9684 100644 --- a/src/protean/domain/context.py +++ b/src/protean/domain/context.py @@ -3,7 +3,7 @@ import logging import sys -# Local/Relative Imports +# Protean from protean.globals import _domain_context_stack # a singleton sentinel value for parameter defaults @@ -101,7 +101,7 @@ def pop(self, exc=_sentinel): self.domain.do_teardown_domain_context(exc) finally: rv = _domain_context_stack.pop() - assert rv is self, f"Popped wrong domain context. (%r instead of %r)" % ( + assert rv is self, "Popped wrong domain context. (%r instead of %r)" % ( rv, self, ) diff --git a/src/protean/domain/registry.py b/src/protean/domain/registry.py index cbce2e7a..7b0acf7a 100644 --- a/src/protean/domain/registry.py +++ b/src/protean/domain/registry.py @@ -1,11 +1,14 @@ -from enum import Enum -import inflection +# Standard Library Imports import logging from collections import defaultdict +from enum import Enum from typing import Any, Dict -from protean.utils import fully_qualified_name, DomainObjects +# Protean +import inflection + +from protean.utils import DomainObjects, fully_qualified_name logger = logging.getLogger("protean.domain") diff --git a/src/protean/port/broker.py b/src/protean/port/broker.py index 2a81b205..4b6b37de 100644 --- a/src/protean/port/broker.py +++ b/src/protean/port/broker.py @@ -7,8 +7,7 @@ from collections.abc import Iterable # Protean -from protean.utils import DomainObjects -from protean.utils import fully_qualified_name +from protean.utils import DomainObjects, fully_qualified_name logger = logging.getLogger("protean.port.broker") diff --git a/src/protean/utils/__init__.py b/src/protean/utils/__init__.py index 3f144d27..09ef87ae 100644 --- a/src/protean/utils/__init__.py +++ b/src/protean/utils/__init__.py @@ -9,6 +9,7 @@ from enum import Enum, auto +# Protean from protean.core.exceptions import IncorrectUsageError logger = logging.getLogger("protean.utils") diff --git a/tests/adapters/broker/celery_broker/config.py b/tests/adapters/broker/celery_broker/config.py index b825ed85..3a21bbad 100644 --- a/tests/adapters/broker/celery_broker/config.py +++ b/tests/adapters/broker/celery_broker/config.py @@ -59,5 +59,5 @@ "formatter": "console", }, }, - "loggers": {"protean": {"handlers": ["console"], "level": "DEBUG"},}, + "loggers": {"protean": {"handlers": ["console"], "level": "DEBUG"}}, } diff --git a/tests/adapters/broker/celery_broker/elements.py b/tests/adapters/broker/celery_broker/elements.py index 4735adfa..3334fddd 100644 --- a/tests/adapters/broker/celery_broker/elements.py +++ b/tests/adapters/broker/celery_broker/elements.py @@ -1,8 +1,8 @@ # Protean from protean.core.aggregate import BaseAggregate -from protean.core.subscriber import BaseSubscriber from protean.core.domain_event import BaseDomainEvent from protean.core.field.basic import Auto, Integer, String +from protean.core.subscriber import BaseSubscriber from protean.globals import current_domain diff --git a/tests/adapters/broker/celery_broker/test_subscriber.py b/tests/adapters/broker/celery_broker/test_subscriber.py index 2ccc7371..b900a1a7 100644 --- a/tests/adapters/broker/celery_broker/test_subscriber.py +++ b/tests/adapters/broker/celery_broker/test_subscriber.py @@ -2,8 +2,8 @@ import pytest from celery import Task -from protean.globals import current_domain from protean.adapters import CeleryBroker, ProteanTask +from protean.globals import current_domain from tests.adapters.broker.celery_broker.elements import NotifySSOSubscriber, Person diff --git a/tests/adapters/broker/celery_broker/tests.py b/tests/adapters/broker/celery_broker/tests.py index deeda89c..2a690901 100644 --- a/tests/adapters/broker/celery_broker/tests.py +++ b/tests/adapters/broker/celery_broker/tests.py @@ -2,8 +2,8 @@ import pytest from mock import patch -from protean.globals import current_domain from protean.adapters import CeleryBroker +from protean.globals import current_domain from tests.adapters.broker.celery_broker.elements import ( NotifySSOSubscriber, Person, diff --git a/tests/adapters/email/sendgrid_email/elements.py b/tests/adapters/email/sendgrid_email/elements.py index 1c13a30b..582e5d0e 100644 --- a/tests/adapters/email/sendgrid_email/elements.py +++ b/tests/adapters/email/sendgrid_email/elements.py @@ -1,11 +1,11 @@ # Protean from protean.core.aggregate import BaseAggregate -from protean.core.subscriber import BaseSubscriber from protean.core.domain_event import BaseDomainEvent from protean.core.email import BaseEmail from protean.core.exceptions import InsufficientDataError, InvalidDataError from protean.core.field.basic import Integer, String from protean.core.field.embedded import AggregateField +from protean.core.subscriber import BaseSubscriber from protean.globals import current_domain diff --git a/tests/adapters/model/dict_model/elements.py b/tests/adapters/model/dict_model/elements.py index 1d16293f..d9f0d08f 100644 --- a/tests/adapters/model/dict_model/elements.py +++ b/tests/adapters/model/dict_model/elements.py @@ -8,8 +8,8 @@ from protean.core.aggregate import BaseAggregate from protean.core.field.basic import Integer, String, Text from protean.core.field.embedded import ValueObjectField -from protean.core.repository import BaseRepository from protean.core.model import BaseModel +from protean.core.repository import BaseRepository from protean.core.value_object import BaseValueObject from protean.globals import current_domain diff --git a/tests/adapters/model/elasticsearch_model/elements.py b/tests/adapters/model/elasticsearch_model/elements.py index 593acf6e..43957747 100644 --- a/tests/adapters/model/elasticsearch_model/elements.py +++ b/tests/adapters/model/elasticsearch_model/elements.py @@ -6,12 +6,12 @@ # Protean from elasticsearch_dsl import Keyword, Text +from protean.adapters import ElasticsearchModel from protean.core.aggregate import BaseAggregate from protean.core.field.basic import DateTime, Integer, String from protean.core.field.basic import Text as ProteanText from protean.core.field.embedded import ValueObjectField from protean.core.value_object import BaseValueObject -from protean.adapters import ElasticsearchModel class Person(BaseAggregate): diff --git a/tests/adapters/model/sqlalchemy_model/postgresql/test_lookups.py b/tests/adapters/model/sqlalchemy_model/postgresql/test_lookups.py index d1f9500f..a23a4dca 100644 --- a/tests/adapters/model/sqlalchemy_model/postgresql/test_lookups.py +++ b/tests/adapters/model/sqlalchemy_model/postgresql/test_lookups.py @@ -1,9 +1,9 @@ # Protean import pytest +from protean.adapters.repository.sqlalchemy import Any, Contains, In, Overlap from protean.core.aggregate import BaseAggregate from protean.core.field.basic import List, String -from protean.adapters.repository.sqlalchemy import Any, Contains, In, Overlap class GenericPostgres(BaseAggregate): diff --git a/tests/adapters/repository/elasticsearch_repo/test_provider.py b/tests/adapters/repository/elasticsearch_repo/test_provider.py index 1f02e1cb..c963af61 100644 --- a/tests/adapters/repository/elasticsearch_repo/test_provider.py +++ b/tests/adapters/repository/elasticsearch_repo/test_provider.py @@ -4,7 +4,7 @@ from elasticsearch import Elasticsearch from elasticsearch_dsl.response import Response -from protean.adapters import Providers, ESProvider +from protean.adapters import ESProvider, Providers # Local/Relative Imports from .elements import Alien, Person diff --git a/tests/adapters/repository/memory/test_lookups.py b/tests/adapters/repository/memory/test_lookups.py index 7bd60796..a354d1fd 100644 --- a/tests/adapters/repository/memory/test_lookups.py +++ b/tests/adapters/repository/memory/test_lookups.py @@ -9,8 +9,8 @@ class TestLookup: """This class holds tests for Lookup Class""" # Protean - from protean.port.dao import BaseLookup from protean.adapters.repository.memory import MemoryProvider + from protean.port.dao import BaseLookup @MemoryProvider.register_lookup class SampleLookup(BaseLookup): diff --git a/tests/adapters/repository/sqlalchemy_repo/postgresql/test_dao.py b/tests/adapters/repository/sqlalchemy_repo/postgresql/test_dao.py index fd2531b0..e76d1098 100644 --- a/tests/adapters/repository/sqlalchemy_repo/postgresql/test_dao.py +++ b/tests/adapters/repository/sqlalchemy_repo/postgresql/test_dao.py @@ -872,8 +872,8 @@ class TestDAOLookup: @pytest.fixture def sample_lookup_cls(self): # Protean - from protean.port.dao import BaseLookup from protean.adapters.repository.sqlalchemy import SAProvider + from protean.port.dao import BaseLookup @SAProvider.register_lookup class SampleLookup(BaseLookup): diff --git a/tests/adapters/repository/sqlalchemy_repo/postgresql/test_provider.py b/tests/adapters/repository/sqlalchemy_repo/postgresql/test_provider.py index 79f8124e..a06baaf2 100644 --- a/tests/adapters/repository/sqlalchemy_repo/postgresql/test_provider.py +++ b/tests/adapters/repository/sqlalchemy_repo/postgresql/test_provider.py @@ -1,8 +1,8 @@ """Module to test SQLAlchemy Provider Class""" # Protean import pytest -from protean.adapters.repository import Providers +from protean.adapters.repository import Providers from protean.adapters.repository.sqlalchemy import SAProvider from sqlalchemy.engine.result import ResultProxy from sqlalchemy.orm.session import Session diff --git a/tests/adapters/repository/sqlalchemy_repo/sqlite/test_dao.py b/tests/adapters/repository/sqlalchemy_repo/sqlite/test_dao.py index e546ca16..2aa9d658 100644 --- a/tests/adapters/repository/sqlalchemy_repo/sqlite/test_dao.py +++ b/tests/adapters/repository/sqlalchemy_repo/sqlite/test_dao.py @@ -844,8 +844,8 @@ class TestDAOLookup: @pytest.fixture def sample_lookup_cls(self): # Protean - from protean.port.dao import BaseLookup from protean.adapters.repository.sqlalchemy import SAProvider + from protean.port.dao import BaseLookup @SAProvider.register_lookup class SampleLookup(BaseLookup): diff --git a/tests/adapters/repository/sqlalchemy_repo/sqlite/test_provider.py b/tests/adapters/repository/sqlalchemy_repo/sqlite/test_provider.py index c2dce77d..b6861baf 100644 --- a/tests/adapters/repository/sqlalchemy_repo/sqlite/test_provider.py +++ b/tests/adapters/repository/sqlalchemy_repo/sqlite/test_provider.py @@ -1,8 +1,8 @@ """Module to test SQLAlchemy Provider Class""" # Protean import pytest -from protean.adapters.repository import Providers +from protean.adapters.repository import Providers from protean.adapters.repository.sqlalchemy import SAProvider from sqlalchemy.engine.result import ResultProxy from sqlalchemy.orm.session import Session diff --git a/tests/broker/tests.py b/tests/broker/tests.py index 09cc7309..a5c4c116 100644 --- a/tests/broker/tests.py +++ b/tests/broker/tests.py @@ -1,8 +1,8 @@ # Protean import pytest -from protean.port.broker import BaseBroker from protean.adapters.broker.inline import InlineBroker +from protean.port.broker import BaseBroker class TestBroker: diff --git a/tests/configuration/tests.py b/tests/configuration/tests.py index 99c915bd..cf8128e5 100644 --- a/tests/configuration/tests.py +++ b/tests/configuration/tests.py @@ -4,8 +4,8 @@ # Protean import pytest -from protean.domain.config import Config from protean.domain import Domain +from protean.domain.config import Config # config keys used for the TestConfig TEST_KEY = "foo" diff --git a/tests/context/tests.py b/tests/context/tests.py index eb8ba76b..5dd3b8fb 100644 --- a/tests/context/tests.py +++ b/tests/context/tests.py @@ -1,7 +1,7 @@ # Protean import pytest -from protean.globals import _domain_context_stack, current_domain, g +from protean.globals import current_domain, g class TestDomainContext: diff --git a/tests/domain_event/tests.py b/tests/domain_event/tests.py index af3eda2f..6f635031 100644 --- a/tests/domain_event/tests.py +++ b/tests/domain_event/tests.py @@ -2,9 +2,9 @@ import pytest from mock import patch +from protean.adapters.broker.inline import InlineBroker from protean.core.domain_event import BaseDomainEvent from protean.globals import current_domain -from protean.adapters.broker.inline import InlineBroker from protean.infra.event_log import EventLog, EventLogRepository from protean.utils import fully_qualified_name diff --git a/tests/email_provider/elements.py b/tests/email_provider/elements.py index 25514e5b..90e50e7c 100644 --- a/tests/email_provider/elements.py +++ b/tests/email_provider/elements.py @@ -1,11 +1,11 @@ # Protean from protean.core.aggregate import BaseAggregate -from protean.core.subscriber import BaseSubscriber from protean.core.domain_event import BaseDomainEvent from protean.core.email import BaseEmail from protean.core.exceptions import InsufficientDataError, InvalidDataError from protean.core.field.basic import Integer, String from protean.core.field.embedded import AggregateField +from protean.core.subscriber import BaseSubscriber from protean.globals import current_domain diff --git a/tests/email_provider/tests.py b/tests/email_provider/tests.py index 148b6c63..53a0de3e 100644 --- a/tests/email_provider/tests.py +++ b/tests/email_provider/tests.py @@ -2,8 +2,8 @@ import pytest from mock import patch -from protean.core.email import BaseEmail from protean.adapters import DummyEmailProvider +from protean.core.email import BaseEmail from protean.utils import fully_qualified_name # Local/Relative Imports diff --git a/tests/provider/tests.py b/tests/provider/tests.py index 043752b1..a68964b2 100644 --- a/tests/provider/tests.py +++ b/tests/provider/tests.py @@ -1,7 +1,7 @@ # Protean import pytest -from protean.adapters.repository import Providers +from protean.adapters.repository import Providers from protean.adapters.repository.memory import MemoryProvider # Local/Relative Imports diff --git a/tests/registry/tests.py b/tests/registry/tests.py index 5ffbc01e..c7757840 100644 --- a/tests/registry/tests.py +++ b/tests/registry/tests.py @@ -1,12 +1,14 @@ -import inflection -import pytest - +# Standard Library Imports from datetime import datetime from enum import Enum +# Protean +import inflection +import pytest + from protean.core.aggregate import BaseAggregate -from protean.domain.registry import _DomainRegistry from protean.core.field.basic import DateTime, String +from protean.domain.registry import _DomainRegistry from protean.utils import DomainObjects diff --git a/tests/subscriber/elements.py b/tests/subscriber/elements.py index e2c53863..a056a370 100644 --- a/tests/subscriber/elements.py +++ b/tests/subscriber/elements.py @@ -1,9 +1,9 @@ # Protean from protean.core.aggregate import BaseAggregate -from protean.core.subscriber import BaseSubscriber from protean.core.domain_event import BaseDomainEvent from protean.core.field.basic import Integer, String from protean.core.field.embedded import AggregateField +from protean.core.subscriber import BaseSubscriber from protean.globals import current_domain diff --git a/tests/view/test_view_registration.py b/tests/view/test_view_registration.py index 05d31322..72dca15f 100644 --- a/tests/view/test_view_registration.py +++ b/tests/view/test_view_registration.py @@ -1,7 +1,6 @@ # Protean -from protean.core.aggregate import BaseAggregate -from protean.core.view import BaseView from protean.core.field.basic import String +from protean.core.view import BaseView from protean.utils import fully_qualified_name