Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaupetit committed Dec 6, 2024
1 parent 6c3dec7 commit f5d9108
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""add auditability
Revision ID: 86b08ec6e6d1
Revises: 6e610f62bcc6
Revises: c09664a85912
Create Date: 2024-10-16 17:03:58.431420
"""
Expand All @@ -14,7 +14,7 @@

# revision identifiers, used by Alembic.
revision: str = "86b08ec6e6d1"
down_revision: Union[str, None] = "6e610f62bcc6"
down_revision: Union[str, None] = "c09664a85912"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

Expand Down
10 changes: 6 additions & 4 deletions src/api/qualicharge/schemas/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ def _save_schema(
f: stmt.excluded.get(f)
for f in self._get_fields_for_schema(schema, with_fk=True)
}
updates_on_conflict.update({
"updated_at": stmt.excluded.updated_at,
"updated_by_id": stmt.excluded.updated_by_id,
})
updates_on_conflict.update(
{
"updated_at": stmt.excluded.updated_at,
"updated_by_id": stmt.excluded.updated_by_id,
}
)
stmt = stmt.on_conflict_do_update(
constraint=constraint,
index_elements=index_elements,
Expand Down
6 changes: 3 additions & 3 deletions src/api/qualicharge/schemas/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from sqlalchemy import func
from sqlalchemy.exc import MultipleResultsFound
from sqlalchemy.schema import Column as SAColumn
from qualicharge.schemas.audit import BaseAuditableSQLModel
from sqlmodel import Session, SQLModel, select

from qualicharge.auth.schemas import User
from qualicharge.schemas.audit import BaseAuditableSQLModel

from ..exceptions import (
DatabaseQueryException,
Expand Down Expand Up @@ -91,7 +91,7 @@ def get_or_create(

# Update database entry
for key, value in entry.model_dump(
exclude=list(set(DB_TO_STATIC_EXCLUDED_FIELDS) - {"updated_by_id"})
exclude=set(DB_TO_STATIC_EXCLUDED_FIELDS) - {"updated_by_id"}
).items():
setattr(db_entry, key, value)
session.add(db_entry)
Expand All @@ -105,7 +105,7 @@ def get_or_create(
return EntryStatus.CREATED, entry


def save_schema_from_statique(
def save_schema_from_statique( # noqa: PLR0913
session: Session,
schema_klass: Type[SQLModel],
statique: Statique,
Expand Down
5 changes: 4 additions & 1 deletion src/api/tests/api/v1/routers/test_statique.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,10 @@ def test_update_for_superuser(client_auth, db_session):


def test_update_audits(client_auth, db_session):
"""Test the /statique/{id_pdc_itinerance} update endpoint audits (superuser case)."""
"""Test the /statique/{id_pdc_itinerance} update endpoint audits.
(superuser case)
"""
id_pdc_itinerance = "FR911E1111ER1"
db_statique = save_statique(
db_session,
Expand Down
5 changes: 0 additions & 5 deletions src/api/tests/schemas/test_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
)
from qualicharge.schemas.audit import Audit
from qualicharge.schemas.core import (
Amenageur,
Enseigne,
Localisation,
Operateur,
PointDeCharge,
Station,
)


Expand Down

0 comments on commit f5d9108

Please sign in to comment.