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 2991c3d commit 3fb3b2d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
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
4 changes: 2 additions & 2 deletions xarray/tests/test_datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_create_full_tree(self, simple_datatree) -> None:
class TestNames:
def test_child_gets_named_on_attach(self) -> None:
sue = DataTree()
mary = DataTree(children={"Sue": sue}) # noqa
mary = DataTree(children={"Sue": sue})
assert mary.children["Sue"].name == "Sue"

def test_dataset_containing_slashes(self) -> None:
Expand Down Expand Up @@ -515,7 +515,7 @@ def test_setitem_new_grandchild_node(self) -> None:
def test_grafted_subtree_retains_name(self) -> None:
subtree = DataTree(name="original_subtree_name")
root = DataTree(name="root")
root["new_subtree_name"] = subtree # noqa
root["new_subtree_name"] = subtree
assert subtree.name == "original_subtree_name"

def test_setitem_new_empty_node(self) -> None:
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
except ImportError:
try:
import netCDF4 # noqa
import netCDF4
except ImportError as err:
raise ImportError(
f"opening tutorial dataset {name} requires either scipy or "
Expand Down

0 comments on commit 3fb3b2d

Please sign in to comment.