Skip to content

Commit

Permalink
fmt and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
majsan committed Jan 30, 2024
1 parent ec9a101 commit d2ce0d1
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions karp-backend/src/karp/karp_v6_api/dependencies/lex_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions karp-backend/src/karp/lex_infrastructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

logger = logging.getLogger(__name__)


class SqlEntryUowRepository(SqlRepository, Repository): # noqa: D101
def __init__( # noqa: D107
self,
Expand Down Expand Up @@ -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
), []
8 changes: 6 additions & 2 deletions karp-backend/src/karp/main/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions karp-backend/src/karp/resource_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion tests/unit/lex/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ def create(
return self._cache[entity_id], []



class InMemoryLexInfrastructure(injector.Module):
@injector.provider
@injector.singleton
Expand Down

0 comments on commit d2ce0d1

Please sign in to comment.