Skip to content

Commit

Permalink
bump black
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Narcisi committed Jan 26, 2024
1 parent b719991 commit b63a0e8
Show file tree
Hide file tree
Showing 36 changed files with 57 additions and 21 deletions.
2 changes: 1 addition & 1 deletion backend/gn_module_import/checks/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def do_nomenclatures_mapping(imprt, fields):
.where(TNomenclatures.id_type == BibNomenclaturesTypes.id_type)
.values({field.synthese_field: TNomenclatures.id_nomenclature})
)
db.session.execute(stmt, execution_options=dict({"synchronize_session": 'fetch'}))
db.session.execute(stmt, execution_options=dict({"synchronize_session": "fetch"}))

for field in BibFields.query.filter(BibFields.mnemonique != None).all():
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-25 10:51:14.746232
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-12 09:39:45.951064
"""

import sqlalchemy as sa
from sqlalchemy.schema import Table, MetaData
from sqlalchemy.exc import NoReferenceError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-09-28 10:19:10.133530
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-03-30 11:06:40.502478
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-03-29 23:02:14.880716
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-01-12 12:01:34.177079
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-03-29 18:38:24.512562
"""

from alembic import op, context
import sqlalchemy as sa
import pkg_resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-03-22 16:17:51.354279
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-22 12:58:31.609964
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-14 14:03:41.842620
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-20 14:43:24.306971
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-02-09 10:35:27.895766
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-07-05 18:09:53.133560
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-10 12:42:31.793379
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-10 20:18:37.214323
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-20 17:48:33.848166
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.types import ARRAY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-27 13:51:46.622094
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-04-27 10:02:53.798753
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.types import ARRAY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-07-27 11:18:00.424394
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-31 12:38:11.170056
"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.types import ARRAY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-07-05 18:15:09.885031
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-06-14 11:40:29.580680
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-02-01 16:28:34.090996
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-16 14:34:03.746276
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-09-18 11:29:42.145359
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-09-27 15:37:19.286693
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-28 16:48:46.664645
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-22 11:40:05.678227
"""

from alembic import op
import sqlalchemy as sa

Expand Down
8 changes: 5 additions & 3 deletions backend/gn_module_import/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,11 @@ def validate_values(values):
"type": "object",
"properties": {
field.name_field: {
"type": "boolean"
if field.autogenerated
else ("array" if field.multi else "string"),
"type": (
"boolean"
if field.autogenerated
else ("array" if field.multi else "string")
),
}
for field in fields
},
Expand Down
3 changes: 2 additions & 1 deletion backend/gn_module_import/routes/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

from flask import request, current_app, jsonify, g, stream_with_context, send_file
from werkzeug.exceptions import Conflict, BadRequest, Forbidden, Gone

# url_quote was deprecated in werkzeug 3.0 https://stackoverflow.com/a/77222063/5807438
from urllib.parse import (
quote as url_quote,
)
)
from sqlalchemy import or_, func, desc
from sqlalchemy.inspection import inspect
from sqlalchemy.orm import joinedload, Load, load_only, undefer, contains_eager, class_mapper
Expand Down
9 changes: 6 additions & 3 deletions backend/gn_module_import/send_mail.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Fonctions permettant l'envoi d'email
"""

from flask import url_for, current_app

from geonature.utils.utilsmails import send_mail
Expand Down Expand Up @@ -37,9 +38,11 @@ def import_send_mail(mail_to, file_name, step, id_import):

send_mail(
recipients=mail_to,
subject="[GeoNature] Import réalisé"
if (step == "import")
else "[GeoNature] Import - Contrôles terminés",
subject=(
"[GeoNature] Import réalisé"
if (step == "import")
else "[GeoNature] Import - Contrôles terminés"
),
msg_html=msg,
)

Expand Down
2 changes: 1 addition & 1 deletion backend/gn_module_import/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from geonature.tests.fixtures import *
from geonature.tests.fixtures import app, _session, users
from pypnusershub.tests.fixtures import teardown_logout_user
from pypnusershub.tests.fixtures import teardown_logout_user
12 changes: 7 additions & 5 deletions backend/gn_module_import/tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from pypnusershub.db.models import User, Organisme
from pypnusershub.tests.utils import (
set_logged_user,
set_logged_user_cookie,
unset_logged_user_cookie
set_logged_user_cookie,
unset_logged_user_cookie,
)
from pypnnomenclature.models import TNomenclatures, BibNomenclaturesTypes
from ref_geo.tests.test_ref_geo import has_french_dem
Expand Down Expand Up @@ -218,9 +218,11 @@ def fieldmapping(import_file_name, autogenerate):
return FieldMapping.query.filter_by(label="Synthese GeoNature").one().values
else:
return {
f.name_field: autogenerate
if f.autogenerated
else ([f.name_field, "cd_nom"] if f.multi else f.name_field)
f.name_field: (
autogenerate
if f.autogenerated
else ([f.name_field, "cd_nom"] if f.multi else f.name_field)
)
for f in BibFields.query.filter_by(display=True)
}

Expand Down
10 changes: 6 additions & 4 deletions backend/gn_module_import/tests/test_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Profils as Profil,
UserApplicationRight,
)
from pypnusershub.tests.utils import (set_logged_user_cookie)
from pypnusershub.tests.utils import set_logged_user_cookie

from gn_module_import.models import (
MappingTemplate,
Expand All @@ -50,9 +50,11 @@
def mappings(users):
mappings = {}
fieldmapping_values = {
field.name_field: True
if field.autogenerated
else ([field.name_field] if field.multi else field.name_field)
field.name_field: (
True
if field.autogenerated
else ([field.name_field] if field.multi else field.name_field)
)
for field in (
BibFields.query.filter_by(display=True).with_entities(
BibFields.name_field, BibFields.autogenerated, BibFields.multi
Expand Down
4 changes: 1 addition & 3 deletions backend/gn_module_import/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ def detect_separator(f, encoding):


def get_valid_bbox(imprt):
stmt = db.select(
func.ST_AsGeojson(func.ST_Extent(ImportSyntheseData.the_geom_4326))
).filter(
stmt = db.select(func.ST_AsGeojson(func.ST_Extent(ImportSyntheseData.the_geom_4326))).filter(
ImportSyntheseData.imprt == imprt,
ImportSyntheseData.valid == True,
)
Expand Down

0 comments on commit b63a0e8

Please sign in to comment.