Skip to content

Conversation

@JelleZijlstra
Copy link
Member

Unblocks turning on Y092; see PyCQA/flake8-pyi#86

@JelleZijlstra
Copy link
Member Author

OK, now normal flake8 thinks all of these names are undefined :). I'll back out the changes to names used elsewhere in the stub for now, and leave only the changes to the constants.

We could do some smarter things:

  • Produce this error only if the name is not used elsewhere in the stub
  • Teach flake8 to accept names as defined in stubs with only an x: T assignment
    But that feels like too much work for the minor benefit of getting rid of a few = ....

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 16, 2022

Simpler solution: just add Y092 to the list of error codes ignored in typing.pyi (and similarly just add a per-file ignore for Y092 with typing_extensions).

typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822

@JelleZijlstra
Copy link
Member Author

It's not just typing, but also something in pkg_resources that could easily appear in other stubs. I feel like the benefit of this change is low enough that it's not worth the risk of confusing a new contributor who runs into a false positive, so I'm not planning to build anything more complicated here.

@AlexWaygood
Copy link
Member

It's not just typing, but also something in pkg_resources that could easily appear in other stubs.

Yes, good point.

@github-actions
Copy link
Contributor

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

@Akuli Akuli merged commit 339bfbb into python:master Jan 16, 2022
JelleZijlstra added a commit to PyCQA/flake8-pyi that referenced this pull request Jan 16, 2022
Disabled-by-default error codes are problematic; see #75.

Y092 finds a fairly harmless error and has significant false positives (python/typeshed#6930).
I'm removing it so we can get rid of disabled-by-default errors and simplify our
setup.
@JelleZijlstra JelleZijlstra deleted the moreflakes branch January 16, 2022 17:42
srittau pushed a commit to PyCQA/flake8-pyi that referenced this pull request Jan 17, 2022
Disabled-by-default error codes are problematic; see #75.

Y092 finds a fairly harmless error and has significant false positives (python/typeshed#6930).
I'm removing it so we can get rid of disabled-by-default errors and simplify our
setup.
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.

3 participants