Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 10, 2024
1 parent 226e264 commit e42e65e
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 82 deletions.
4 changes: 1 addition & 3 deletions qgepqwat2ili/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
# 28.3.2023 additional import for sia405, export to be discussed further
from ..qgepsia405.export import qgep_export as qgepsia405_export
from ..qgepsia405.import_ import qgep_import as qgepsia405_import

from ..utils.ili2db import (
# neu 22.7.2022; get_xtf_model,; neu 31.3.2023; neu 12.4.2023
from ..utils.ili2db import ( # neu 22.7.2022; get_xtf_model,; neu 31.3.2023; neu 12.4.2023
check_fk_dataowner_null,
check_fk_operator_null,
check_fk_owner_null,
Expand Down
2 changes: 1 addition & 1 deletion qgepqwat2ili/qgep/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

from .. import utils
from ..utils.basket_utils import BasketUtils
from ..utils.qgep_export_utils import QgepExportUtils

# 4.10.2024
from ..utils.ili2db import skip_wwtp_structure_ids
from ..utils.qgep_export_utils import QgepExportUtils
from ..utils.various import logger
from .model_abwasser import get_abwasser_model
from .model_qgep import get_qgep_model
Expand Down
230 changes: 166 additions & 64 deletions qgepqwat2ili/qgepdss/export.py

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions qgepqwat2ili/qgepsia405/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

from .. import utils
from ..utils.basket_utils import BasketUtils
from ..utils.qgep_export_utils import QgepExportUtils

# 4.10.2024
from ..utils.ili2db import skip_wwtp_structure_ids
from ..utils.qgep_export_utils import QgepExportUtils
from ..utils.various import logger
from .model_abwasser import get_abwasser_model
from .model_qgep import get_qgep_model
Expand Down Expand Up @@ -52,7 +52,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None):

# Logging for debugging
logger.info(f"print subset_ids '{subset_ids}'")

# get list of id's of class wwtp_structure (ARABauwerk) to be able to check if fk_wastewater_structure references to wwtp_structure

wastewater_structure_id_sia405abwasser_list = None
Expand Down Expand Up @@ -100,7 +100,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
**qgep_export_utils.base_common(row, "organisation"),
# --- organisation ---
auid=row.uid,
bemerkung=qgep_export_utils.truncate(qgep_export_utils.emptystr_to_null(row.remark), 80),
bemerkung=qgep_export_utils.truncate(
qgep_export_utils.emptystr_to_null(row.remark), 80
),
bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier),
)
abwasser_session.add(organisation)
Expand Down Expand Up @@ -359,7 +361,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
# --- sia405_baseclass ---
**qgep_export_utils.base_common(row, "rohrprofil"),
# --- rohrprofil ---
bemerkung=qgep_export_utils.truncate(qgep_export_utils.emptystr_to_null(row.remark), 80),
bemerkung=qgep_export_utils.truncate(
qgep_export_utils.emptystr_to_null(row.remark), 80
),
bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier),
hoehenbreitenverhaeltnis=row.height_width_ratio,
profiltyp=qgep_export_utils.get_vl(row.profile_type__REL),
Expand Down Expand Up @@ -405,7 +409,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
subset_ids, row.fk_wastewater_networkelement__REL
),
auslaufform=qgep_export_utils.get_vl(row.outlet_shape__REL),
bemerkung=qgep_export_utils.truncate(qgep_export_utils.emptystr_to_null(row.remark), 80),
bemerkung=qgep_export_utils.truncate(
qgep_export_utils.emptystr_to_null(row.remark), 80
),
bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier),
hoehengenauigkeit=qgep_export_utils.get_vl(row.elevation_accuracy__REL),
kote=row.level,
Expand Down Expand Up @@ -765,7 +771,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
)
continue
ili_label = ABWASSER.abwasserbauwerk_text(
**qgep_export_utils.textpos_common(label, "abwasserbauwerk_text", geojson_crs_def),
**qgep_export_utils.textpos_common(
label, "abwasserbauwerk_text", geojson_crs_def
),
abwasserbauwerkref=tid_for_obj_id["abwasserbauwerk"][obj_id],
)

Expand Down
1 change: 0 additions & 1 deletion qgepqwat2ili/utils/basket_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from .. import config


Expand Down
5 changes: 2 additions & 3 deletions qgepqwat2ili/utils/ili2db.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def check_wastewater_structure_subclass_data():
connection.set_session(autocommit=True)
cursor = connection.cursor()
cursor.execute("SELECT obj_id FROM qgep_od.wastewater_structure;")

if cursor.rowcount > 0:
wastewater_structure_count = cursor.rowcount
logger.info(f"Number of wastewater_structure datasets: {wastewater_structure_count}")
Expand Down Expand Up @@ -587,8 +587,7 @@ def get_xtf_model(xtf_file):
checkmodelssection = -1
impmodel = "not found"


with open(xtf_file, mode="r", encoding="utf-8") as f:
with open(xtf_file, encoding="utf-8") as f:
while True:
# if checkdatasection == -1:
if checkmodelssection == -1:
Expand Down
16 changes: 12 additions & 4 deletions qgepqwat2ili/utils/qgep_export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class QgepExportUtils:

def __init__(self, tid_maker, current_basket, abwasser_session, abwasser_model, labelorientation):
def __init__(
self, tid_maker, current_basket, abwasser_session, abwasser_model, labelorientation
):
self.tid_maker = tid_maker
self.current_basket = current_basket
self.abwasser_session = abwasser_session
Expand Down Expand Up @@ -116,8 +118,12 @@ def create_metaattributes(self, row):
# datenherr=getattr(row.fk_dataowner__REL, "identifier", "unknown"), # TODO : is unknown ok ?
# datenlieferant=getattr(row.fk_provider__REL, "identifier", "unknown"), # TODO : is unknown ok ?
# 31.3.2023 obj_id instead of name
datenherr=getattr(row.fk_dataowner__REL, "obj_id", "unknown"), # TODO : is unknown ok ?
datenlieferant=getattr(row.fk_provider__REL, "obj_id", "unknown"), # TODO : is unknown ok ?
datenherr=getattr(
row.fk_dataowner__REL, "obj_id", "unknown"
), # TODO : is unknown ok ?
datenlieferant=getattr(
row.fk_provider__REL, "obj_id", "unknown"
), # TODO : is unknown ok ?
letzte_aenderung=row.last_modification,
sia405_baseclass_metaattribute=self.get_tid(row),
# OD : is this OK ? Don't we need a different t_id from what inserted above in organisation ? if so, consider adding a "for_class" arg to tid_for_row
Expand Down Expand Up @@ -150,7 +156,9 @@ def wastewater_structure_common(self, row):
"""
Returns common attributes for wastewater_structure
"""
logger.warning(f"Mapping of wastewater_structure->abwasserbauwerk is not fully implemented.")
logger.warning(
f"Mapping of wastewater_structure->abwasserbauwerk is not fully implemented."
)
return {
# --- abwasserbauwerk ---
"akten": row.records,
Expand Down

0 comments on commit e42e65e

Please sign in to comment.