Skip to content

Commit 8486a05

Browse files
committed
style: linting
1 parent 5ab4648 commit 8486a05

File tree

8 files changed

+12
-19
lines changed

8 files changed

+12
-19
lines changed

LoopStructural/modelling/core/geological_observations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
that can be attached to geological objects in scenarios.
66
"""
77

8-
from typing import Optional, List, Literal, Union
8+
from typing import Optional, List, Union
99
from dataclasses import dataclass, field
1010
import numpy as np
1111
import pandas as pd

LoopStructural/modelling/core/geological_scenario.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Provides a fluent interface for defining geological relationships before computational modeling.
66
"""
77

8-
from typing import List, Optional, Dict, Union, Any
8+
from typing import List, Optional, Dict
99
import pandas as pd
1010
import numpy as np
1111
from ...utils import getLogger

LoopStructural/modelling/core/model_graph.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
import numpy as np
1212
from dataclasses import dataclass, field
1313
from collections import defaultdict, deque
14-
import logging
1514

1615
from ...utils import getLogger
1716

1817
if TYPE_CHECKING:
19-
from typing import Callable
18+
pass
2019

2120
logger = getLogger(__name__)
2221

@@ -642,7 +641,7 @@ def topological_sort_by_dependencies(self) -> Dict[str, Union[List[str], List[Li
642641
deps = self.build_dependency_graph()
643642

644643
# Compute in-degree for Kahn's algorithm
645-
indeg: Dict[str, int] = {n: 0 for n in deps.keys()}
644+
indeg: Dict[str, int] = dict.fromkeys(deps.keys(), 0)
646645
for u, succs in deps.items():
647646
for v in succs:
648647
indeg[v] = indeg.get(v, 0) + 1
@@ -1072,7 +1071,7 @@ def _check_for_cycles(self):
10721071

10731072
# DFS cycle detection with coloring
10741073
WHITE, GRAY, BLACK = 0, 1, 2
1075-
color = {uid: WHITE for uid in unit_ids}
1074+
color = dict.fromkeys(unit_ids, WHITE)
10761075

10771076
def dfs_visit(node_id: str, path: List[str]):
10781077
color[node_id] = GRAY
@@ -1119,7 +1118,7 @@ def _sort_units_within_group(self, units: List[GeologicalObject]) -> List[Geolog
11191118

11201119
# Build adjacency for relationships within this group
11211120
adj: Dict[str, List[str]] = defaultdict(list)
1122-
in_degree = {uid: 0 for uid in unit_ids}
1121+
in_degree = dict.fromkeys(unit_ids, 0)
11231122

11241123
for unit_id in unit_ids:
11251124
rels = self.graph.get_relationships(from_object_id=unit_id)
@@ -1188,7 +1187,7 @@ def _sort_groups(self, groups: List[List[GeologicalObject]]) -> List[List[Geolog
11881187

11891188
# Build inter-group adjacency based on unconformity relationships
11901189
group_adj: Dict[int, Set[int]] = defaultdict(set)
1191-
group_in_degree = {i: 0 for i in range(len(groups))}
1190+
group_in_degree = dict.fromkeys(range(len(groups)), 0)
11921191

11931192
unconformity_types = {
11941193
RelationshipType.ERODE_UNCONFORMABLY_OVERLIES,

examples/1_basic/plot_2_surface_modelling.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
# model building
3737

3838
from LoopStructural import GeologicalModel
39-
from LoopStructural.modelling.core.stratigraphic_column import StratigraphicColumn
4039
from LoopStructural.visualisation import Loop3DView
4140
from LoopStructural.datasets import load_claudius # demo data
4241

examples/2_fold/plot_2__refolded_folds.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88
from LoopStructural import GeologicalModel
9-
from LoopStructural.modelling.features import fold
109
from LoopStructural.visualisation import Loop3DView, RotationAnglePlotter
1110
from LoopStructural.datasets import load_laurent2016
1211
import pandas as pd

examples/5_graph/observations_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import numpy as np
99
from LoopStructural.modelling.core.geological_scenario import GeologicalScenario
10-
from LoopStructural.modelling.core.geological_observations import ObservationCollection
1110

1211
# ==============================================================================
1312
# Setup: Model domain
@@ -214,11 +213,11 @@
214213

215214
print(f"\nTotal observations: {len(all_obs)}")
216215
print(f"Features with observations: {all_obs['feature_name'].unique().tolist()}")
217-
print(f"\nObservation types:")
216+
print("\nObservation types:")
218217
print(all_obs.groupby('feature_name').size())
219218

220219
# Show summary statistics
221-
print(f"\nSummary:")
220+
print("\nSummary:")
222221
print(f" Contact points (coord=0): {len(all_obs[all_obs['coord'] == 0])}")
223222
print(f" Orientation constraints (coord=1): {len(all_obs[all_obs['coord'] == 1])}")
224223
print(f" Inequality constraints (coord=2): {len(all_obs[all_obs['coord'] == 2])}")

examples/5_graph/three_tier_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@
9595
# Get conformable groups (separated by unconformities)
9696
try:
9797
groups = column_view.identify_conformable_groups()
98-
print(f"\nConformable Groups:")
98+
print("\nConformable Groups:")
9999
for i, group in enumerate(groups, 1):
100100
print(f" Group {i}: {[u.name for u in group]}")
101101
except ValueError as e:
102102
print(f"Error identifying groups: {e}")
103103

104104
# Get unconformities
105105
unconformities = column_view.get_unconformities()
106-
print(f"\nUnconformities:")
106+
print("\nUnconformities:")
107107
for upper, lower in unconformities:
108108
upper_obj = model_explicit.topology.get_object(upper)
109109
lower_obj = model_explicit.topology.get_object(lower)
@@ -217,7 +217,7 @@
217217

218218
# Get stratigraphic information before building
219219
groups = scenario.get_stratigraphic_groups()
220-
print(f"\nConformable Groups in Scenario:")
220+
print("\nConformable Groups in Scenario:")
221221
for i, group in enumerate(groups, 1):
222222
print(f" Group {i}: {group}")
223223

tests/unit/test_geological_topology_graph.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
"""
44

55
import pytest
6-
import numpy as np
76
from LoopStructural.modelling.core.model_graph import (
87
GeologicalTopologyGraph,
98
StratigraphicColumnView,
10-
GeologicalObject,
119
GeologicalObjectType,
1210
RelationshipType,
13-
TopologicalRelationship,
1411
)
1512

1613

0 commit comments

Comments
 (0)