asottile / pyupgrade

A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
MIT License
3.5k stars 177 forks source link

Remove imports for pep 585 #928

Closed Ezibenroc closed 7 months ago

Ezibenroc commented 7 months ago

Related to the pep 585 feature.

Running pyupgrade on this input file:

from typing import List

def f(x: List[str]) -> None:
    pass

It currently produces this file (changing List to list):

from typing import List

def f(x: list[str]) -> None:
    pass

I think it would be nice to produce this file instead (removing the now unused import):

def f(x: list[str]) -> None:
    pass
asottile commented 7 months ago

please search the issue tracker for duplicates