Skip to content

Type-checking only imports shouldn't be considered as a deadcode #39

Description

@serozhenka

test.py

from  typing import TYPE_CHECKING

if TYPE_CHECKING:
    from abc import ABC


a: "ABC | None" = None
print(a)

python test.py

test.py:4:20: DC07 Import `ABC` is never used

Expected: no errrors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions