Skip to content

Add Y027 to list of ignored .flake8 error codes#6962

Merged
JelleZijlstra merged 3 commits intopython:masterfrom
AlexWaygood:patch-1
Jan 19, 2022
Merged

Add Y027 to list of ignored .flake8 error codes#6962
JelleZijlstra merged 3 commits intopython:masterfrom
AlexWaygood:patch-1

Conversation

@AlexWaygood
Copy link
Copy Markdown
Member

Refs PyCQA/flake8-pyi#104

There are a number of stubs in typeshed that still support Python 2. Each subdirectory of stubs specifies whether or not it supports Python 2 in the METADATA.toml file. However, there's no easy way for flake8 to read those files, and I don't particularly like the idea of duplicating that information in the .flake8 config file. As such, I think it's easiest if we just globally ignore this check for the whole of typeshed. We can still keep the equivalent check in check_new_syntax.py, where it's easier to dynamically specific filepaths that we want to check things for.

Refs PyCQA/flake8-pyi#104

There are a number of stubs in typeshed that still support Python 2. Each subdirectory of stubs specifies whether or not it supports Python 2 in the `METADATA.toml` file. However, there's no easy way for flake8 to read those files, and I don't particularly like the idea of duplicating that information in the `.flake8` config file. As such, I think it's easiest if we just globally ignore this check for the whole of typeshed. We can still keep the equivalent check in `check_new_syntax.py`, where it's easier to dynamically specific filepaths that we want to check things for.
@JelleZijlstra
Copy link
Copy Markdown
Member

The Python 3-only stdlib is the most important chunk of typeshed. What if we just ignore it in all of stubs/ and stdlib/@python2?

@AlexWaygood
Copy link
Copy Markdown
Member Author

AlexWaygood commented Jan 19, 2022

The Python 3-only stdlib is the most important chunk of typeshed. What if we just ignore it in all of stubs/ and stdlib/@python2?

Yes, that's a better idea!

@JelleZijlstra
Copy link
Copy Markdown
Member

Thanks! Looking at https://github.com/PyCQA/flake8-pyi/runs/4869311453?check_suite_focus=true you may need a noqa in contextlib.pyi, do you want to do that in this PR?

@AlexWaygood
Copy link
Copy Markdown
Member Author

Thanks! Looking at https://github.com/PyCQA/flake8-pyi/runs/4869311453?check_suite_focus=true you may need a noqa in contextlib.pyi, do you want to do that in this PR?

Oh whoops, you're right, thanks!

@JelleZijlstra
Copy link
Copy Markdown
Member

Also, can you add Y027 in the list around line 20 of this file?

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit fe6233a into python:master Jan 19, 2022
@AlexWaygood AlexWaygood deleted the patch-1 branch January 19, 2022 15:17
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.

2 participants