Skip to content

Commit b8a3a23

Browse files
[pre-commit.ci] pre-commit autoupdate (#2971)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl>
1 parent 27b3a99 commit b8a3a23

9 files changed

Lines changed: 21 additions & 21 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: trailing-whitespace
2525
args: [--markdown-linebreak-ext=md]
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.14.14"
27+
rev: "v0.15.0"
2828
hooks:
2929
- id: ruff-check
3030
args: [--fix]

esmvalcore/cmor/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ def _assign_dimensions(self, var, generic_levels):
788788
coord.generic_level = True
789789
for name in self.coords:
790790
generic_level = self.coords[name].generic_lev_name
791-
if dimension in [generic_level]:
791+
if dimension == generic_level:
792792
coord.generic_lev_coords[name] = self.coords[name]
793793
else:
794794
try:

esmvalcore/experimental/recipe_output.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ class DiagnosticOutput:
9999

100100
def __init__(self, name, task_output, title=None, description=None):
101101
self.name = name
102-
self.title = title if title else name.title()
103-
self.description = description if description else ""
102+
self.title = title or name.title()
103+
self.description = description or ""
104104
self.task_output = task_output
105105

106106
def __repr__(self):
@@ -416,9 +416,9 @@ def create(
416416
item_class: type[OutputFile]
417417

418418
ext = Path(path).suffix
419-
if ext in (".png",):
419+
if ext == ".png":
420420
item_class = ImageFile
421-
elif ext in (".nc",):
421+
elif ext == ".nc":
422422
item_class = DataFile
423423
else:
424424
item_class = cls

esmvalcore/preprocessor/_derive/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def derive(
123123

124124
# Set standard attributes
125125
cube.var_name = short_name
126-
cube.standard_name = standard_name if standard_name else None
126+
cube.standard_name = standard_name or None
127127
cube.long_name = long_name
128128
for temp in cubes:
129129
if "source_file" in temp.attributes:

esmvalcore/preprocessor/_derive/clhmtisccp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def required(project): # noqa: ARG004
1818
def calculate(cubes):
1919
"""Compute ISCCP high level medium-thickness cloud area fraction."""
2020
tau = Constraint(
21-
atmosphere_optical_thickness_due_to_cloud=lambda t: 3.6
22-
< t
23-
<= 23.0,
21+
atmosphere_optical_thickness_due_to_cloud=lambda t: (
22+
3.6 < t <= 23.0
23+
),
2424
)
2525
plev = Constraint(air_pressure=lambda p: p <= 44000.0)
2626

esmvalcore/preprocessor/_derive/cllmtisccp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def required(project): # noqa: ARG004
1818
def calculate(cubes):
1919
"""Compute ISCCP low level medium-thickness cloud area fraction."""
2020
tau = Constraint(
21-
atmosphere_optical_thickness_due_to_cloud=lambda t: 3.6
22-
< t
23-
<= 23.0,
21+
atmosphere_optical_thickness_due_to_cloud=lambda t: (
22+
3.6 < t <= 23.0
23+
),
2424
)
2525
plev = Constraint(air_pressure=lambda p: p > 68000.0)
2626

esmvalcore/preprocessor/_derive/clmmtisccp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def required(project): # noqa: ARG004
1818
def calculate(cubes):
1919
"""Compute ISCCP middle level medium-thickness cloud area fraction."""
2020
tau = Constraint(
21-
atmosphere_optical_thickness_due_to_cloud=lambda t: 3.6
22-
< t
23-
<= 23.0,
21+
atmosphere_optical_thickness_due_to_cloud=lambda t: (
22+
3.6 < t <= 23.0
23+
),
2424
)
2525
plev = Constraint(air_pressure=lambda p: 44000.0 < p <= 68000.0)
2626

esmvalcore/preprocessor/_time.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def clip_timerange(cube: Cube, timerange: str) -> Cube:
310310
Start/end times can not be parsed by isodate.
311311
312312
"""
313-
start_date = _parse_start_date(timerange.split("/")[0])
313+
start_date = _parse_start_date(timerange.split("/", maxsplit=1)[0])
314314
end_date = _parse_end_date(timerange.split("/")[1])
315315

316316
if isinstance(start_date, isodate.duration.Duration):
@@ -925,7 +925,7 @@ def climate_statistics(
925925
period = period.lower()
926926

927927
# Use Cube.collapsed when full period is requested
928-
if period in ("full",):
928+
if period == "full":
929929
(agg, agg_kwargs) = get_iris_aggregator(operator, **operator_kwargs)
930930
agg_kwargs = update_weights_kwargs(
931931
operator,
@@ -1033,7 +1033,7 @@ def anomalies(
10331033
period=period,
10341034
seasons=seasons,
10351035
)
1036-
if period in ["full"]:
1036+
if period == "full":
10371037
metadata = copy.deepcopy(cube.metadata)
10381038
cube = cube - reference
10391039
cube.metadata = metadata

tests/integration/preprocessor/_regrid/test_extract_location.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def mocked_geopy_geocoders_nominatim(mocker):
2626
latitude=40.3442754,
2727
longitude=-5.8606859,
2828
)
29-
mocked_nominatim.return_value.geocode.side_effect = (
30-
lambda x: geolocation_penacaballera if x == "Peñacaballera" else None
29+
mocked_nominatim.return_value.geocode.side_effect = lambda x: (
30+
geolocation_penacaballera if x == "Peñacaballera" else None
3131
)
3232

3333

0 commit comments

Comments
 (0)