Skip to content

UP035 false positive on typing_extensions.dataclass_transform on python 3.11 #5112

@DetachHead

Description

@DetachHead
from typing_extensions import dataclass_transform
# UP035 Import from `typing` instead: `dataclass_transform`

typing_extensions.dataclass_transform has the frozen_default parameter which won't be in typing until python 3.12.

from typing_extensions:

if sys.version_info >= (3, 12):
    # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
    dataclass_transform = typing.dataclass_transform
else:
    def dataclass_transform(
        *,
        eq_default: bool = True,
        order_default: bool = False,
        kw_only_default: bool = False,
        frozen_default: bool = False,
        field_specifiers: typing.Tuple[
            typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
            ...
        ] = (),
        **kwargs: typing.Any,
    ) -> typing.Callable[[T], T]:
        ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedContributions especially welcomeruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions