From e860526724834ee5e5b3974ab10291cc30878eb8 Mon Sep 17 00:00:00 2001 From: Subhash Bhushan Date: Mon, 16 Sep 2019 13:30:33 -0700 Subject: [PATCH] Import fixes by tox --- MANIFEST.in | 2 +- src/protean/context.py | 3 +-- src/protean/core/aggregate.py | 3 ++- src/protean/core/application_service.py | 2 ++ src/protean/core/broker/subscriber.py | 1 + src/protean/core/command.py | 1 + src/protean/core/data_transfer_object.py | 2 ++ src/protean/core/domain_event.py | 1 + src/protean/core/domain_service.py | 2 ++ src/protean/core/repository/base.py | 1 + src/protean/core/repository/lookup.py | 2 +- src/protean/core/repository/resultset.py | 1 + src/protean/core/transport/request.py | 1 + src/protean/core/value_object.py | 2 ++ src/protean/impl/repository/dict_repo.py | 2 +- src/protean/impl/repository/sqlalchemy_repo.py | 6 +++--- src/protean/utils/container.py | 2 ++ src/protean/utils/query.py | 3 +-- tests/command/elements.py | 4 ++-- tests/container/tests.py | 2 ++ tests/dao/test_retrieval.py | 1 + tests/domain/elements.py | 1 + tests/domain/tests.py | 2 +- tests/identity/conftest.py | 3 +++ tests/identity/tests.py | 7 +++++-- .../impl/repository/sqlalchemy_repo/postgresql/config.py | 1 + .../repository/sqlalchemy_repo/postgresql/conftest.py | 3 +++ .../repository/sqlalchemy_repo/postgresql/elements.py | 1 + .../repository/sqlalchemy_repo/postgresql/test_dao.py | 7 ++++--- .../sqlalchemy_repo/postgresql/test_provider.py | 9 ++++----- .../sqlalchemy_repo/postgresql/test_transactions.py | 6 +++++- tests/impl/repository/sqlalchemy_repo/sqlite/config.py | 1 + tests/impl/repository/sqlalchemy_repo/sqlite/conftest.py | 3 +++ tests/impl/repository/sqlalchemy_repo/sqlite/elements.py | 1 + tests/impl/repository/sqlalchemy_repo/sqlite/test_dao.py | 7 ++++--- .../repository/sqlalchemy_repo/sqlite/test_provider.py | 9 ++++----- .../sqlalchemy_repo/sqlite/test_transactions.py | 6 +++++- tests/repository/test_resultset.py | 1 + tests/unit_of_work/test_uow_transactions.py | 6 +++++- 39 files changed, 83 insertions(+), 35 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index f4cee8b2..79b525aa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -19,5 +19,5 @@ include tox.ini .travis.yml appveyor.yml global-exclude *.py[cod] __pycache__ *.so *.dylib -include *.txt *.yml pytest.ini +include *.txt *.yml pytest.ini *.bat Makefile recursive-include requirements *.txt diff --git a/src/protean/context.py b/src/protean/context.py index 230b7997..a84c4893 100644 --- a/src/protean/context.py +++ b/src/protean/context.py @@ -1,7 +1,6 @@ """Context Management Framework""" -import logging - # Standard Library Imports +import logging import sys # Local/Relative Imports diff --git a/src/protean/core/aggregate.py b/src/protean/core/aggregate.py index 24eba0b3..d4a937a4 100644 --- a/src/protean/core/aggregate.py +++ b/src/protean/core/aggregate.py @@ -1,9 +1,10 @@ """Aggregate Functionality and Classes""" +# Standard Library Imports import logging # Protean -from protean.domain import DomainObjects from protean.core.entity import BaseEntity +from protean.domain import DomainObjects logger = logging.getLogger('protean.domain.aggregate') diff --git a/src/protean/core/application_service.py b/src/protean/core/application_service.py index 2fcf9087..c2ee33e9 100644 --- a/src/protean/core/application_service.py +++ b/src/protean/core/application_service.py @@ -1,5 +1,7 @@ +# Standard Library Imports import logging +# Protean from protean.domain import DomainObjects logger = logging.getLogger('protean.application') diff --git a/src/protean/core/broker/subscriber.py b/src/protean/core/broker/subscriber.py index 65fbebd5..bfc329a4 100644 --- a/src/protean/core/broker/subscriber.py +++ b/src/protean/core/broker/subscriber.py @@ -1,6 +1,7 @@ # Standard Library Imports from abc import abstractmethod +# Protean from protean.domain import DomainObjects diff --git a/src/protean/core/command.py b/src/protean/core/command.py index 7d7deac9..b4eef6aa 100644 --- a/src/protean/core/command.py +++ b/src/protean/core/command.py @@ -1,3 +1,4 @@ +# Protean from protean.domain import DomainObjects from protean.utils.container import BaseContainer diff --git a/src/protean/core/data_transfer_object.py b/src/protean/core/data_transfer_object.py index 401b5845..27f3c951 100644 --- a/src/protean/core/data_transfer_object.py +++ b/src/protean/core/data_transfer_object.py @@ -1,6 +1,8 @@ """Data Transfer Object Functionality and Classes""" +# Standard Library Imports import logging +# Protean from protean.domain import DomainObjects from protean.utils.container import BaseContainer diff --git a/src/protean/core/domain_event.py b/src/protean/core/domain_event.py index 29cbc18b..e01906a6 100644 --- a/src/protean/core/domain_event.py +++ b/src/protean/core/domain_event.py @@ -1,4 +1,5 @@ # Protean +# Standard Library Imports import logging from protean.domain import DomainObjects diff --git a/src/protean/core/domain_service.py b/src/protean/core/domain_service.py index 71447bff..173117ae 100644 --- a/src/protean/core/domain_service.py +++ b/src/protean/core/domain_service.py @@ -1,5 +1,7 @@ +# Standard Library Imports import logging +# Protean from protean.domain import DomainObjects logger = logging.getLogger('protean.domain.service') diff --git a/src/protean/core/repository/base.py b/src/protean/core/repository/base.py index a018dde7..e411ab50 100644 --- a/src/protean/core/repository/base.py +++ b/src/protean/core/repository/base.py @@ -1,3 +1,4 @@ +# Standard Library Imports import logging # Protean diff --git a/src/protean/core/repository/lookup.py b/src/protean/core/repository/lookup.py index 91115ce6..25e4e9ce 100644 --- a/src/protean/core/repository/lookup.py +++ b/src/protean/core/repository/lookup.py @@ -1,7 +1,7 @@ """Classes and Functions for Lookup methods for Query translation""" +# Standard Library Imports import logging -# Standard Library Imports from abc import ABCMeta, abstractmethod logger = logging.getLogger('protean.repository') diff --git a/src/protean/core/repository/resultset.py b/src/protean/core/repository/resultset.py index 868c341f..c80a3239 100644 --- a/src/protean/core/repository/resultset.py +++ b/src/protean/core/repository/resultset.py @@ -1,4 +1,5 @@ """ResultSet Utility class and traversal methods for Repository results""" +# Standard Library Imports import logging logger = logging.getLogger('protean.repository') diff --git a/src/protean/core/transport/request.py b/src/protean/core/transport/request.py index 516df34a..d758fe07 100644 --- a/src/protean/core/transport/request.py +++ b/src/protean/core/transport/request.py @@ -1,4 +1,5 @@ """Module for Request related Classes""" +# Protean from protean.domain import DomainObjects from protean.utils.container import BaseContainer diff --git a/src/protean/core/value_object.py b/src/protean/core/value_object.py index 6f4682ec..5841f4aa 100644 --- a/src/protean/core/value_object.py +++ b/src/protean/core/value_object.py @@ -1,6 +1,8 @@ """Value Object Functionality and Classes""" +# Standard Library Imports import logging +# Protean from protean.domain import DomainObjects from protean.utils.container import BaseContainer diff --git a/src/protean/impl/repository/dict_repo.py b/src/protean/impl/repository/dict_repo.py index 1f0bf950..d68190dd 100644 --- a/src/protean/impl/repository/dict_repo.py +++ b/src/protean/impl/repository/dict_repo.py @@ -14,12 +14,12 @@ # Protean from protean.core.exceptions import ObjectNotFoundError -from protean.globals import current_uow from protean.core.provider.base import BaseProvider from protean.core.repository.dao import BaseDAO from protean.core.repository.lookup import BaseLookup from protean.core.repository.model import BaseModel from protean.core.repository.resultset import ResultSet +from protean.globals import current_uow from protean.utils import Database from protean.utils.query import Q diff --git a/src/protean/impl/repository/sqlalchemy_repo.py b/src/protean/impl/repository/sqlalchemy_repo.py index 66622a45..927f89ff 100644 --- a/src/protean/impl/repository/sqlalchemy_repo.py +++ b/src/protean/impl/repository/sqlalchemy_repo.py @@ -8,15 +8,15 @@ from typing import Any # Protean -from protean.core.exceptions import ObjectNotFoundError, ConfigurationError +from protean.core.exceptions import ConfigurationError, ObjectNotFoundError from protean.core.field.association import Reference from protean.core.field.basic import Auto, Boolean, Date, DateTime, Dict, Float, Integer, List, String, Text -from protean.globals import current_domain, current_uow from protean.core.provider.base import BaseProvider from protean.core.repository.dao import BaseDAO from protean.core.repository.lookup import BaseLookup from protean.core.repository.model import BaseModel from protean.core.repository.resultset import ResultSet +from protean.globals import current_domain, current_uow from protean.utils import Database, IdentityType from protean.utils.query import Q from sqlalchemy import Column, MetaData, and_, create_engine, or_, orm @@ -26,7 +26,7 @@ from sqlalchemy.exc import DatabaseError from sqlalchemy.ext import declarative as sa_dec from sqlalchemy.ext.declarative import as_declarative, declared_attr -from sqlalchemy.types import TypeDecorator, CHAR +from sqlalchemy.types import CHAR, TypeDecorator logging.getLogger('sqlalchemy.engine').setLevel(logging.ERROR) logger = logging.getLogger('protean.repository') diff --git a/src/protean/utils/container.py b/src/protean/utils/container.py index 979f5f1a..5c9012f4 100644 --- a/src/protean/utils/container.py +++ b/src/protean/utils/container.py @@ -1,6 +1,8 @@ +# Standard Library Imports import copy import logging +# Protean from protean.core.exceptions import NotSupportedError, ValidationError from protean.core.field.basic import Field diff --git a/src/protean/utils/query.py b/src/protean/utils/query.py index 6621b8b4..f9660872 100644 --- a/src/protean/utils/query.py +++ b/src/protean/utils/query.py @@ -1,10 +1,9 @@ """Utility classes and methods for DB Adapters, Repositories and Query Constructors""" -import logging - # Standard Library Imports import copy import functools import inspect +import logging logger = logging.getLogger('protean.repository') diff --git a/tests/command/elements.py b/tests/command/elements.py index 5dbae665..38a5da7d 100644 --- a/tests/command/elements.py +++ b/tests/command/elements.py @@ -1,6 +1,6 @@ -from protean.core.field.basic import String - +# Protean from protean.core.command import BaseCommand +from protean.core.field.basic import String class UserRegistrationCommand(BaseCommand): diff --git a/tests/container/tests.py b/tests/container/tests.py index 6a7a3b69..e88de1f4 100644 --- a/tests/container/tests.py +++ b/tests/container/tests.py @@ -1,7 +1,9 @@ +# Protean import pytest from protean.core.exceptions import InvalidOperationError +# Local/Relative Imports from .elements import CustomBaseContainer, CustomContainer diff --git a/tests/dao/test_retrieval.py b/tests/dao/test_retrieval.py index 8a18e22b..07b5e386 100644 --- a/tests/dao/test_retrieval.py +++ b/tests/dao/test_retrieval.py @@ -1,3 +1,4 @@ +# Standard Library Imports from datetime import datetime, timedelta # Protean diff --git a/tests/domain/elements.py b/tests/domain/elements.py index 75706f6f..7ee3d2b0 100644 --- a/tests/domain/elements.py +++ b/tests/domain/elements.py @@ -1,3 +1,4 @@ +# Standard Library Imports from enum import Enum # Protean diff --git a/tests/domain/tests.py b/tests/domain/tests.py index c8b1bea7..19ff94ae 100644 --- a/tests/domain/tests.py +++ b/tests/domain/tests.py @@ -6,7 +6,7 @@ from protean.utils import fully_qualified_name # Local/Relative Imports -from .elements import UserStructVO, UserStructAggregate, UserStructEntity, UserStructFoo, UserStructRequestObject +from .elements import UserStructAggregate, UserStructEntity, UserStructFoo, UserStructRequestObject, UserStructVO class TestDomainInitialization: diff --git a/tests/identity/conftest.py b/tests/identity/conftest.py index 7c2dde6a..c0646dbd 100644 --- a/tests/identity/conftest.py +++ b/tests/identity/conftest.py @@ -1,4 +1,7 @@ +# Standard Library Imports import os + +# Protean import pytest diff --git a/tests/identity/tests.py b/tests/identity/tests.py index 5ec51dcc..dd2b3030 100644 --- a/tests/identity/tests.py +++ b/tests/identity/tests.py @@ -1,7 +1,10 @@ -import pytest - +# Standard Library Imports from uuid import UUID +# Protean +import pytest + +# Local/Relative Imports from .elements import Person diff --git a/tests/impl/repository/sqlalchemy_repo/postgresql/config.py b/tests/impl/repository/sqlalchemy_repo/postgresql/config.py index 26e0399b..163fdec2 100644 --- a/tests/impl/repository/sqlalchemy_repo/postgresql/config.py +++ b/tests/impl/repository/sqlalchemy_repo/postgresql/config.py @@ -1,3 +1,4 @@ +# Protean from protean.utils import Database, IdentityStrategy, IdentityType #################### diff --git a/tests/impl/repository/sqlalchemy_repo/postgresql/conftest.py b/tests/impl/repository/sqlalchemy_repo/postgresql/conftest.py index a4a913d6..f70915c5 100644 --- a/tests/impl/repository/sqlalchemy_repo/postgresql/conftest.py +++ b/tests/impl/repository/sqlalchemy_repo/postgresql/conftest.py @@ -1,4 +1,7 @@ +# Standard Library Imports import os + +# Protean import pytest diff --git a/tests/impl/repository/sqlalchemy_repo/postgresql/elements.py b/tests/impl/repository/sqlalchemy_repo/postgresql/elements.py index 146b6a9c..e93bac19 100644 --- a/tests/impl/repository/sqlalchemy_repo/postgresql/elements.py +++ b/tests/impl/repository/sqlalchemy_repo/postgresql/elements.py @@ -1,3 +1,4 @@ +# Standard Library Imports from datetime import datetime # Protean diff --git a/tests/impl/repository/sqlalchemy_repo/postgresql/test_dao.py b/tests/impl/repository/sqlalchemy_repo/postgresql/test_dao.py index 76a70b91..e1729625 100644 --- a/tests/impl/repository/sqlalchemy_repo/postgresql/test_dao.py +++ b/tests/impl/repository/sqlalchemy_repo/postgresql/test_dao.py @@ -1,12 +1,13 @@ # Protean -import pytest - +# Standard Library Imports from datetime import datetime, timedelta -from sqlalchemy.orm.session import Session from uuid import uuid4 +import pytest + from protean.core.exceptions import ObjectNotFoundError, TooManyObjectsError, ValidationError from protean.core.queryset import Q, QuerySet +from sqlalchemy.orm.session import Session # Local/Relative Imports from .elements import Person, User diff --git a/tests/impl/repository/sqlalchemy_repo/postgresql/test_provider.py b/tests/impl/repository/sqlalchemy_repo/postgresql/test_provider.py index aeb0280c..c4da1b73 100644 --- a/tests/impl/repository/sqlalchemy_repo/postgresql/test_provider.py +++ b/tests/impl/repository/sqlalchemy_repo/postgresql/test_provider.py @@ -1,14 +1,13 @@ """Module to test SQLAlchemy Provider Class""" -# Standard Library Imports +# Protean import pytest +from protean.impl.repository.sqlalchemy_repo import SAProvider from sqlalchemy.engine.result import ResultProxy from sqlalchemy.orm.session import Session -# Protean -from protean.impl.repository.sqlalchemy_repo import SAProvider - -from .elements import Person, Alien +# Local/Relative Imports +from .elements import Alien, Person @pytest.mark.postgresql diff --git a/tests/impl/repository/sqlalchemy_repo/postgresql/test_transactions.py b/tests/impl/repository/sqlalchemy_repo/postgresql/test_transactions.py index 3e4ecf3a..21497131 100644 --- a/tests/impl/repository/sqlalchemy_repo/postgresql/test_transactions.py +++ b/tests/impl/repository/sqlalchemy_repo/postgresql/test_transactions.py @@ -1,10 +1,14 @@ -import pytest +# Standard Library Imports import random import string +# Protean +import pytest + from protean.core.exceptions import ObjectNotFoundError from protean.core.unit_of_work import UnitOfWork +# Local/Relative Imports from .elements import Person, PersonRepository diff --git a/tests/impl/repository/sqlalchemy_repo/sqlite/config.py b/tests/impl/repository/sqlalchemy_repo/sqlite/config.py index 2fc03935..9fca58c8 100644 --- a/tests/impl/repository/sqlalchemy_repo/sqlite/config.py +++ b/tests/impl/repository/sqlalchemy_repo/sqlite/config.py @@ -1,3 +1,4 @@ +# Protean from protean.utils import Database, IdentityStrategy, IdentityType #################### diff --git a/tests/impl/repository/sqlalchemy_repo/sqlite/conftest.py b/tests/impl/repository/sqlalchemy_repo/sqlite/conftest.py index ab0d925a..9da0896c 100644 --- a/tests/impl/repository/sqlalchemy_repo/sqlite/conftest.py +++ b/tests/impl/repository/sqlalchemy_repo/sqlite/conftest.py @@ -1,4 +1,7 @@ +# Standard Library Imports import os + +# Protean import pytest diff --git a/tests/impl/repository/sqlalchemy_repo/sqlite/elements.py b/tests/impl/repository/sqlalchemy_repo/sqlite/elements.py index 146b6a9c..e93bac19 100644 --- a/tests/impl/repository/sqlalchemy_repo/sqlite/elements.py +++ b/tests/impl/repository/sqlalchemy_repo/sqlite/elements.py @@ -1,3 +1,4 @@ +# Standard Library Imports from datetime import datetime # Protean diff --git a/tests/impl/repository/sqlalchemy_repo/sqlite/test_dao.py b/tests/impl/repository/sqlalchemy_repo/sqlite/test_dao.py index 8f8835af..c070979d 100644 --- a/tests/impl/repository/sqlalchemy_repo/sqlite/test_dao.py +++ b/tests/impl/repository/sqlalchemy_repo/sqlite/test_dao.py @@ -1,11 +1,12 @@ # Protean -import pytest - +# Standard Library Imports from datetime import datetime, timedelta -from sqlalchemy.orm.session import Session + +import pytest from protean.core.exceptions import ObjectNotFoundError, TooManyObjectsError, ValidationError from protean.core.queryset import Q, QuerySet +from sqlalchemy.orm.session import Session # Local/Relative Imports from .elements import Person, User diff --git a/tests/impl/repository/sqlalchemy_repo/sqlite/test_provider.py b/tests/impl/repository/sqlalchemy_repo/sqlite/test_provider.py index 79ace81b..b5d3cf19 100644 --- a/tests/impl/repository/sqlalchemy_repo/sqlite/test_provider.py +++ b/tests/impl/repository/sqlalchemy_repo/sqlite/test_provider.py @@ -1,14 +1,13 @@ """Module to test SQLAlchemy Provider Class""" -# Standard Library Imports +# Protean import pytest +from protean.impl.repository.sqlalchemy_repo import SAProvider from sqlalchemy.engine.result import ResultProxy from sqlalchemy.orm.session import Session -# Protean -from protean.impl.repository.sqlalchemy_repo import SAProvider - -from .elements import Person, Alien +# Local/Relative Imports +from .elements import Alien, Person class TestProviders: diff --git a/tests/impl/repository/sqlalchemy_repo/sqlite/test_transactions.py b/tests/impl/repository/sqlalchemy_repo/sqlite/test_transactions.py index e2dfda56..57b78e96 100644 --- a/tests/impl/repository/sqlalchemy_repo/sqlite/test_transactions.py +++ b/tests/impl/repository/sqlalchemy_repo/sqlite/test_transactions.py @@ -1,10 +1,14 @@ -import pytest +# Standard Library Imports import random import string +# Protean +import pytest + from protean.core.exceptions import ObjectNotFoundError from protean.core.unit_of_work import UnitOfWork +# Local/Relative Imports from .elements import Person, PersonRepository diff --git a/tests/repository/test_resultset.py b/tests/repository/test_resultset.py index dd50d5c6..bac0ef9e 100644 --- a/tests/repository/test_resultset.py +++ b/tests/repository/test_resultset.py @@ -1,3 +1,4 @@ +# Protean from protean.core.repository.resultset import ResultSet diff --git a/tests/unit_of_work/test_uow_transactions.py b/tests/unit_of_work/test_uow_transactions.py index 81d63ee5..c653f1d9 100644 --- a/tests/unit_of_work/test_uow_transactions.py +++ b/tests/unit_of_work/test_uow_transactions.py @@ -1,10 +1,14 @@ -import pytest +# Standard Library Imports import random import string +# Protean +import pytest + from protean.core.exceptions import ObjectNotFoundError from protean.core.unit_of_work import UnitOfWork +# Local/Relative Imports from .elements import Person, PersonRepository