command: ruff check --select TCH,I,F
version: 0.5.1
code:
from decimal import Decimal # I001: import block un-sorted
from decimal import Decimal # F811: redefinition
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from decimal import Decimal # reimport, but no error
def fn():
value: Decimal # noqa: F842
I often import the same bunch of modules by snippet after TCH creates TYPE_CHECKING block.
ruff --fix deletes the second line above and keeps the first line.