From 1cce55e6efb039ad8b5e4889d59c9a5208e80ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20=C3=96hrman?= Date: Tue, 6 Feb 2024 14:20:08 +0100 Subject: [PATCH] remove unused --- karp-backend/src/karp/main/__init__.py | 2 -- karp-backend/src/karp/main/modules.py | 2 -- karp-backend/src/karp/search/generic_resources.py | 12 ------------ .../src/karp/search_infrastructure/__init__.py | 9 --------- tests/integration/conftest.py | 3 --- tests/unit/search/conftest.py | 2 -- 6 files changed, 30 deletions(-) delete mode 100644 karp-backend/src/karp/search/generic_resources.py diff --git a/karp-backend/src/karp/main/__init__.py b/karp-backend/src/karp/main/__init__.py index 8bd31628..aa11b49b 100644 --- a/karp-backend/src/karp/main/__init__.py +++ b/karp-backend/src/karp/main/__init__.py @@ -15,7 +15,6 @@ from karp.lex_infrastructure import GenericLexInfrastructure, LexInfrastructure from karp.search_infrastructure import ( - GenericSearchInfrastructure, Es6SearchIndexMod, ) from karp.main import config, modules @@ -77,7 +76,6 @@ def _setup_dependency_injection( ElasticSearchMod(es_url), LexInfrastructure(), GenericLexInfrastructure(), - GenericSearchInfrastructure(), ], auto_bind=False, ) diff --git a/karp-backend/src/karp/main/modules.py b/karp-backend/src/karp/main/modules.py index 079b20b8..dbb3bffa 100644 --- a/karp-backend/src/karp/main/modules.py +++ b/karp-backend/src/karp/main/modules.py @@ -8,7 +8,6 @@ from karp.lex.application.repositories import ResourceRepository from karp.lex_infrastructure import ResourceQueries, GenericEntryViews from karp.resource_commands import ResourceCommands -from karp.search.generic_resources import GenericResourceViews from karp.search_commands import SearchCommands from karp.search_infrastructure.repositories.es6_indicies import Es6Index @@ -85,7 +84,6 @@ def entry_commands( session: Session, resources: ResourceRepository, index: Es6Index, - resource_views: GenericResourceViews, ) -> EntryCommands: return EntryCommands( session=session, diff --git a/karp-backend/src/karp/search/generic_resources.py b/karp-backend/src/karp/search/generic_resources.py deleted file mode 100644 index 8378c42c..00000000 --- a/karp-backend/src/karp/search/generic_resources.py +++ /dev/null @@ -1,12 +0,0 @@ -import typing - -from karp.lex.application.repositories import ResourceRepository - - -class GenericResourceViews: - def __init__(self, resources: ResourceRepository) -> None: # noqa: D107 - super().__init__() - self._resources = resources - - def get_resource_config(self, resource_id: str) -> typing.Dict: # noqa: D102 - return self._resource.by_resource_id(resource_id).config diff --git a/karp-backend/src/karp/search_infrastructure/__init__.py b/karp-backend/src/karp/search_infrastructure/__init__.py index 79696dde..e86ece74 100644 --- a/karp-backend/src/karp/search_infrastructure/__init__.py +++ b/karp-backend/src/karp/search_infrastructure/__init__.py @@ -3,25 +3,16 @@ import injector import logging -from karp.lex.application.repositories import ResourceRepository - from karp.search_infrastructure.queries import ( Es6SearchService, ) from karp.search_infrastructure.repositories.es6_indicies import Es6Index from karp.search_infrastructure.elasticsearch6 import Es6MappingRepository -from karp.search.generic_resources import GenericResourceViews logger = logging.getLogger(__name__) -class GenericSearchInfrastructure(injector.Module): # noqa: D101 - @injector.provider - def get_resource_config(self, resources: ResourceRepository) -> GenericResourceViews: - return GenericResourceViews(resources=resources) - - class Es6SearchIndexMod(injector.Module): # noqa: D101 def __init__(self, index_prefix: Optional[str] = None) -> None: # noqa: D107 self._index_prefix = index_prefix or "" diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index d35fbe03..9a32b957 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -1,7 +1,6 @@ """Pytest entry point.""" -import pytest # noqa: I001 import injector import pytest # pyre-ignore # noqa: F811 from sqlalchemy import create_engine @@ -10,7 +9,6 @@ from alembic.config import main as alembic_main # noqa: F401 from tests.unit.lex.adapters import InMemoryLexInfrastructure -from karp.search_infrastructure import GenericSearchInfrastructure from karp.main.modules import CommandsMod from karp.lex_infrastructure import GenericLexInfrastructure @@ -45,7 +43,6 @@ def integration_ctx() -> adapters.IntegrationTestContext: CommandsMod(), GenericLexInfrastructure(), InMemoryLexInfrastructure(), - GenericSearchInfrastructure(), search_adapters.InMemorySearchInfrastructure(), ], auto_bind=False, diff --git a/tests/unit/search/conftest.py b/tests/unit/search/conftest.py index 9ebee653..89953795 100644 --- a/tests/unit/search/conftest.py +++ b/tests/unit/search/conftest.py @@ -3,7 +3,6 @@ from karp.lex_infrastructure import GenericLexInfrastructure from karp.main.modules import CommandsMod -from karp.search_infrastructure import GenericSearchInfrastructure from tests.unit.lex.adapters import InMemoryLexInfrastructure from . import adapters @@ -16,7 +15,6 @@ def search_unit_ctx() -> adapters.SearchUnitTestContext: CommandsMod(), GenericLexInfrastructure(), InMemoryLexInfrastructure(), - GenericSearchInfrastructure(), adapters.InMemorySearchInfrastructure(), ], auto_bind=False,