Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKallekleiv committed Sep 12, 2023
1 parent 6ac0af3 commit 46e23b7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions backend/src/services/smda_access/stratigraphy_access.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

from typing import List, Dict

from .queries.get_stratigraphic_units import get_stratigraphic_units
Expand Down Expand Up @@ -31,7 +33,7 @@ def create_hierarchical_structure(strat_units: List[StratigraphicUnit]) -> List[
for unit in strat_units:
if unit.strat_unit_parent and unit.strat_unit_parent in unit_by_id:
parent = unit_by_id[unit.strat_unit_parent]
parent["children"].append(unit) # type: ignore
parent["children"].append(unit)
else:
roots.append(unit)

Expand Down Expand Up @@ -71,9 +73,9 @@ def sort_stratigraphic_names_by_hierarchy(strat_units: List[StratigraphicUnit])

for unit in strat_units:
if unit.strat_unit_parent and unit.strat_unit_parent in unit_by_id:
unit_by_id[unit.strat_unit_parent]["children"].append(unit) # type: ignore
unit_by_id[unit.strat_unit_parent]["children"].append(unit)

roots = [data["unit"] for data in unit_by_id.values() if not data["unit"].strat_unit_parent] # type: ignore
roots = [data["unit"] for data in unit_by_id.values() if not data["unit"].strat_unit_parent]
sorted_units = flatten_hierarchical_structure_to_surface_name(roots, unit_by_id)
return sorted_units

Expand All @@ -84,8 +86,8 @@ def sort_stratigraphic_units_by_hierarchy(strat_units: List[StratigraphicUnit])

for unit in strat_units:
if unit.strat_unit_parent and unit.strat_unit_parent in unit_by_id:
unit_by_id[unit.strat_unit_parent]["children"].append(unit) # type: ignore
unit_by_id[unit.strat_unit_parent]["children"].append(unit)

roots = [data["unit"] for data in unit_by_id.values() if not data["unit"].strat_unit_parent]
sorted_units = flatten_hierarchical_structure(roots, unit_by_id) # type: ignore
sorted_units = flatten_hierarchical_structure(roots, unit_by_id)
return sorted_units

0 comments on commit 46e23b7

Please sign in to comment.