Skip to content

Commit f8fc448

Browse files
Apply ruff rule RUF100
RUF100 Unused blanket `noqa` directive
1 parent 2d51956 commit f8fc448

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

pyproject.toml

+7
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ ignore = [
245245
"E501",
246246
"E731",
247247
"UP007",
248+
"RUF001",
249+
"RUF002",
250+
"RUF003",
251+
"RUF005",
252+
"RUF007",
253+
"RUF012",
248254
]
249255
extend-select = [
250256
"B", # flake8-bugbear
@@ -254,6 +260,7 @@ extend-select = [
254260
"TID", # flake8-tidy-imports (absolute imports)
255261
"I", # isort
256262
"PGH", # pygrep-hooks
263+
"RUF",
257264
"UP", # Pyupgrade
258265
]
259266

xarray/backends/locks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _get_scheduler(get=None, collection=None) -> str | None:
149149
# Fix for bug caused by dask installation that doesn't involve the toolz library
150150
# Issue: 4164
151151
import dask
152-
from dask.base import get_scheduler # noqa: F401
152+
from dask.base import get_scheduler
153153

154154
actual_get = get_scheduler(get, collection)
155155
except ImportError:

xarray/plot/dataarray_plot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ def newplotfunc(
14801480
if ax is None:
14811481
# TODO: Importing Axes3D is no longer necessary in matplotlib >= 3.2.
14821482
# Remove when minimum requirement of matplotlib is 3.2:
1483-
from mpl_toolkits.mplot3d import Axes3D # noqa: F401
1483+
from mpl_toolkits.mplot3d import Axes3D
14841484

14851485
# delete so it does not end up in locals()
14861486
del Axes3D

xarray/testing/assertions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def _assert_dataset_invariants(ds: Dataset, check_default_indexes: bool):
423423
set(ds._variables),
424424
)
425425

426-
assert type(ds._dims) is dict, ds._dims # noqa: E721
426+
assert type(ds._dims) is dict, ds._dims
427427
assert all(isinstance(v, int) for v in ds._dims.values()), ds._dims
428428
var_dims: set[Hashable] = set()
429429
for v in ds._variables.values():

xarray/tests/test_dataset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def test_properties(self) -> None:
684684
assert isinstance(ds.dims, utils.Frozen)
685685
# TODO change after deprecation cycle in GH #8500 is complete
686686
assert isinstance(ds.dims.mapping, dict)
687-
assert type(ds.dims.mapping) is dict # noqa: E721
687+
assert type(ds.dims.mapping) is dict
688688
with pytest.warns(
689689
FutureWarning,
690690
match=" To access a mapping from dimension names to lengths, please use `Dataset.sizes`",
@@ -3069,7 +3069,7 @@ def test_rename(self) -> None:
30693069
renamed[k].variable.to_base_variable(),
30703070
)
30713071
assert v.encoding == renamed[k].encoding
3072-
assert type(v) is type(renamed.variables[k]) # noqa: E721
3072+
assert type(v) is type(renamed.variables[k])
30733073

30743074
assert "var1" not in renamed
30753075
assert "dim2" not in renamed

xarray/tests/test_variable.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ def test_values(self):
10711071
def test_numpy_same_methods(self):
10721072
v = Variable([], np.float32(0.0))
10731073
assert v.item() == 0
1074-
assert type(v.item()) is float # noqa: E721
1074+
assert type(v.item()) is float
10751075

10761076
v = IndexVariable("x", np.arange(5))
10771077
assert 2 == v.searchsorted(2)

xarray/tutorial.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _check_netcdf_engine_installed(name):
5959
import scipy # noqa: F401
6060
except ImportError:
6161
try:
62-
import netCDF4 # noqa: F401
62+
import netCDF4
6363
except ImportError as err:
6464
raise ImportError(
6565
f"opening tutorial dataset {name} requires either scipy or "

0 commit comments

Comments
 (0)