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

Suppress B901 if function explicitly returns Generator #480

Closed
JelleZijlstra opened this issue Jul 2, 2024 · 0 comments · Fixed by #481
Closed

Suppress B901 if function explicitly returns Generator #480

JelleZijlstra opened this issue Jul 2, 2024 · 0 comments · Fixed by #481

Comments

@JelleZijlstra
Copy link
Collaborator

I got a B901 warning (well, from ruff, not directly from flake8-bugbear) about a function where I use a return statement in a generator. But it was on purpose; returning from a generator is occasionally useful.

I propose to not trigger B901 if the function has an explicit Generator[X, Y, Z] type annotation, because that indicates the author explicitly thought about it.

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 a pull request may close this issue.

1 participant