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.
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.