From 8101eb4bc5c0bc7204c9893830695d10029ca2bd Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:28:41 +0100 Subject: [PATCH 1/2] Apply ruff/flake8-implicit-str-concat rule ISC001 ISC001 Implicitly concatenated string literals on one line --- xarray/core/dataset.py | 6 ++---- xarray/core/indexing.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 4593fd62730..5341b6f3f6f 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -4772,9 +4772,7 @@ def expand_dims( if d in self.dims: raise ValueError(f"Dimension {d} already exists.") if d in self._variables and not utils.is_scalar(self._variables[d]): - raise ValueError( - f"{d} already exists as coordinate or" " variable name." - ) + raise ValueError(f"{d} already exists as coordinate or variable name.") variables: dict[Hashable, Variable] = {} indexes: dict[Hashable, Index] = dict(self._indexes) @@ -4801,7 +4799,7 @@ def expand_dims( pass # Do nothing if the dimensions value is just an int else: raise TypeError( - f"The value of new dimension {k} must be " "an iterable or an int" + f"The value of new dimension {k} must be an iterable or an int" ) for k, v in self._variables.items(): diff --git a/xarray/core/indexing.py b/xarray/core/indexing.py index d8727c38c48..04eb67b981e 100644 --- a/xarray/core/indexing.py +++ b/xarray/core/indexing.py @@ -1640,7 +1640,7 @@ def _oindex_set(self, indexer: OuterIndexer, value: Any) -> None: num_non_slices = sum(0 if isinstance(k, slice) else 1 for k in indexer.tuple) if num_non_slices > 1: raise NotImplementedError( - "xarray can't set arrays with multiple " "array indices to dask yet." + "xarray can't set arrays with multiple array indices to dask yet." ) self.array[indexer.tuple] = value From 6d2a3a1f5de7697535a7fde13c3ee2ac0fc3fc2a Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:30:06 +0100 Subject: [PATCH 2/2] Apply ruff/flake8-implicit-str-concat rule ISC003 ISC003 Explicitly concatenated string should be implicitly concatenated --- xarray/plot/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/plot/utils.py b/xarray/plot/utils.py index 1d61c5afc74..b9855fcea23 100644 --- a/xarray/plot/utils.py +++ b/xarray/plot/utils.py @@ -870,7 +870,7 @@ def _infer_interval_breaks(coord, axis=0, scale=None, check_monotonic=False): if (coord <= 0).any(): raise ValueError( "Found negative or zero value in coordinates. " - + "Coordinates must be positive on logscale plots." + "Coordinates must be positive on logscale plots." ) coord = np.log10(coord)