From 38becf379cae4223c93cdefaafc44a9c2ff8d1c9 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:54:28 +0200 Subject: [PATCH 1/2] Enforce ruff rule RUF022 RUF022 `__all__` is not sorted --- fsspec/__init__.py | 12 ++++++------ fsspec/registry.py | 2 +- pyproject.toml | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fsspec/__init__.py b/fsspec/__init__.py index d7af775f7..a71bbeeb0 100644 --- a/fsspec/__init__.py +++ b/fsspec/__init__.py @@ -18,21 +18,21 @@ __all__ = [ "AbstractFileSystem", - "FSTimeoutError", + "Callback", "FSMap", + "FSTimeoutError", + "available_compressions", + "available_protocols", + "caching", "filesystem", - "register_implementation", "get_filesystem_class", "get_fs_token_paths", "get_mapper", "open", "open_files", "open_local", + "register_implementation", "registry", - "caching", - "Callback", - "available_protocols", - "available_compressions", "url_to_fs", ] diff --git a/fsspec/registry.py b/fsspec/registry.py index 3db04c5ab..deec2b1f8 100644 --- a/fsspec/registry.py +++ b/fsspec/registry.py @@ -4,7 +4,7 @@ import types import warnings -__all__ = ["registry", "get_filesystem_class", "default"] +__all__ = ["default", "get_filesystem_class", "registry"] # internal, mutable _registry: dict[str, type] = {} diff --git a/pyproject.toml b/pyproject.toml index 9c2355625..558cc7b3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -180,6 +180,7 @@ select = [ "PYI", "RUF006", "RUF015", + "RUF022", "RUF024", "SIM", "SLOT", From 96996c499f7c3e75e789d9485fa712c646afc334 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 11 Mar 2025 22:51:46 +0100 Subject: [PATCH 2/2] Apply ruff rule RUF100 RUF100 Unused `noqa` directive --- fsspec/implementations/http.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fsspec/implementations/http.py b/fsspec/implementations/http.py index 7386d4b80..a724ac64a 100644 --- a/fsspec/implementations/http.py +++ b/fsspec/implementations/http.py @@ -254,7 +254,7 @@ async def _get_file( if isfilelike(lpath): outfile = lpath else: - outfile = open(lpath, "wb") # noqa: ASYNC101, ASYNC230 + outfile = open(lpath, "wb") # noqa: ASYNC230 try: chunk = True @@ -286,7 +286,7 @@ async def gen_chunks(): context = nullcontext(lpath) use_seek = False # might not support seeking else: - context = open(lpath, "rb") # noqa: ASYNC101, ASYNC230 + context = open(lpath, "rb") # noqa: ASYNC230 use_seek = True with context as f: @@ -812,7 +812,7 @@ async def get_range(session, url, start, end, file=None, **kwargs): async with r: out = await r.read() if file: - with open(file, "r+b") as f: # noqa: ASYNC101, ASYNC230 + with open(file, "r+b") as f: # noqa: ASYNC230 f.seek(start) f.write(out) else: