Skip to content

Commit

Permalink
Nest Container classes under utils module
Browse files Browse the repository at this point in the history
  • Loading branch information
subhashb committed Jul 25, 2024
1 parent 525fe45 commit 1c80cdf
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/protean/adapters/repository/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
from elasticsearch.exceptions import NotFoundError
from elasticsearch_dsl import Document, Index, Keyword, Mapping, Search, query

from protean.container import Options
from protean.core.queryset import ResultSet
from protean.exceptions import ObjectNotFoundError
from protean.fields import Reference
from protean.port.dao import BaseDAO, BaseLookup
from protean.port.provider import BaseProvider
from protean.reflection import attributes, id_field
from protean.utils import IdentityStrategy, IdentityType
from protean.utils.container import Options
from protean.utils.globals import current_domain
from protean.utils.query import Q

Expand Down
2 changes: 1 addition & 1 deletion src/protean/adapters/repository/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
from typing import Any
from uuid import UUID

from protean.container import Options
from protean.core.model import BaseModel
from protean.core.queryset import ResultSet
from protean.exceptions import ObjectNotFoundError, ValidationError
from protean.fields.basic import Auto
from protean.port.dao import BaseDAO, BaseLookup
from protean.port.provider import BaseProvider
from protean.reflection import attributes, fields, id_field
from protean.utils.container import Options
from protean.utils.globals import current_uow
from protean.utils.query import Q

Expand Down
2 changes: 1 addition & 1 deletion src/protean/adapters/repository/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from sqlalchemy.exc import DatabaseError
from sqlalchemy.types import CHAR, TypeDecorator

from protean.container import Options
from protean.core.model import BaseModel
from protean.core.queryset import ResultSet
from protean.core.value_object import BaseValueObject
Expand Down Expand Up @@ -43,6 +42,7 @@
from protean.port.provider import BaseProvider
from protean.reflection import attributes, id_field
from protean.utils import IdentityType
from protean.utils.container import Options
from protean.utils.globals import current_domain, current_uow
from protean.utils.query import Q

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/application_service.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging

from protean.container import Element, OptionsMixin
from protean.exceptions import NotSupportedError
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/command_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from protean.container import Element, OptionsMixin
from protean.exceptions import IncorrectUsageError, NotSupportedError
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin
from protean.utils.mixins import HandlerMixin


Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/domain_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from typing import List, Union

from protean import BaseAggregate
from protean.container import Element, OptionsMixin
from protean.exceptions import IncorrectUsageError, NotSupportedError, ValidationError
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/email.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from abc import abstractmethod

from protean.container import BaseContainer, OptionsMixin
from protean.fields import Dict, List, String, Text
from protean.utils import (
DomainObjects,
convert_str_values_to_list,
derive_element_class,
)
from protean.utils.container import BaseContainer, OptionsMixin


class BaseEmailProvider:
Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from collections import defaultdict
from functools import partial

from protean.container import BaseContainer, IdentityMixin, OptionsMixin
from protean.exceptions import (
ConfigurationError,
IncorrectUsageError,
Expand All @@ -30,6 +29,7 @@
generate_identity,
inflection,
)
from protean.utils.container import BaseContainer, IdentityMixin, OptionsMixin

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/event_handler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging

from protean.container import Element, OptionsMixin
from protean.exceptions import IncorrectUsageError, NotSupportedError
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin
from protean.utils.mixins import HandlerMixin

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/event_sourced_repository.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import logging

from protean import BaseAggregate, UnitOfWork
from protean.container import Element, OptionsMixin
from protean.exceptions import (
IncorrectUsageError,
NotSupportedError,
ObjectNotFoundError,
)
from protean.fields import Identifier
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin
from protean.utils.globals import current_uow

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/model.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from abc import abstractmethod

from protean.container import Element, OptionsMixin
from protean.exceptions import IncorrectUsageError, NotSupportedError
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin


class BaseModel(Element, OptionsMixin):
Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from functools import lru_cache
from typing import TYPE_CHECKING, Union

from protean.container import Element, OptionsMixin
from protean.core.aggregate import BaseAggregate
from protean.core.unit_of_work import UnitOfWork
from protean.core.view import BaseView
Expand All @@ -19,6 +18,7 @@
derive_element_class,
fully_qualified_name,
)
from protean.utils.container import Element, OptionsMixin
from protean.utils.globals import current_domain, current_uow

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from marshmallow import Schema, fields

from protean.container import Element, Options, OptionsMixin
from protean.exceptions import NotSupportedError
from protean.fields import (
Boolean,
Expand All @@ -23,6 +22,7 @@
)
from protean.reflection import _FIELDS
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, Options, OptionsMixin

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from abc import abstractmethod
from typing import Any, Optional

from protean.container import Element, OptionsMixin
from protean.core.event import BaseEvent
from protean.exceptions import IncorrectUsageError, NotSupportedError
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import Element, OptionsMixin

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/value_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import logging
from collections import defaultdict

from protean.container import BaseContainer, OptionsMixin, fields
from protean.exceptions import IncorrectUsageError, NotSupportedError, ValidationError
from protean.fields import Reference, ValueObject
from protean.fields.association import Association
from protean.utils import DomainObjects, derive_element_class
from protean.utils.container import BaseContainer, OptionsMixin, fields

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/core/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import logging

from protean.container import BaseContainer, OptionsMixin
from protean.core.entity import _EntityState
from protean.exceptions import IncorrectUsageError, NotSupportedError
from protean.fields import Field, Reference, ValueObject
from protean.fields.association import Association
from protean.reflection import _ID_FIELD_NAME, declared_fields, id_field
from protean.utils import DomainObjects, derive_element_class, inflection
from protean.utils.container import BaseContainer, OptionsMixin

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/protean/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from protean.adapters import Brokers, Caches, EmailProviders, Providers
from protean.adapters.event_store import EventStore
from protean.container import Element
from protean.core.aggregate import element_to_fact_event
from protean.core.command import BaseCommand
from protean.core.command_handler import BaseCommandHandler
Expand All @@ -38,6 +37,7 @@
EventProcessing,
fqn,
)
from protean.utils.container import Element
from protean.utils.globals import g

from .config import Config2, ConfigAttribute
Expand Down
2 changes: 1 addition & 1 deletion src/protean/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class DomainObjects(Enum):


def derive_element_class(element_cls, base_cls, **opts):
from protean.container import Options
from protean.utils.container import Options

# Ensure options being passed in are known
known_options = [name for (name, _) in base_cls._default_options()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from protean.fields import Auto, Field, FieldBase, ValueObject
from protean.utils import generate_identity

from .reflection import (
from ..reflection import (
_FIELDS,
_ID_FIELD_NAME,
attributes,
Expand Down
2 changes: 1 addition & 1 deletion src/protean/utils/eventing.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import json
from datetime import datetime, timezone

from protean.container import BaseContainer, OptionsMixin
from protean.core.value_object import BaseValueObject
from protean.exceptions import ConfigurationError, IncorrectUsageError
from protean.fields import DateTime, Field, Integer, String, ValueObject
from protean.fields.association import Association, Reference
from protean.reflection import _ID_FIELD_NAME, declared_fields, fields
from protean.utils.container import BaseContainer, OptionsMixin


class Metadata(BaseValueObject):
Expand Down
2 changes: 1 addition & 1 deletion src/protean/utils/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from typing import Callable, Dict, Union

from protean import fields
from protean.container import BaseContainer, OptionsMixin
from protean.core.command import BaseCommand
from protean.core.event import BaseEvent
from protean.core.unit_of_work import UnitOfWork
from protean.exceptions import ConfigurationError, InvalidDataError
from protean.utils.container import BaseContainer, OptionsMixin
from protean.utils.eventing import Metadata
from protean.utils.globals import current_domain

Expand Down
2 changes: 1 addition & 1 deletion tests/container/test_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from protean.container import BaseContainer, OptionsMixin
from protean.fields import String
from protean.utils.container import BaseContainer, OptionsMixin


class TestControlledFinalization:
Expand Down
2 changes: 1 addition & 1 deletion tests/container/test_options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from protean.container import Options
from protean.utils.container import Options


class Meta:
Expand Down
2 changes: 1 addition & 1 deletion tests/entity/test_entity.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest

from protean.container import Options
from protean.fields import Auto, Integer, String
from protean.reflection import attributes, declared_fields
from protean.utils.container import Options

from .elements import (
AbstractPerson,
Expand Down
2 changes: 1 addition & 1 deletion tests/entity/test_entity_meta.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from protean.container import Options
from protean.fields import Auto, Integer, String
from protean.reflection import attributes, declared_fields
from protean.utils.container import Options

from .elements import (
AbstractPerson,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_containers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from protean.container import BaseContainer, OptionsMixin
from protean.core.view import BaseView
from protean.exceptions import InvalidDataError, NotSupportedError
from protean.fields import Integer, String
from protean.reflection import declared_fields
from protean.utils.container import BaseContainer, OptionsMixin


class CustomContainerMeta(BaseContainer):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from protean.container import Options
from protean.utils.container import Options


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import pytest

from protean import BaseView
from protean.container import Options
from protean.exceptions import InvalidOperationError, ValidationError
from protean.fields import Auto, Identifier, Integer, String
from protean.reflection import _ID_FIELD_NAME, attributes, declared_fields, id_field
from protean.utils import fully_qualified_name
from protean.utils.container import Options


class AbstractPerson(BaseView):
Expand Down

0 comments on commit 1c80cdf

Please sign in to comment.