Skip to content

Commit 54e3c1d

Browse files
[pre-commit.ci] pre-commit autoupdate (#651)
1 parent 60d21fc commit 54e3c1d

File tree

10 files changed

+70
-71
lines changed

10 files changed

+70
-71
lines changed

Diff for: .pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ repos:
1919
- id: requirements-txt-fixer
2020

2121
- repo: https://github.com/codespell-project/codespell
22-
rev: v2.3.0
22+
rev: v2.4.1
2323
hooks:
2424
- id: codespell
2525
additional_dependencies:
2626
- tomli
2727

2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: v0.8.6
29+
rev: v0.9.4
3030
hooks:
3131
- id: ruff
3232
args: ["--fix", "--show-fixes"]

Diff for: icepyx/core/APIformatting.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ def check_req_values(self) -> bool:
358358
the values parameter.
359359
"""
360360

361-
assert (
362-
self.partype == "required"
363-
), "You cannot call this function for your parameter type"
361+
assert self.partype == "required", (
362+
"You cannot call this function for your parameter type"
363+
)
364364

365365
if not self._reqtype:
366366
raise TypeGuardException
@@ -381,9 +381,9 @@ def check_values(self) -> bool:
381381
Check that the non-required keys have values, if the key was
382382
passed in with the values parameter.
383383
"""
384-
assert (
385-
self.partype != "required"
386-
), "You cannot call this function for your parameter type"
384+
assert self.partype != "required", (
385+
"You cannot call this function for your parameter type"
386+
)
387387

388388
spatial_keys = self.poss_keys["spatial"]
389389

Diff for: icepyx/core/granules.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ def get_avail(
212212
query.Query.avail_granules
213213
"""
214214

215-
assert (
216-
CMRparams is not None and reqparams is not None
217-
), "Missing required input parameter dictionaries"
215+
assert CMRparams is not None and reqparams is not None, (
216+
"Missing required input parameter dictionaries"
217+
)
218218

219219
# if not hasattr(self, 'avail'):
220220
self.avail = []
@@ -260,17 +260,17 @@ def get_avail(
260260

261261
results = json.loads(response.content)
262262
if not results["feed"]["entry"]:
263-
assert len(self.avail) == int(
264-
response.headers["CMR-Hits"]
265-
), "Search failure - unexpected number of results"
263+
assert len(self.avail) == int(response.headers["CMR-Hits"]), (
264+
"Search failure - unexpected number of results"
265+
)
266266
break
267267

268268
# Collect results
269269
self.avail.extend(results["feed"]["entry"])
270270

271-
assert (
272-
len(self.avail) > 0
273-
), "Your search returned no results; try different search parameters"
271+
assert len(self.avail) > 0, (
272+
"Your search returned no results; try different search parameters"
273+
)
274274

275275
# DevNote: currently, default subsetting DOES NOT include variable subsetting,
276276
# only spatial and temporal

Diff for: icepyx/core/is2ref.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,16 @@ def _validate_OA_product(product):
5757
"""
5858
if isinstance(product, str):
5959
product = str.upper(product)
60-
assert (
61-
product
62-
in [
63-
"ATL06",
64-
"ATL07",
65-
"ATL08",
66-
"ATL10",
67-
"ATL12",
68-
"ATL13",
69-
]
70-
), "Oops! Elevation visualization only supports products ATL06, ATL07, ATL08, ATL10, ATL12, ATL13; please try another product."
60+
assert product in [
61+
"ATL06",
62+
"ATL07",
63+
"ATL08",
64+
"ATL10",
65+
"ATL12",
66+
"ATL13",
67+
], (
68+
"Oops! Elevation visualization only supports products ATL06, ATL07, ATL08, ATL10, ATL12, ATL13; please try another product."
69+
)
7170
else:
7271
raise TypeError("Please enter a product string")
7372
return product

Diff for: icepyx/core/spatial.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ def check_dateline(extent_type, spatial_extent):
156156

157157
# this works properly, but limits the user to at most 270 deg longitude...
158158
elif extent_type == "polygon":
159-
assert not isinstance(
160-
spatial_extent[0], (list, tuple)
161-
), "Your polygon list is the wrong format for this function."
159+
assert not isinstance(spatial_extent[0], (list, tuple)), (
160+
"Your polygon list is the wrong format for this function."
161+
)
162162
lonlist = spatial_extent[0:-1:2]
163163
if np.any(
164164
[abs(lonlist[i] - lonlist[i + 1]) > 270 for i in range(len(lonlist) - 1)]
@@ -191,19 +191,19 @@ def validate_bounding_box(spatial_extent):
191191
"""
192192

193193
# Latitude must be between -90 and 90 (inclusive); check for this here
194-
assert (
195-
-90 <= spatial_extent[1] <= 90
196-
), "Invalid latitude value (must be between -90 and 90, inclusive)"
197-
assert (
198-
-90 <= spatial_extent[3] <= 90
199-
), "Invalid latitude value (must be between -90 and 90, inclusive)"
200-
201-
assert (
202-
-180 <= spatial_extent[0] <= 180
203-
), "Invalid longitude value (must be between -180 and 180, inclusive)"
204-
assert (
205-
-180 <= spatial_extent[2] <= 180
206-
), "Invalid longitude value (must be between -180 and 180, inclusive)"
194+
assert -90 <= spatial_extent[1] <= 90, (
195+
"Invalid latitude value (must be between -90 and 90, inclusive)"
196+
)
197+
assert -90 <= spatial_extent[3] <= 90, (
198+
"Invalid latitude value (must be between -90 and 90, inclusive)"
199+
)
200+
201+
assert -180 <= spatial_extent[0] <= 180, (
202+
"Invalid longitude value (must be between -180 and 180, inclusive)"
203+
)
204+
assert -180 <= spatial_extent[2] <= 180, (
205+
"Invalid longitude value (must be between -180 and 180, inclusive)"
206+
)
207207

208208
# If the lower left latitude is greater than the upper right latitude, throw an error
209209
assert spatial_extent[1] <= spatial_extent[3], "Invalid bounding box latitudes"
@@ -292,9 +292,9 @@ def validate_polygon_list(spatial_extent):
292292

293293
# user-entered polygon as a single list of lon and lat coordinates
294294
assert len(spatial_extent) >= 8, "Your spatial extent polygon has too few vertices"
295-
assert (
296-
len(spatial_extent) % 2 == 0
297-
), "Your spatial extent polygon list should have an even number of entries"
295+
assert len(spatial_extent) % 2 == 0, (
296+
"Your spatial extent polygon list should have an even number of entries"
297+
)
298298

299299
if (spatial_extent[0] != spatial_extent[-2]) or (
300300
spatial_extent[1] != spatial_extent[-1]
@@ -346,9 +346,9 @@ def validate_polygon_file(spatial_extent):
346346
# Check if the filename path exists; if not, throw an error
347347
# print("print statements work \n")
348348
# print("SPATIAL EXTENT: " + spatial_extent + "\n")
349-
assert os.path.exists(
350-
spatial_extent
351-
), "Check that the path and filename of your geometry file are correct"
349+
assert os.path.exists(spatial_extent), (
350+
"Check that the path and filename of your geometry file are correct"
351+
)
352352

353353
# DevGoal: more robust polygon inputting (see Bruce's code):
354354
# correct for clockwise/counterclockwise coordinates, deal with simplification, etc.

Diff for: icepyx/core/temporal.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def check_valid_date_range(start: dt.date, end: dt.date) -> None:
8080
start = start.date()
8181
if isinstance(end, dt.datetime):
8282
end = end.date()
83-
assert (
84-
start <= end
85-
), "Your date range is invalid; end date MUST be on or after the start date."
83+
assert start <= end, (
84+
"Your date range is invalid; end date MUST be on or after the start date."
85+
)
8686

8787

8888
def validate_times(

Diff for: icepyx/core/variables.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ def append(self, defaults=False, var_list=None, beam_list=None, keyword_list=Non
466466
and var_list is None
467467
and beam_list is None
468468
and keyword_list is None
469-
), "You must enter parameters to add to a variable subset list. If you do not want to subset by variable, ensure your is2.subsetparams dictionary does not contain the key 'Coverage'."
469+
), (
470+
"You must enter parameters to add to a variable subset list. If you do not want to subset by variable, ensure your is2.subsetparams dictionary does not contain the key 'Coverage'."
471+
)
470472

471473
final_vars = {}
472474

@@ -564,7 +566,9 @@ def remove(self, all=False, var_list=None, beam_list=None, keyword_list=None):
564566
and var_list is None
565567
and beam_list is None
566568
and keyword_list is None
567-
), "You must specify which variables/paths/beams you would like to remove from your wanted list."
569+
), (
570+
"You must specify which variables/paths/beams you would like to remove from your wanted list."
571+
)
568572

569573
# if not hasattr(self, 'avail'): self.get_avail()
570574
# vgrp, paths = self.parse_var_list(self.avail)

Diff for: icepyx/core/visualization.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,9 @@ def parallel_request_OA(self) -> da.array:
422422
# generate parameter lists for OA requesting
423423
OA_para_list = self.generate_OA_parameters()
424424

425-
assert (
426-
OA_para_list
427-
), "Your search returned no results; try different search parameters"
425+
assert OA_para_list, (
426+
"Your search returned no results; try different search parameters"
427+
)
428428

429429
url_number = len(OA_para_list)
430430

Diff for: icepyx/quest/dataset_scripts/argo.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Argo(DataSet):
2525
To search for all parameters, use `params=["all"]`;
2626
be careful using all for floats with BGC data, as this may be result in a large download.
2727
presRange : str, default None
28-
The pressure range (which correllates with depth) to search for data within.
28+
The pressure range (which correlates with depth) to search for data within.
2929
Input as a "shallow-limit,deep-limit" string.
3030
3131
See Also
@@ -223,10 +223,10 @@ def _validate_parameters(self, params) -> list:
223223
valid_params = self._valid_params()
224224
# checks that params are valid
225225
for i in params:
226-
assert (
227-
i in valid_params
228-
), "Parameter '{0}' is not valid. Valid parameters are {1}".format(
229-
i, valid_params
226+
assert i in valid_params, (
227+
"Parameter '{0}' is not valid. Valid parameters are {1}".format(
228+
i, valid_params
229+
)
230230
)
231231

232232
return list(set(params))
@@ -252,7 +252,7 @@ def search_data(self, params=None, presRange=None, printURL=False) -> str:
252252
To search for all parameters, use `params=["all"]`;
253253
be careful using all for floats with BGC data, as this may be result in a large download.
254254
presRange : str, default None
255-
The pressure range (which correllates with depth) to search for data within.
255+
The pressure range (which correlates with depth) to search for data within.
256256
This kwarg is used to replace the existing pressure range in `self.presRange`.
257257
Do not submit this kwarg if you would like to use the existing `self.presRange` values.
258258
Input as a "shallow-limit,deep-limit" string.
@@ -421,7 +421,7 @@ def download(self, params=None, presRange=None, keep_existing=True) -> pd.DataFr
421421
To search for all parameters, use `params=["all"]`.
422422
For a list of available parameters, see: `reg._valid_params`
423423
presRange : str, default None
424-
The pressure range (which correllates with depth) to search for data within.
424+
The pressure range (which correlates with depth) to search for data within.
425425
This kwarg is used to replace the existing pressure range in `self.presRange`.
426426
Do not submit this kwarg if you would like to use the existing `self.presRange` values.
427427
Input as a "shallow-limit,deep-limit" string.

Diff for: icepyx/tests/unit/test_quest_argo.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ def test_search_data_no_available_profiles(argo_quest_instance):
126126
reg_a = argo_quest_instance([-55, 68, -48, 71], ["2019-02-20", "2019-02-28"])
127127
obs = reg_a.search_data()
128128

129-
exp = (
130-
"Warning: Query returned no profiles\n" "Please try different search parameters"
131-
)
129+
exp = "Warning: Query returned no profiles\nPlease try different search parameters"
132130

133131
assert obs == exp
134132

@@ -198,9 +196,7 @@ def test_replace_param_search(argo_quest_instance):
198196

199197
obs = reg_a.search_data(params=["doxy"])
200198

201-
exp = (
202-
"Warning: Query returned no profiles\n" "Please try different search parameters"
203-
)
199+
exp = "Warning: Query returned no profiles\nPlease try different search parameters"
204200

205201
assert obs == exp
206202

0 commit comments

Comments
 (0)