Skip to content

Commit

Permalink
Apply ruff rule RUF100
Browse files Browse the repository at this point in the history
RUF100 Unused blanket `noqa` directive
  • Loading branch information
DimitriPapadopoulos committed Nov 6, 2024
1 parent 35439d1 commit c6ad4c4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ ignore = [
"E501",
"E731",
"UP007",
"RUF001",
"RUF002",
"RUF003",
"RUF005",
"RUF007",
"RUF012",
]
extend-select = [
"B", # flake8-bugbear
Expand All @@ -254,6 +260,7 @@ extend-select = [
"TID", # flake8-tidy-imports (absolute imports)
"I", # isort
"PGH", # pygrep-hooks
"RUF",
"UP", # Pyupgrade
]

Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _get_scheduler(get=None, collection=None) -> str | None:
# Fix for bug caused by dask installation that doesn't involve the toolz library
# Issue: 4164
import dask
from dask.base import get_scheduler # noqa: F401
from dask.base import get_scheduler

actual_get = get_scheduler(get, collection)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion xarray/plot/dataarray_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ def newplotfunc(
if ax is None:
# TODO: Importing Axes3D is no longer necessary in matplotlib >= 3.2.
# Remove when minimum requirement of matplotlib is 3.2:
from mpl_toolkits.mplot3d import Axes3D # noqa: F401
from mpl_toolkits.mplot3d import Axes3D

# delete so it does not end up in locals()
del Axes3D
Expand Down
2 changes: 1 addition & 1 deletion xarray/testing/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def _assert_dataset_invariants(ds: Dataset, check_default_indexes: bool):
set(ds._variables),
)

assert type(ds._dims) is dict, ds._dims # noqa: E721
assert type(ds._dims) is dict, ds._dims
assert all(isinstance(v, int) for v in ds._dims.values()), ds._dims
var_dims: set[Hashable] = set()
for v in ds._variables.values():
Expand Down
4 changes: 2 additions & 2 deletions xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def test_properties(self) -> None:
assert isinstance(ds.dims, utils.Frozen)
# TODO change after deprecation cycle in GH #8500 is complete
assert isinstance(ds.dims.mapping, dict)
assert type(ds.dims.mapping) is dict # noqa: E721
assert type(ds.dims.mapping) is dict
with pytest.warns(
FutureWarning,
match=" To access a mapping from dimension names to lengths, please use `Dataset.sizes`",
Expand Down Expand Up @@ -3069,7 +3069,7 @@ def test_rename(self) -> None:
renamed[k].variable.to_base_variable(),
)
assert v.encoding == renamed[k].encoding
assert type(v) is type(renamed.variables[k]) # noqa: E721
assert type(v) is type(renamed.variables[k])

assert "var1" not in renamed
assert "dim2" not in renamed
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ def test_values(self):
def test_numpy_same_methods(self):
v = Variable([], np.float32(0.0))
assert v.item() == 0
assert type(v.item()) is float # noqa: E721
assert type(v.item()) is float

v = IndexVariable("x", np.arange(5))
assert 2 == v.searchsorted(2)
Expand Down
2 changes: 1 addition & 1 deletion xarray/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _check_netcdf_engine_installed(name):
import scipy # noqa: F401
except ImportError:
try:
import netCDF4 # noqa: F401
import netCDF4
except ImportError as err:
raise ImportError(
f"opening tutorial dataset {name} requires either scipy or "
Expand Down

0 comments on commit c6ad4c4

Please sign in to comment.