Skip to content

Commit 04b4516

Browse files
lachlangroseclaude
andcommitted
style: fix black formatting and ruff lint (unnecessary generator)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent b637a74 commit 04b4516

5 files changed

Lines changed: 19 additions & 23 deletions

File tree

loopstructural/gui/map2loop_tools/fault_topology_widget.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _run_topology(self):
174174
# not just the ones map2loop found a relationship for. A fault with
175175
# no detected topological relationship is still a real fault and
176176
# must not be dropped from the fault topology.
177-
new_faults = set(str(v) for v in gdf['ID'].unique())
177+
new_faults = {str(v) for v in gdf['ID'].unique()}
178178

179179
# Add new faults; never remove existing ones here, so faults
180180
# without a detected relationship (or ones the user added
@@ -209,9 +209,7 @@ def _run_topology(self):
209209
else:
210210
f1 = str(row.iloc[0])
211211
f2 = str(row.iloc[1])
212-
ft.update_fault_relationship(
213-
f1, f2, FaultRelationshipType.ABUTTING
214-
)
212+
ft.update_fault_relationship(f1, f2, FaultRelationshipType.ABUTTING)
215213
except Exception:
216214
pass
217215

loopstructural/gui/modelling/model_definition/bounding_box.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def __init__(self, parent=None, data_manager=None):
3232
self.selectFromCurrentLayerButton, "mActionZoomToLayer.svg", "Select from Current Layer"
3333
)
3434
self._style_tool_button(
35-
self.useCurrentViewExtentButton, "mActionSetToCanvasExtent.svg", "Use Current View Extent"
36-
)
37-
self._style_tool_button(
38-
self.drawOnMapButton, "mActionAddBasicRectangle.svg", "Draw on Map"
35+
self.useCurrentViewExtentButton,
36+
"mActionSetToCanvasExtent.svg",
37+
"Use Current View Extent",
3938
)
39+
self._style_tool_button(self.drawOnMapButton, "mActionAddBasicRectangle.svg", "Draw on Map")
4040
self.drawOnMapButton.setCheckable(True)
4141
self.drawOnMapButton.clicked.connect(self.drawOnMap)
4242
self._draw_extent_tool = None

loopstructural/gui/visualisation/feature_list_widget.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def __init__(self, parent=None, *, model_manager=None, viewer=None, data_manager
5656
self.data_manager = data_manager
5757

5858
# Add buttons
59-
self.addBoundingBoxButton = self._make_tool_button(
60-
"extents.svg", "Add Model Bounding Box"
61-
)
59+
self.addBoundingBoxButton = self._make_tool_button("extents.svg", "Add Model Bounding Box")
6260
self.addFaultSurfacesButton = self._make_custom_icon_tool_button(
6361
"fault.svg", "Add Fault Surfaces"
6462
)
@@ -724,7 +722,12 @@ def _extract_line_xy(self, layer) -> Optional[np.ndarray]:
724722
except Exception:
725723
target_crs = None
726724
source_crs = layer.sourceCrs()
727-
if target_crs is not None and target_crs.isValid() and source_crs.isValid() and source_crs != target_crs:
725+
if (
726+
target_crs is not None
727+
and target_crs.isValid()
728+
and source_crs.isValid()
729+
and source_crs != target_crs
730+
):
728731
geom = QgsGeometry(geom)
729732
geom.transform(QgsCoordinateTransform(source_crs, target_crs, QgsProject.instance()))
730733

loopstructural/main/m2l_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def extract_basal_contacts(
9898
unit_name_col = 'UNITNAME' if 'UNITNAME' in geology.columns else unit_name_field
9999
if unit_name_col and unit_name_col in geology.columns:
100100
geology_unit_names = {str(v).strip() for v in geology[unit_name_col].dropna().unique()}
101-
stratigraphic_names = {str(name).strip() for name in stratigraphic_order if name is not None}
101+
stratigraphic_names = {
102+
str(name).strip() for name in stratigraphic_order if name is not None
103+
}
102104
ignored_names = {str(unit).strip() for unit in ignore_units if unit is not None}
103105
missing_from_column = sorted(geology_unit_names - stratigraphic_names - ignored_names)
104106
if missing_from_column:

tests/qgis/test_stratigraphic_value_consistency.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def test_single_group_three_units(self, manager):
7979
manager.update_foliation_features()
8080

8181
training_values = self._training_values_by_unit(manager._captured_calls)
82-
expected_values = {
83-
name: entry['value'] for name, entry in column.get_isovalues().items()
84-
}
82+
expected_values = {name: entry['value'] for name, entry in column.get_isovalues().items()}
8583

8684
for unit_name in ('oldest', 'middle', 'youngest'):
8785
assert training_values[unit_name] == pytest.approx(expected_values[unit_name]), (
@@ -107,14 +105,11 @@ def test_two_groups_split_by_unconformity(self, manager):
107105
manager.update_foliation_features()
108106

109107
training_values = self._training_values_by_unit(manager._captured_calls)
110-
expected_values = {
111-
name: entry['value'] for name, entry in column.get_isovalues().items()
112-
}
108+
expected_values = {name: entry['value'] for name, entry in column.get_isovalues().items()}
113109

114110
for unit_name in ('basin_floor', 'basin_fill', 'cover_lower', 'cover_upper'):
115111
assert training_values[unit_name] == pytest.approx(expected_values[unit_name])
116112

117-
118113
def test_undigitised_unit_does_not_shift_later_units_in_group(self, manager):
119114
"""Regression test for a real bug: a unit with no digitised contact
120115
or orientation data (e.g. a "Top" unit nobody has mapped points for)
@@ -138,9 +133,7 @@ def test_undigitised_unit_does_not_shift_later_units_in_group(self, manager):
138133
manager.update_foliation_features()
139134

140135
training_values = self._training_values_by_unit(manager._captured_calls)
141-
expected_values = {
142-
name: entry['value'] for name, entry in column.get_isovalues().items()
143-
}
136+
expected_values = {name: entry['value'] for name, entry in column.get_isovalues().items()}
144137

145138
for unit_name in ('basin_floor', 'basin_fill'):
146139
assert training_values[unit_name] == pytest.approx(expected_values[unit_name]), (

0 commit comments

Comments
 (0)