Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports used in "# type" are detected as unused in 6.0.0 #1755

Closed
SamuilDichev opened this issue Nov 24, 2022 · 1 comment
Closed

Imports used in "# type" are detected as unused in 6.0.0 #1755

SamuilDichev opened this issue Nov 24, 2022 · 1 comment
Labels

Comments

@SamuilDichev
Copy link

SamuilDichev commented Nov 24, 2022

how did you install flake8?

$ pip install flake8==6.0.0

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.8.10",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.10.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.0.0"
    }
  ],
  "version": "6.0.0"
}

describe the problem

what I expected to happen

Imports used only for type hinting via # type to be detected as used and not be highlighted by flake8 as unused.

sample code

from typing import Dict
gaz = {}  # type: Dict[int, int]

commands ran

$ flake8 test/test.py
test/test.py:1:1: F401 'typing.Dict' imported but unused
mgedmin added a commit to mgedmin/check-manifest that referenced this issue Nov 24, 2022
This is a workaround for PyCQA/flake8#1755,
but also a shift towards the bright Python 3 future.
@sigmavirus24
Copy link
Member

In the future, please search closed and open issues before creating new ones that are duplicates.

@PyCQA PyCQA locked as resolved and limited conversation to collaborators Nov 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants