Skip to content

Upgrade Enum str Mixin to StrEnum in Python 3.11 #779

@atugushev

Description

@atugushev

Given that Python 3.11 introduced breaking change for Enum with str/int Mixin wouldn't it make sense to auto-upgrade this to StrEnum/IntEnum? For example pyupgrade --py311-plus:

Input:

class MyEnum(str, enum.Enum):
    FOO = "foo"
    BAR = "bar"

Output:

class MyEnum(enum.StrEnum):
    FOO = "foo"
    BAR = "bar"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions