Skip to content

LGTM.com - false positive from Python type checking #2014

@maxfischer2781

Description

@maxfischer2781

Description of the false positive

Type hints require types to be imported at validation-time. If type relations are cyclic, TYPE_CHECKING is recommended to remove cyclic imports at runtime. If type relations are forward referencing, type hints must be quoted (i.e. strings).

LGTM does not understand this usage. It reports

  • cyclic imports (even though guarded by TYPE_CHECKING), and
  • unused imports (even though used in type hints).

URL to the alert on the project page on LGTM.com

Cyclic import: https://lgtm.com/projects/g/MaineKuehn/usim/snapshot/6271704950fe0c34caee96eaf4cc37129fc13261/files/usim/_primitives/context.py?sort=name&dir=ASC&mode=heatmap#xce210d3cac0e2d3d:1

Unused import: https://lgtm.com/projects/g/MaineKuehn/usim/snapshot/6271704950fe0c34caee96eaf4cc37129fc13261/files/usim/_primitives/task.py?sort=name&dir=ASC&mode=heatmap#xc0feb80fd994c19a:1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions