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

remove handling of # type: comments now that pyflakes is py3+ #684

Merged
merged 1 commit into from Sep 16, 2022
Merged

remove handling of # type: comments now that pyflakes is py3+ #684

merged 1 commit into from Sep 16, 2022

Conversation

asottile
Copy link
Member

resolves #683

@asottile
Copy link
Member Author

going to merge this for now -- might revert it before the next release but I'd like to see it go out

@asottile asottile merged commit 04ecb0c into PyCQA:master Sep 16, 2022
@asottile asottile deleted the remove_type_comments branch September 16, 2022 04:14
eli-schwartz added a commit to eli-schwartz/meson that referenced this pull request Nov 24, 2022
flake8 6 upgrades to pyflakes 3, and in turn this means that support for
parsing `# type: ` style annotations has been removed.

PyCQA/pyflakes#684

This caused one file to fail linting, because it had a typing import
which was only used by a type comment.

```
mesonbuild/cmake/interpreter.py:55:5: F401 '.common.CMakeConfiguration' imported but unused
```

Updating it to actual annotations allows pyflakes to detect its usage
again, and flake8 passes. Do the whole file while we are here.
@eli-schwartz
Copy link

Just hit this when flake8 updated in CI, it gave me the right kick to finally update this old code... (we use modern annotation style in new code, of course).

In case anyone else has the same issue, https://github.com/ilevkivskyi/com2ann seems useful to auto-migrate your code, so the change should be low-impact.

eli-schwartz added a commit to eli-schwartz/meson that referenced this pull request Nov 24, 2022
flake8 6 upgrades to pyflakes 3, and in turn this means that support for
parsing `# type: ` style annotations has been removed.

PyCQA/pyflakes#684

This caused one file to fail linting, because it had a typing import
which was only used by a type comment.

```
mesonbuild/cmake/interpreter.py:55:5: F401 '.common.CMakeConfiguration' imported but unused
```

Updating it to actual annotations allows pyflakes to detect its usage
again, and flake8 passes. Do the whole file while we are here.
mgedmin added a commit to mgedmin/check-python-versions that referenced this pull request Nov 26, 2022
Flake8 explicitly dropped support for type comments:
PyCQA/pyflakes#684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use ast.parse(type_comments=True) instead of file_tokens on Python 3.8+
2 participants