Skip to content

Commit e7e1461

Browse files
Enforce Perflint rule PERF401
These warnings appears to raised by ruff 0.4.4, not 0.4.3: PERF401 Use an async list comprehension to create a transformed list
1 parent 0bb3f26 commit e7e1461

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: check-yaml
1515
- repo: https://github.com/astral-sh/ruff-pre-commit
1616
# Ruff version.
17-
rev: v0.3.4
17+
rev: v0.4.4
1818
hooks:
1919
# Run the linter.
2020
- id: ruff

fsspec/implementations/tests/test_dirfs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,10 @@ async def _walk(path, *args, **kwargs):
353353
adirfs.fs._walk = mocker.MagicMock()
354354
adirfs.fs._walk.side_effect = _walk
355355

356-
actual = []
357-
async for entry in adirfs._walk("root", *ARGS, **KWARGS):
358-
actual.append(entry) # noqa: PERF402
356+
actual = [
357+
entry async
358+
for entry in adirfs._walk("root", *ARGS, **KWARGS)
359+
]
359360
assert actual == [("root", ["foo", "bar"], ["baz", "qux"])]
360361
adirfs.fs._walk.assert_called_once_with(f"{PATH}/root", *ARGS, **KWARGS)
361362

fsspec/implementations/tests/test_http.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,10 @@ async def test_async_walk(server):
564564
fs = fsspec.filesystem("http", asynchronous=True, skip_instance_cache=True)
565565

566566
# No maxdepth
567-
res = []
568-
async for a in fs._walk(server + "/index"):
569-
res.append(a) # noqa: PERF402
567+
res = [
568+
a async
569+
for a in fs._walk(server + "/index")
570+
]
570571
assert res == [(server + "/index", [], ["realfile"])]
571572

572573
# maxdepth=0

0 commit comments

Comments
 (0)