Skip to content

Commit f6d743a

Browse files
authored
Merge pull request #552 from MiraGeoscience/GEOPY-939-precommit
GEOPY-939 pre-commit autoupdate to fix isort problem
2 parents 6c93107 + 634d680 commit f6d743a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+16
-208
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ ci:
1212

1313
repos:
1414
- repo: https://github.com/psf/black
15-
rev: 22.6.0
15+
rev: 23.3.0
1616
hooks:
1717
- id: black
1818
- repo: https://github.com/asottile/seed-isort-config
1919
rev: v2.2.0
2020
hooks:
2121
- id: seed-isort-config
2222
- repo: https://github.com/PyCQA/isort
23-
rev: 5.10.1
23+
rev: 5.12.0
2424
hooks:
2525
- id: isort
2626
additional_dependencies: [toml] # to read config from pyproject.toml
@@ -33,7 +33,7 @@ repos:
3333
# hooks:
3434
# - id: flake8
3535
- repo: https://github.com/asottile/pyupgrade
36-
rev: v2.37.2
36+
rev: v3.3.2
3737
hooks:
3838
- id: pyupgrade
3939
args: [--py39-plus]
@@ -59,13 +59,13 @@ repos:
5959
types: [python]
6060
exclude: (^setup.py$|(docs|assets)/)
6161
- repo: https://github.com/codespell-project/codespell
62-
rev: v2.1.0
62+
rev: v2.2.4
6363
hooks:
6464
- id: codespell
65-
exclude: (\.ipynb$)
65+
exclude: (-lock\.ya?ml|\benvironments/.*\.ya?ml|\.ipynb)$
6666
entry: codespell -I .codespellignore
6767
- repo: https://github.com/pre-commit/pre-commit-hooks
68-
rev: v4.3.0
68+
rev: v4.4.0
6969
hooks:
7070
- id: trailing-whitespace
7171
exclude: \.mdj$
@@ -81,11 +81,11 @@ repos:
8181
- id: mixed-line-ending
8282
- id: name-tests-test
8383
- repo: https://github.com/rstcheck/rstcheck
84-
rev: v6.0.0.post1
84+
rev: v6.1.2
8585
hooks:
8686
- id: rstcheck
8787
additional_dependencies: [sphinx]
8888
- repo: https://github.com/pre-commit/pygrep-hooks
89-
rev: v1.9.0
89+
rev: v1.10.0
9090
hooks:
9191
- id: rst-backticks

geoapps/base/application.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ def __populate__(self, **kwargs):
119119
if key[0] == "_":
120120
key = key[1:]
121121
if hasattr(self, "_" + key) or hasattr(self, key):
122-
123122
if isinstance(value, list):
124123
value = [dict_mapper(val, mappers) for val in value]
125124
else:
@@ -206,7 +205,6 @@ def live_link_choice(self, _):
206205
Enable the monitoring folder
207206
"""
208207
if self.live_link.value:
209-
210208
if (self.h5file is not None) and (self.monitoring_directory is None):
211209
live_path = path.join(path.abspath(path.dirname(self.h5file)), "Temp")
212210
self.monitoring_directory = live_path
@@ -240,7 +238,6 @@ def monitoring_directory(self):
240238

241239
@monitoring_directory.setter
242240
def monitoring_directory(self, live_path: str):
243-
244241
if not path.exists(live_path):
245242
mkdir(live_path)
246243

@@ -333,7 +330,6 @@ def h5file(self):
333330
:obj:`str`: Target geoh5 project file.
334331
"""
335332
if getattr(self, "_h5file", None) is None:
336-
337333
if self._workspace is not None:
338334
self.h5file = self._workspace.h5file
339335

geoapps/base/plot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class PlotSelection2D(ObjectDataSelection):
4747
plot_result = True
4848

4949
def __init__(self, **kwargs):
50-
5150
self.defaults.update(**app_initializer)
5251
self.defaults.update(**kwargs)
5352
self.axis = None

geoapps/base/selection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ class LineOptions(ObjectDataSelection):
366366
_defaults = {"find_label": "line"}
367367

368368
def __init__(self, **kwargs):
369-
370369
self._multiple_lines = None
371370
self._add_xyz = False
372371
self._lines = None

geoapps/clustering/application.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,6 @@ def make_scatter_plot(
880880
crossplot = go.Figure(self.scatter_driver.run())
881881
return crossplot
882882
else:
883-
884883
return go.Figure()
885884

886885
@staticmethod

geoapps/clustering/driver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131

3232
class ClusteringDriver(BaseDriver):
33-
3433
_params_class = ClusteringParams
3534
_validations = validations
3635

geoapps/contours/driver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828

2929
class ContoursDriver(BaseDriver):
30-
3130
_params_class = ContoursParams
3231
_validations = validations
3332

geoapps/coordinate_transformation/application.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def trigger_click(self, _):
9494
import matplotlib.pyplot as plt
9595

9696
if self.wkt_in.value != "" and self.wkt_out.value != "":
97-
9897
if self.plot_result:
9998
self._figure = plt.figure(figsize=(12, 8))
10099
ax1 = plt.subplot(1, 2, 1)
@@ -110,7 +109,6 @@ def trigger_click(self, _):
110109
)
111110

112111
for uid in self.objects.value:
113-
114112
obj = self.workspace.get_entity(uid)[0]
115113

116114
if isinstance(obj, Grid2D):
@@ -123,7 +121,6 @@ def trigger_click(self, _):
123121
temp_file_out = child.name + ".tif"
124122

125123
if isinstance(child, FloatData):
126-
127124
export_grid_2_geotiff(
128125
child,
129126
temp_file,

geoapps/driver_base/driver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818

1919
class BaseDriver(ABC):
20-
2120
_params_class = BaseParams
2221
_validations = None
2322

geoapps/driver_base/params.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ def _uuid_promoter(self, uid):
356356
return uid
357357

358358
def setter_validator(self, key: str, value, fun=lambda x: x):
359-
360359
if value is None:
361360
setattr(self, f"_{key}", value)
362361
return

geoapps/driver_base/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def running_mean(
5555

5656

5757
def treemesh_2_octree(workspace, treemesh, **kwargs):
58-
5958
index_array, levels = getattr(treemesh, "_ubc_indArr")
6059
ubc_order = getattr(treemesh, "_ubc_order")
6160

geoapps/edge_detection/driver.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929

3030
class EdgeDetectionDriver(BaseDriver):
31-
3231
_params_class = EdgeDetectionParams
3332
_validations = validations
3433

@@ -158,7 +157,6 @@ def get_edges(
158157
coords = []
159158
for cx in cnt_x:
160159
for cy in cnt_y:
161-
162160
i_min, i_max = int(cy - half_y), int(cy + half_y)
163161
j_min, j_max = int(cx - half_x), int(cx + half_x)
164162
lines = probabilistic_hough_line(

geoapps/export/application.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ def _collect_data_values(self):
184184

185185
data_values = {}
186186
if self.data.value:
187-
188187
for key in self.data.value:
189188
if self.workspace.get_entity(key):
190189
data_values[key] = self.workspace.get_entity(key)[0].values.copy()
@@ -236,7 +235,6 @@ def _export_shapefile(self, entity):
236235
print(f"Object saved to {filename}")
237236

238237
def _export_geotiff(self, entity):
239-
240238
for key in self.data.value:
241239
name = (
242240
path.join(self.export_directory.selected_path, self.export_as.value)
@@ -306,7 +304,6 @@ def _export_ubc(self, entity, data_values):
306304
print(f"Models saved to {list(models)}")
307305

308306
else:
309-
310307
mesh = discretize.TensorMesh(
311308
[
312309
np.abs(entity.u_cells),
@@ -330,7 +327,6 @@ def _export_ubc(self, entity, data_values):
330327

331328
if any(data_values):
332329
for key, item in data_values.items():
333-
334330
if mesh.x0[2] == entity.origin["z"]:
335331
values = item.copy()
336332
values = values.reshape(

geoapps/export/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def object_2_dataframe(entity, fields=None, inplace=False, vertices=True, index=
5454
def parse_lines(curve, values):
5555
polylines, polyvalues = [], []
5656
for line_id in curve.unique_parts:
57-
5857
ind_line = np.where(curve.parts == line_id)[0]
5958
polylines += [curve.vertices[ind_line, :2]]
6059

@@ -102,10 +101,8 @@ def export_curve_2_shapefile(
102101
schema=schema,
103102
crs_wkt=wkt_code,
104103
) as shapefile:
105-
106104
# If there are multiple geometries, put the "for" loop here
107105
for i, poly in enumerate(polylines):
108-
109106
if len(poly) > 1:
110107
poly = LineString(list(tuple(map(tuple, poly))))
111108

geoapps/interpolation/driver.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424

2525
class DataInterpolationDriver(BaseDriver):
26-
2726
_params_class = DataInterpolationParams
2827
_validations = validations
2928

@@ -64,7 +63,6 @@ def run(self):
6463
values_interp = {}
6564
rad, ind = tree.query(xyz_out)
6665
if self.params.method == "Nearest":
67-
6866
print("Computing nearest neighbor interpolation")
6967
# Find nearest cells
7068
for key, value in values.items():

geoapps/inversion/airborne_electromagnetics/application.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class ChannelOptions:
5656
"""
5757

5858
def __init__(self, key, description, **kwargs):
59-
6059
self._active = Checkbox(
6160
value=False,
6261
indent=True,
@@ -161,7 +160,6 @@ def offset(self):
161160

162161
@property
163162
def options(self):
164-
165163
if getattr(self, "_options", None) is None:
166164
self._options = widgets.RadioButtons(
167165
options=[
@@ -361,7 +359,6 @@ def __init__(self, **kwargs):
361359
)
362360

363361
def update_panel(self, _):
364-
365362
if self._options.value == "Model":
366363
self._main.children[1].children = [self._options, self.selection_widget]
367364
self._main.children[1].children[1].layout.visibility = "visible"
@@ -658,7 +655,6 @@ def plot_convergence_curve(h5file):
658655
)
659656

660657
def plot_curve(objects):
661-
662658
inversion = workspace.get_entity(objects)[0]
663659
result = None
664660
if getattr(inversion, "comments", None) is not None:
@@ -724,7 +720,6 @@ def inversion_defaults():
724720

725721

726722
class InversionApp(PlotSelection2D):
727-
728723
_select_multiple = False
729724
_add_groups = "only"
730725
_sensor = None
@@ -901,7 +896,6 @@ def system(self):
901896
@property
902897
def topography(self):
903898
if getattr(self, "_topography", None) is None:
904-
905899
self._topography = TopographyOptions(
906900
workspace=self._workspace, **self.defaults["topography"]
907901
)
@@ -1001,7 +995,6 @@ def system_observer(self, _):
1001995
)
1002996

1003997
def channel_setter(caller):
1004-
1005998
channel = caller["owner"]
1006999
data_widget = self.data_channel_choices.data_channel_options[channel.header]
10071000

@@ -1098,7 +1091,6 @@ def channel_setter(caller):
10981091
self.trigger.button_style = "danger"
10991092

11001093
def object_observer(self, _):
1101-
11021094
self.resolution.indices = None
11031095
entity = self._workspace.get_entity(self.objects.value)[0]
11041096
if entity is None:
@@ -1135,7 +1127,6 @@ def object_observer(self, _):
11351127
self.trigger.button_style = "danger"
11361128

11371129
def update_component_panel(self, _):
1138-
11391130
obj, data_list = self.get_selected_entities()
11401131

11411132
if obj is None:
@@ -1369,7 +1360,6 @@ def write_trigger(self, _):
13691360
self.ga_group_name.value + ".geoh5",
13701361
)
13711362
) as new_workspace:
1372-
13731363
obj, _ = self.get_selected_entities()
13741364
new_obj = obj.copy(parent=new_workspace, copy_children=False)
13751365

@@ -1387,7 +1377,6 @@ def write_trigger(self, _):
13871377
input_dict["data"]["channels"] = str(new_group.uid)
13881378

13891379
if self._uncertainties.value is not None:
1390-
13911380
prop_group = obj.find_or_create_property_group(
13921381
name=self.data.uid_name_map[self._uncertainties.value]
13931382
)
@@ -1423,7 +1412,6 @@ def write_trigger(self, _):
14231412
obj, data = elem.get_selected_entities()
14241413

14251414
if obj is not None:
1426-
14271415
new_obj = new_workspace.get_entity(obj.uid)[0]
14281416
if new_obj is None:
14291417
new_obj = obj.copy(parent=new_workspace, copy_children=False)

0 commit comments

Comments
 (0)