Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply ruff/flake8-bugbear preview rule B901 #1706

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

DimitriPapadopoulos
Copy link
Contributor

See return-in-generator (B901):

Using return {value} in a generator function was syntactically invalid in Python 2. In Python 3 return {value} can be used in a generator; however, the combination of yield and return can lead to confusing behavior, as the return statement will cause the generator to raise StopIteration with the value provided, rather than returning the value to the caller.

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as draft October 4, 2024 22:26
fsspec/spec.py Outdated Show resolved Hide resolved
fsspec/spec.py Outdated Show resolved Hide resolved
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review October 7, 2024 15:10
fsspec/spec.py Outdated Show resolved Hide resolved
B901 Using `yield` and `return` in a generator function can lead to confusing behavior

Co-authored-by: Martin Durant <[email protected]>
@martindurant martindurant merged commit f2c7717 into fsspec:master Oct 7, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants