Skip to content

ruff 0.15.0 throws UP042 and UP046 errors #1397

@RichieB2B

Description

@RichieB2B

Describe the bug

ruff 0.15.0 throws these errors:

UP042 Class Product inherits from both `str` and `enum.Enum`
 --> my_client/my_api_client/models/product.py:4:7
  |
4 | class Product(str, Enum):
  |       ^^^^^^^
5 |     CHEESE = "Cheese"
6 |     MILK = "Milk"
  |
help: Inherit from `enum.StrEnum`

UP046 Generic class `Response` uses `Generic` subclass instead of type parameters
  --> my_client/my_api_client/types.py:45:16
   |
44 | @define
45 | class Response(Generic[T]):
   |                ^^^^^^^^^^
46 |     """A response from an endpoint"""
   |
help: Use type parameters

after running ruff check --fix --unsafe-fixes the code looks like:

from enum import StrEnum

class Product(StrEnum):
    CHEESE = "Cheese"
    MILK = "Milk"

and

@define
class Response[T]:
    """A response from an endpoint"""

    status_code: HTTPStatus
    content: bytes
    headers: MutableMapping[str, str]
    parsed: T | None

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