Skip to content

Suppress B901 if function explicitly returns Generator #480

@JelleZijlstra

Description

@JelleZijlstra

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions