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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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