Skip to content

Commit be7b490

Browse files
committed
Update precommit
1 parent 7062265 commit be7b490

File tree

15 files changed

+46
-46
lines changed

15 files changed

+46
-46
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.6.0
4+
rev: v5.0.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
@@ -12,12 +12,12 @@ repos:
1212
- id: check-ast
1313
- id: check-added-large-files
1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.6.2
15+
rev: v0.9.7
1616
hooks:
1717
- id: ruff
1818
args: [--fix]
1919
- repo: https://github.com/psf/black
20-
rev: 24.8.0
20+
rev: 25.1.0
2121
hooks:
2222
- id: black
2323
language_version: python3
@@ -32,13 +32,13 @@ repos:
3232
- id: prettier
3333
types_or: [yaml, html, css, scss, javascript, json] # markdown to avoid conflicts with mdformat
3434
- repo: https://github.com/codespell-project/codespell
35-
rev: v2.3.0
35+
rev: v2.4.1
3636
hooks:
3737
- id: codespell
3838
types_or: [python, markdown, rst]
3939
additional_dependencies: [tomli]
4040
- repo: https://github.com/asottile/pyupgrade
41-
rev: v3.17.0
41+
rev: v3.19.1
4242
hooks:
4343
- id: pyupgrade
4444
- repo: https://github.com/MarcoGorelli/madforhooks
@@ -47,18 +47,18 @@ repos:
4747
# - id: conda-env-sorter # conflicts with prettier
4848
- id: check-execution-order
4949
- repo: https://github.com/executablebooks/mdformat
50-
rev: 0.7.17
50+
rev: 0.7.22
5151
hooks:
5252
- id: mdformat
5353
additional_dependencies: [mdformat-gfm, mdformat-black]
5454
exclude: ^.github/ # this avoid the hook to wrongly reformats md issue template files
5555
- repo: https://github.com/kynan/nbstripout
56-
rev: 0.7.1
56+
rev: 0.8.1
5757
hooks:
5858
- id: nbstripout
5959
args: [--keep-output]
6060
- repo: https://github.com/nbQA-dev/nbQA
61-
rev: 1.8.7
61+
rev: 1.9.1
6262
hooks:
6363
- id: nbqa-black
6464
- id: nbqa-ruff

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ representative at an online or offline event.
5858

5959
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6060
reported to the community leaders responsible for enforcement at
61-
\[INSERT CONTACT METHOD\].
61+
[INSERT CONTACT METHOD].
6262
All complaints will be reviewed and investigated promptly and fairly.
6363

6464
All community leaders are obligated to respect the privacy and security of the

gpm/accessor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727
"""This directory defines GPM-API xarray accessors."""
2828
from .methods import GPM_DataArray_Accessor, GPM_Dataset_Accessor
2929

30-
__all__ = ["GPM_Dataset_Accessor", "GPM_DataArray_Accessor"]
30+
__all__ = ["GPM_DataArray_Accessor", "GPM_Dataset_Accessor"]

gpm/bucket/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
__all__ = [
4747
"LonLatPartitioning",
4848
"TilePartitioning",
49-
"read",
5049
"merge_granule_buckets",
51-
"write_granules_bucket",
50+
"read",
5251
"write_bucket",
52+
"write_granules_bucket",
5353
]

gpm/bucket/writers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def _convert_size_to_bytes(size_str):
6969
"yb": 1024**8,
7070
}
7171

72-
for suffix in multipliers:
72+
for suffix, multiplier in multipliers.items():
7373
size_str = size_str.lower().strip().strip("s")
7474
if size_str.lower().endswith(suffix):
75-
return int(float(size_str[0 : -len(suffix)]) * multipliers[suffix])
75+
return int(float(size_str[0 : -len(suffix)]) * multiplier)
7676
if size_str.endswith("b"):
7777
size_str = size_str[0:-1]
7878
elif size_str.endswith("byte"):

gpm/gv/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
from gpm.gv.routines import volume_matching, retrieve_ds_sr
3737

3838
__all__ = [
39+
"calibration_summary",
3940
"compare_maps",
41+
"reflectivity_distribution",
4042
"reflectivity_scatterplot",
4143
"reflectivity_scatterplots",
42-
"reflectivity_distribution",
43-
"calibration_summary",
4444
"retrieve_ds_sr",
4545
"volume_matching",
4646
]

gpm/io/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ def download_archive(
991991
list_status = []
992992
list_versions = []
993993
for i, date in enumerate(dates):
994-
warn_missing_files = not (i == 0 or i == len(dates) - 1 and date == end_time)
994+
warn_missing_files = not (i == 0 or (i == len(dates) - 1 and date == end_time))
995995

996996
status, available_version = _download_daily_data(
997997
date=date,

gpm/tests/test_utils/test_geospatial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def test_get_country_extent(
300300
get_country_extent(country)
301301

302302
# Test typo in country name
303-
country = "Afganistan"
303+
country = "Afghanistan"
304304
with pytest.raises(ValueError) as exception_info:
305305
get_country_extent(country)
306306

gpm/tests/test_visualization/utils.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,22 @@ def save_and_check_figure(
8181
)
8282

8383
# Save current figure to temporary file
84-
tmp_file = tempfile.NamedTemporaryFile(suffix=image_extension, delete=False)
85-
figure.savefig(tmp_file.name)
86-
87-
# Compare reference and temporary file
88-
reference = mpl_image.imread(reference_path)
89-
tmp = mpl_image.imread(tmp_file.name)
90-
91-
mse = np.mean((reference - tmp) ** 2)
92-
assert (
93-
mse < mse_tolerance
94-
), f"Figure {tmp_file.name} is not the same as {name}{image_extension}. MSE {mse} > {mse_tolerance}"
95-
96-
# Remove temporary file if comparison was successful
97-
tmp_file.close()
98-
os.remove(tmp_file.name)
99-
plt.close()
84+
with tempfile.NamedTemporaryFile(suffix=image_extension, delete=False) as tmp_file:
85+
figure.savefig(tmp_file.name)
86+
87+
# Compare reference and temporary file
88+
reference = mpl_image.imread(reference_path)
89+
tmp = mpl_image.imread(tmp_file.name)
90+
91+
mse = np.mean((reference - tmp) ** 2)
92+
assert (
93+
mse < mse_tolerance
94+
), f"Figure {tmp_file.name} is not the same as {name}{image_extension}. MSE {mse} > {mse_tolerance}"
95+
96+
# Remove temporary file if comparison was successful
97+
tmp_file.close()
98+
os.remove(tmp_file.name)
99+
plt.close()
100100

101101

102102
def get_test_name() -> str:

gpm/utils/manipulations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def crop_around_valid_data(xr_obj, variable=None):
178178
da = get_xarray_variable(xr_obj, variable=variable)
179179

180180
# Create a boolean mask indicating where da is not NaN
181-
valid_mask = da.notnull().compute() # noqa: PD004
181+
valid_mask = da.notnull().compute()
182182

183183
# Raise error if not valid data
184184
if not np.any(valid_mask).item():

0 commit comments

Comments
 (0)