Skip to content

unused-import false negative when typing.Annotated has str parameters #7547

Closed
@lggruspe

Description

@lggruspe

Bug description

example.py:

# pylint: disable=missing-docstring
from pathlib import Path
import typing as t

example: t.Annotated[str, "Path"] = "/foo/bar"

Configuration

No response

Command used

pylint example.py

Pylint output

Success: no issues found in 1 source file

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Expected behavior

It should report unused-import, since the parameter to Annotated does not refer to pathlib.Path.

Pylint version

pylint 2.15.3
astroid 2.12.10
Python 3.10.7 (main, Sep  7 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-1)]

OS / Environment

fedora 36

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Negative 🦋No message is emitted but something is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions