From 43f78cc4b28c576eccde3951004544a74a894b2b Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:56:15 +0200 Subject: [PATCH] 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 --- fsspec/spec.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fsspec/spec.py b/fsspec/spec.py index 8229170e2..e67d280c1 100644 --- a/fsspec/spec.py +++ b/fsspec/spec.py @@ -428,11 +428,9 @@ 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, [], [] + return for info in listing: # each info name must be at least [path]/part , but here