Skip to content

Support flake8-pep585 for accesses from typing after import #3936

@wookie184

Description

@wookie184

Ruff catches all of these as UP035 violations:

from typing import (
    Container,
    Callable,
    AsyncIterable,
    Mapping,
    Coroutine,
    OrderedDict,
)

However, none of these trigger that rule:

import typing

a: typing.Container
b: typing.Callable
c: typing.AsyncIterable
d: typing.Mapping
e: typing.Coroutine
f: typing.OrderedDict

This isn't something supported by pyupgrade (as the autofix would be quite complicated), but it seems like it would be worth a warning. flake8-pep585 catches these.

On ruff playground:
https://play.ruff.rs/#N4KABGBEDOCmA2sDGAXSAuMBtSBVACpALoA04UKAhgE4DmsKAtAG6zXQCWA9gHYZQAHAJ4BmAIxjIIAL4ASeRwC2ArtRRgUQgRx60QISpk3bdAOgDCvKjrYgARka07aFyvHiU7iEEkcmXAILQQjxIAJIobJ7eACZ+zqYAspQC-iCw8WaW1FwArig2IABmmS4A8tQxbLAxACIcqPpFOYoaTrpgSipqYAAU5BCWPNY8bGQQg24eXrDjE0Eh4ZHU0bMDYMmpznODqnkFoztgFVXUNfWoZACUQA

Note that the names I listed are just examples, there are probably more pep 585 names with the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing 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