diff --git a/karp-backend/src/karp/karp_v6_api/dependencies/lex_deps.py b/karp-backend/src/karp/karp_v6_api/dependencies/lex_deps.py index ebfc1979..18986058 100644 --- a/karp-backend/src/karp/karp_v6_api/dependencies/lex_deps.py +++ b/karp-backend/src/karp/karp_v6_api/dependencies/lex_deps.py @@ -29,6 +29,7 @@ SqlReadOnlyResourceRepository, ) + def get_resource_unit_of_work( # noqa: D103 db_session: Session = Depends(get_session), event_bus: EventBus = Depends(event_deps.get_eventbus), diff --git a/karp-backend/src/karp/lex_infrastructure/__init__.py b/karp-backend/src/karp/lex_infrastructure/__init__.py index d8a0a5d7..d05e73bc 100644 --- a/karp-backend/src/karp/lex_infrastructure/__init__.py +++ b/karp-backend/src/karp/lex_infrastructure/__init__.py @@ -81,6 +81,7 @@ def resources_uow( # noqa: D102 event_bus=event_bus, ) + class GenericLexInfrastructure(injector.Module): # noqa: D101 @injector.provider def gey_entry_diff( # noqa: D102 diff --git a/karp-backend/src/karp/lex_infrastructure/repositories/sql_entries.py b/karp-backend/src/karp/lex_infrastructure/repositories/sql_entries.py index 75b68e0a..c5d4e074 100644 --- a/karp-backend/src/karp/lex_infrastructure/repositories/sql_entries.py +++ b/karp-backend/src/karp/lex_infrastructure/repositories/sql_entries.py @@ -279,8 +279,8 @@ def create( connection_str: Optional[str], user: str, message: str, - timestamp: float - ) -> 'SqlEntryUnitOfWork': + timestamp: float, + ) -> "SqlEntryUnitOfWork": return cls( id=id, name=name, diff --git a/karp-backend/src/karp/lex_infrastructure/repositories/sql_entry_uows.py b/karp-backend/src/karp/lex_infrastructure/repositories/sql_entry_uows.py index ee85a07d..22c3a4a0 100644 --- a/karp-backend/src/karp/lex_infrastructure/repositories/sql_entry_uows.py +++ b/karp-backend/src/karp/lex_infrastructure/repositories/sql_entry_uows.py @@ -19,6 +19,7 @@ logger = logging.getLogger(__name__) + class SqlEntryUowRepository(SqlRepository, Repository): # noqa: D101 def __init__( # noqa: D107 self, @@ -100,7 +101,5 @@ def repo(self) -> SqlEntryUowRepository: # noqa: D102 def create(self, *args, **kwargs) -> Tuple[EntryUnitOfWork, list[Event]]: return SqlEntryUnitOfWork.create( - *args, **kwargs, - session=self._session, - event_bus=self.event_bus + *args, **kwargs, session=self._session, event_bus=self.event_bus ), [] diff --git a/karp-backend/src/karp/main/migrations/env.py b/karp-backend/src/karp/main/migrations/env.py index 4d276f11..d7166ea8 100644 --- a/karp-backend/src/karp/main/migrations/env.py +++ b/karp-backend/src/karp/main/migrations/env.py @@ -46,10 +46,14 @@ def run_migrations_online(): # noqa: ANN201 # drop testing db if it exists and create a fresh one with default_engine.connect() as default_conn: logger.warning("dropping database: %s", karp_config.DATABASE_NAME) - default_conn.execute(text(f"DROP DATABASE IF EXISTS {karp_config.DATABASE_NAME}")) + default_conn.execute( + text(f"DROP DATABASE IF EXISTS {karp_config.DATABASE_NAME}") + ) logger.warning("creating database: %s", karp_config.DATABASE_NAME) - result = default_conn.execute(text(f"CREATE DATABASE {karp_config.DATABASE_NAME}")) + result = default_conn.execute( + text(f"CREATE DATABASE {karp_config.DATABASE_NAME}") + ) logger.warning("db response: %s", result) logger.info("migrating url: %s", karp_config.DATABASE_URL) diff --git a/karp-backend/src/karp/resource_commands.py b/karp-backend/src/karp/resource_commands.py index 5758b351..044ab4c5 100644 --- a/karp-backend/src/karp/resource_commands.py +++ b/karp-backend/src/karp/resource_commands.py @@ -117,9 +117,7 @@ def delete_resource(self, resource_id, user, message): uow.post_on_commit(events) uow.commit() - def create_entry_repository(self, name, config, user, message, connection_str=None): - entry_repo, events = self.entry_repo_uow.create( id=make_unique_id(), name=name, diff --git a/tests/unit/lex/adapters.py b/tests/unit/lex/adapters.py index 5bbf285b..ea415304 100644 --- a/tests/unit/lex/adapters.py +++ b/tests/unit/lex/adapters.py @@ -266,7 +266,6 @@ def create( return self._cache[entity_id], [] - class InMemoryLexInfrastructure(injector.Module): @injector.provider @injector.singleton