Skip to content

Commit

Permalink
Apply ruff/flake8-bugbear preview rule B901
Browse files Browse the repository at this point in the history
B901 Using `yield` and `return` in a generator function can lead to confusing behavior

Co-authored-by: Martin Durant <[email protected]>
  • Loading branch information
DimitriPapadopoulos and martindurant committed Oct 7, 2024
1 parent 3c88769 commit cb33e97
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fsspec/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,10 @@ def walk(self, path, maxdepth=None, topdown=True, on_error="omit", **kwargs):
except (FileNotFoundError, OSError) as e:
if on_error == "raise":
raise
elif callable(on_error):
if callable(on_error):
on_error(e)
if detail:
return path, {}, {}
return path, [], []
yield (path, {}, {}) if detail else (path, [], []) # noqa: B901
return

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

0 comments on commit cb33e97

Please sign in to comment.