---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP042 [*] Class A inherits from both `str` and `enum.Enum`
 --> UP042.py:4:7
  |
4 | class A(str, Enum): ...
  |       ^
  |
help: Inherit from `enum.StrEnum`
  |
  - from enum import Enum
1 + from enum import Enum, StrEnum
2 |
3 |
  - class A(str, Enum): ...
4 + class A(StrEnum): ...
5 |
  |
note: This is an unsafe fix and may change runtime behavior

UP042 [*] Class B inherits from both `str` and `enum.Enum`
 --> UP042.py:7:7
  |
7 | class B(Enum, str): ...
  |       ^
  |
help: Inherit from `enum.StrEnum`
  |
  - from enum import Enum
1 + from enum import Enum, StrEnum
2 |
--------------------------------------------------------------------------------
6 |
  - class B(Enum, str): ...
7 + class B(StrEnum): ...
8 |
  |
note: This is an unsafe fix and may change runtime behavior

UP042 Class D inherits from both `str` and `enum.Enum`
  --> UP042.py:10:7
   |
10 | class D(int, str, Enum): ...
   |       ^
   |
help: Inherit from `enum.StrEnum`

UP042 Class E inherits from both `str` and `enum.Enum`
  --> UP042.py:13:7
   |
13 | class E(str, int, Enum): ...
   |       ^
   |
help: Inherit from `enum.StrEnum`
