Skip to content

Commit 2532091

Browse files
Apply ruff/flake8-bugbear preview rule B901
B901 Using `yield` and `return` in a generator function can lead to confusing behavior Co-authored-by: Martin Durant <[email protected]>
1 parent 3c88769 commit 2532091

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fsspec/spec.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,9 @@ def walk(self, path, maxdepth=None, topdown=True, on_error="omit", **kwargs):
428428
except (FileNotFoundError, OSError) as e:
429429
if on_error == "raise":
430430
raise
431-
elif callable(on_error):
431+
if callable(on_error):
432432
on_error(e)
433-
if detail:
434-
return path, {}, {}
435-
return path, [], []
433+
return (path, {}, {}) if detail else (path, [], []) # noqa: B901
436434

437435
for info in listing:
438436
# each info name must be at least [path]/part , but here

0 commit comments

Comments
 (0)