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

F822 (flake8): Type-only definitions in stubs and __all__ #533

Open
srittau opened this issue Apr 23, 2020 · 3 comments
Open

F822 (flake8): Type-only definitions in stubs and __all__ #533

srittau opened this issue Apr 23, 2020 · 3 comments

Comments

@srittau
Copy link
Contributor

srittau commented Apr 23, 2020

I am not sure if this is something that should be fixed in pyflakes as it only concerns stub files and is a genuine error in Python files. Please consider:

__all__ = ["foo"]

foo: int

This reports undefined name 'foo' in __all__. This is true at runtime, although this example is still useful for stubs. (flake8 3.7.9, pyflakes 2.1.1)

@asottile
Copy link
Member

is this the same as #486? (it also works if doing foo: int = ...)

@srittau
Copy link
Contributor Author

srittau commented Apr 23, 2020

It might be due to the same root cause (foo: int not introducing a name). But I think the behavior should be a bit different. #486 is problematic since it rejects valid implementations, especially when from __future__ import annotations becomes the default. This problem only affects stubs and the warning should most likely remain for implementations.

@asottile
Copy link
Member

could you answer my question in #486 then?

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

No branches or pull requests

2 participants