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
RUF100 Unused `noqa` directive
  • Loading branch information
DimitriPapadopoulos committed Aug 12, 2024
1 parent e356b97 commit 5ff5354
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion fsspec/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ async def flush(self, force=False):
self.offset = 0
try:
await self._initiate_upload()
except: # noqa: E722
except:
self.closed = True
raise

Expand Down
2 changes: 1 addition & 1 deletion fsspec/implementations/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def cp_file(self, path1, path2, **kwargs):
with self.open(tmp_fname, "wb") as rstream:
shutil.copyfileobj(lstream, rstream)
self.fs.move(tmp_fname, path2)
except BaseException: # noqa
except BaseException:
with suppress(FileNotFoundError):
self.fs.delete_file(tmp_fname)
raise
Expand Down
2 changes: 1 addition & 1 deletion fsspec/implementations/tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pyarrow_fs = pytest.importorskip("pyarrow.fs")
FileSystem = pyarrow_fs.FileSystem

from fsspec.implementations.arrow import ArrowFSWrapper, HadoopFileSystem # noqa
from fsspec.implementations.arrow import ArrowFSWrapper, HadoopFileSystem # noqa: E402


@pytest.fixture(scope="function")
Expand Down
10 changes: 5 additions & 5 deletions fsspec/implementations/tests/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from fsspec.tests.conftest import data, realfile, reset_files, server, win # noqa: F401


def test_simple(server): # noqa: F811
def test_simple(server):
# The dictionary in refs may be dumped with a different separator
# depending on whether json or ujson is imported
from fsspec.implementations.reference import json as json_impl
Expand All @@ -37,7 +37,7 @@ def test_simple(server): # noqa: F811
assert f.read(2) == "he"


def test_simple_ver1(server): # noqa: F811
def test_simple_ver1(server):
# The dictionary in refs may be dumped with a different separator
# depending on whether json or ujson is imported
from fsspec.implementations.reference import json as json_impl
Expand Down Expand Up @@ -75,7 +75,7 @@ def test_target_options(m):
assert fs.cat("a") == b"hello"


def test_ls(server): # noqa: F811
def test_ls(server):
refs = {"a": b"data", "b": (realfile, 0, 5), "c/d": (realfile, 1, 6)}
h = fsspec.filesystem("http")
fs = fsspec.filesystem("reference", fo=refs, fs=h)
Expand All @@ -99,7 +99,7 @@ def test_nested_dirs_ls():
assert {e["name"] for e in fs.ls("B")} == {"B/C", "B/_"}


def test_info(server): # noqa: F811
def test_info(server):
refs = {
"a": b"data",
"b": (realfile, 0, 5),
Expand Down Expand Up @@ -173,7 +173,7 @@ def test_put_get_single(tmpdir):
assert fs.cat("hi") == b"data"


def test_defaults(server): # noqa: F811
def test_defaults(server):
refs = {"a": b"data", "b": (None, 0, 5)}
fs = fsspec.filesystem(
"reference",
Expand Down
2 changes: 1 addition & 1 deletion fsspec/implementations/tests/test_smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def smb_params(request):
cfg = "-p -u 'testuser;testpass' -s 'home;/share;no;no;no;testuser'"
port = request.param if request.param is not None else default_port
img = (
f"docker run --name {container} --detach -p 139:139 -p {port}:445 dperson/samba" # noqa: E231 E501
f"docker run --name {container} --detach -p 139:139 -p {port}:445 dperson/samba"
)
cmd = f"{img} {cfg}"
try:
Expand Down
4 changes: 2 additions & 2 deletions fsspec/implementations/webhdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
if self._cached:
return
super().__init__(**kwargs)
self.url = f"{'https' if use_https else 'http'}://{host}:{port}/webhdfs/v1" # noqa
self.url = f"{'https' if use_https else 'http'}://{host}:{port}/webhdfs/v1"
self.kerb = kerberos
self.kerb_kwargs = kerb_kwargs or {}
self.pars = {}
Expand Down Expand Up @@ -393,7 +393,7 @@ def cp_file(self, lpath, rpath, **kwargs):
with self.open(tmp_fname, "wb") as rstream:
shutil.copyfileobj(lstream, rstream)
self.mv(tmp_fname, rpath)
except BaseException: # noqa
except BaseException:
with suppress(FileNotFoundError):
self.rm(tmp_fname)
raise
Expand Down
2 changes: 1 addition & 1 deletion fsspec/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ def flush(self, force=False):
self.offset = 0
try:
self._initiate_upload()
except: # noqa: E722
except:
self.closed = True
raise

Expand Down
6 changes: 3 additions & 3 deletions fsspec/tests/abstract/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import pytest

from fsspec.implementations.local import LocalFileSystem
from fsspec.tests.abstract.copy import AbstractCopyTests # noqa
from fsspec.tests.abstract.get import AbstractGetTests # noqa
from fsspec.tests.abstract.put import AbstractPutTests # noqa
from fsspec.tests.abstract.copy import AbstractCopyTests # noqa: F401
from fsspec.tests.abstract.get import AbstractGetTests # noqa: F401
from fsspec.tests.abstract.put import AbstractPutTests # noqa: F401


class BaseAbstractFixtures:
Expand Down
2 changes: 1 addition & 1 deletion fsspec/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pytest.importorskip("moto")

try:
from s3fs.tests.test_s3fs import ( # noqa: E402,F401
from s3fs.tests.test_s3fs import ( # noqa: F401
endpoint_uri,
s3,
s3_base,
Expand Down
4 changes: 2 additions & 2 deletions fsspec/tests/test_fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import pytest

try:
pytest.importorskip("fuse") # noqa: E402
pytest.importorskip("fuse")
except OSError:
# can succeed in importing fuse, but fail to load so
pytest.importorskip("nonexistent") # noqa: E402
pytest.importorskip("nonexistent")

from fsspec.fuse import main, run
from fsspec.implementations.memory import MemoryFileSystem
Expand Down
4 changes: 2 additions & 2 deletions fsspec/tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_entry_points_registered_on_import(clear_registry, clean_imports):
import_location = "importlib.metadata.entry_points"
with patch(import_location, return_value={"fsspec.specs": [mock_ep]}):
assert "test" not in registry
import fsspec # noqa
import fsspec # noqa: F401

get_filesystem_class("test")
assert "test" in registry
Expand All @@ -117,7 +117,7 @@ def test_filesystem_warning_arrow_hdfs_deprecated(clear_registry, clean_imports)
mock_ep.value = "fsspec.spec.AbstractFileSystem"
import_location = "importlib.metadata.entry_points"
with patch(import_location, return_value={"fsspec.specs": [mock_ep]}):
import fsspec # noqa
import fsspec # noqa: F401

with pytest.warns(DeprecationWarning):
filesystem("arrow_hdfs")
Expand Down

0 comments on commit 5ff5354

Please sign in to comment.