Skip to content

Commit 419386e

Browse files
authored
style: format 12 files with black 26.10.1 so the linter passes (#157)
1 parent 3422b2a commit 419386e

12 files changed

Lines changed: 43 additions & 36 deletions

File tree

‎loopstructural/gui/modelling/geological_model_tab/feature_details_panel/_base.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ def _toggle_detached(self):
394394
if reply != QMessageBox.StandardButton.Yes:
395395
return
396396
manager.attach_feature(name)
397-
push_info("Feature", f"'{name}' follows the stratigraphic column again. Rebuild the model.")
397+
push_info(
398+
"Feature", f"'{name}' follows the stratigraphic column again. Rebuild the model."
399+
)
398400
elif manager.detach_feature(name):
399401
push_info("Feature", f"'{name}' is detached. Its data is a fixed copy.")
400402
else:

‎loopstructural/gui/modelling/geological_model_tab/geological_model_tab.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def _build_status_icon(color: str, *, filled: bool, mark: str = None) -> QIcon:
7474
'initialized': "Model status: initialized (not solved)",
7575
'solved': "Model status: solved",
7676
'stale': (
77-
"Model status: faults, stratigraphic column or input data changed — "
78-
"rebuild the model"
77+
"Model status: faults, stratigraphic column or input data changed — " "rebuild the model"
7978
),
8079
}
8180

@@ -524,9 +523,7 @@ def _confirm_bounding_box_contains_data(self):
524523
)
525524
return reply == QMessageBox.StandardButton.Yes
526525

527-
def _run_model_task(
528-
self, target, *, title, initial_label, cancellable=True, on_success=None
529-
):
526+
def _run_model_task(self, target, *, title, initial_label, cancellable=True, on_success=None):
530527
"""Run `target(progress_callback)` on a background QThread with a
531528
non-modal progress dialog, so the rest of QGIS stays usable. Both
532529
Initialize Model and Solve Model share this: they disable each other

‎loopstructural/gui/modelling/geological_model_tab/layer_selection_table.py‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,17 +535,20 @@ def _setup_common_fields(self, layout):
535535
self.weight_spin.setDecimals(3)
536536
self.weight_spin.setRange(0.001, 1000.0)
537537
self.weight_spin.setSingleStep(0.1)
538-
self.weight_spin.setValue(
539-
self.existing_data.get('weight', constraints.DEFAULT_WEIGHT)
540-
)
538+
self.weight_spin.setValue(self.existing_data.get('weight', constraints.DEFAULT_WEIGHT))
541539
self.weight_spin.setToolTip("How much the constraint counts in the interpolation.")
542540
form.addRow("Weight:", self.weight_spin)
543541

544542
self.z_source_combo = QComboBox()
545543
for source in constraints.Z_SOURCES:
546544
self.z_source_combo.addItem(constraints.Z_LABELS[source], source)
547545
self.z_source_combo.setCurrentIndex(
548-
max(self.z_source_combo.findData(self.existing_data.get('z_source', constraints.Z_LAYER)), 0)
546+
max(
547+
self.z_source_combo.findData(
548+
self.existing_data.get('z_source', constraints.Z_LAYER)
549+
),
550+
0,
551+
)
549552
)
550553
self.z_source_combo.setToolTip(
551554
"Where the Z of the points comes from: the geometry of the layer, the DEM "
@@ -561,7 +564,9 @@ def _setup_common_fields(self, layout):
561564
layout.addLayout(form)
562565

563566
def update_z_value_state():
564-
self.z_value_spin.setEnabled(self.z_source_combo.currentData() == constraints.Z_CONSTANT)
567+
self.z_value_spin.setEnabled(
568+
self.z_source_combo.currentData() == constraints.Z_CONSTANT
569+
)
565570

566571
self.z_source_combo.currentIndexChanged.connect(update_z_value_state)
567572
update_z_value_state()

‎loopstructural/gui/modelling/model_definition/stratigraphic_layers.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def _apply_contacts_source(self, source):
8989
else:
9090
configure_layer_combo(
9191
self.basalContactsLayer,
92-
QgsMapLayerProxyModel.Filter.LineLayer | QgsMapLayerProxyModel.Filter.PointLayer,
92+
QgsMapLayerProxyModel.Filter.LineLayer
93+
| QgsMapLayerProxyModel.Filter.PointLayer,
9394
allow_empty=True,
9495
)
9596
self.groupBox_basalContacts.setTitle("Basal contacts")

‎loopstructural/gui/modelling/modelling_widget.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ def _visible_indices(self):
148148
def _neighbour(self, direction, index=None):
149149
"""Return the index of the next visible step, or ``index`` if there is none."""
150150
index = self.current_index if index is None else index
151-
candidates = [
152-
i for i in self._visible_indices() if (i - index) * direction > 0
153-
]
151+
candidates = [i for i in self._visible_indices() if (i - index) * direction > 0]
154152
if not candidates:
155153
return index
156154
return min(candidates, key=lambda i: abs(i - index))
@@ -162,7 +160,10 @@ def _apply_workflow_mode(self, mode):
162160
for page in self.pages:
163161
self.step_bar.set_step_visible(page.key, page.key in visible)
164162
self.data_step.set_workflow_mode(mode)
165-
if self.stack.currentIndex() >= 0 and self.pages[self.stack.currentIndex()].key not in visible:
163+
if (
164+
self.stack.currentIndex() >= 0
165+
and self.pages[self.stack.currentIndex()].key not in visible
166+
):
166167
self.go_to(self.stack.currentIndex())
167168
else:
168169
self.refresh_status()

‎loopstructural/gui/modelling/steps/pages.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ def __init__(self, parent=None, **kwargs):
261261
self.fault_layers.faultTraceLayer.layerChanged.connect(self.update_topology_button)
262262
self.fault_layers.faultNameField.fieldChanged.connect(self.update_topology_button)
263263
if self.data_manager is not None:
264-
self.data_manager.layer_roles.attach(lambda _role, _value: self.update_topology_button())
264+
self.data_manager.layer_roles.attach(
265+
lambda _role, _value: self.update_topology_button()
266+
)
265267
self.update_topology_button()
266268

267269
self.adjacency = FaultAdjacencyTab(self, data_manager=self.data_manager)
@@ -274,7 +276,11 @@ def _fault_traces(self):
274276
def update_topology_button(self, *_args):
275277
"""Enable the button when the fault layer and the name field are set."""
276278
traces = self._fault_traces()
277-
layer = self.data_manager.get_layer_role(layer_roles.FAULT_TRACES) if self.data_manager else None
279+
layer = (
280+
self.data_manager.get_layer_role(layer_roles.FAULT_TRACES)
281+
if self.data_manager
282+
else None
283+
)
278284
if layer is None or not traces.get('fault_name_field'):
279285
self.topology_button.setEnabled(False)
280286
self.topology_button.setToolTip(
@@ -289,11 +295,11 @@ def update_topology_button(self, *_args):
289295
def _calculate_topology(self):
290296
self.message_bar.clearWidgets()
291297
try:
292-
result = calculate_from_data_manager(
293-
self.data_manager, self.tolerance_spin_box.value()
294-
)
298+
result = calculate_from_data_manager(self.data_manager, self.tolerance_spin_box.value())
295299
except FaultTopologyError as error:
296-
self.message_bar.pushMessage("Fault topology", str(error), level=Qgis.MessageLevel.Critical)
300+
self.message_bar.pushMessage(
301+
"Fault topology", str(error), level=Qgis.MessageLevel.Critical
302+
)
297303
return
298304
text, warn = result_message(result)
299305
self.message_bar.pushMessage(

‎loopstructural/gui/modelling/steps/section_stack.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ def _save_state(self):
6161
self._settings_key, {key: self.is_open(key) for key in self._sections}
6262
)
6363

64-
def add_section(
65-
self, widget, key, title, *, summary=None, collapsed=False, index=None
66-
):
64+
def add_section(self, widget, key, title, *, summary=None, collapsed=False, index=None):
6765
"""Add a section and return its group box.
6866
6967
``widget`` is the content, or a `QgsCollapsibleGroupBox` that the stack

‎loopstructural/gui/modelling/stratigraphic_column/stratigraphic_column.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from .init_from_field_dialog import InitFromLayerFieldDialog
3333
from .stratigraphic_unit import StratigraphicUnitWidget
3434

35-
3635
# The values of the "Style by" combo
3736
STYLE_COLOUR = 'colour'
3837
STYLE_ORDER = 'order'

‎loopstructural/gui/visualisation/object_properties_widget.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
render_histogram,
3232
)
3333

34+
3435
class ObjectPropertiesWidget(QWidget):
3536
"""The properties of the selected viewer object.
3637

‎loopstructural/main/constraints.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def has_weight(layer_type):
6969
"""Return True if a row of the type `layer_type` has a weight."""
7070
return layer_type not in UNWEIGHTED_TYPES
7171

72+
7273
# The keys of a row that name a field of the layer, for each type. A row
7374
# without these keys is not complete.
7475
REQUIRED_FIELDS = {
@@ -85,7 +86,9 @@ def has_weight(layer_type):
8586

8687
def missing_fields(layer_data):
8788
"""Return the keys that a row needs and does not have."""
88-
return [key for key in REQUIRED_FIELDS.get(layer_data.get('type'), ()) if not layer_data.get(key)]
89+
return [
90+
key for key in REQUIRED_FIELDS.get(layer_data.get('type'), ()) if not layer_data.get(key)
91+
]
8992

9093

9194
def solver_for(layer_type):

0 commit comments

Comments
 (0)