You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, the issue here is that F821 isn't anything to do with flake8-pyi per se — it's triggered by pyflakes, one of the builtin flake8 plugins. Unfortunately, neither pyflakes nor flake8 have ever claimed to support stub files, and pyflakes doesn't really understand some of the important semantic differences between.py files and .pyi files, including the fact that forward references are natively supported in stubs.
Ideally we'd submit patches upstream to make pyflakes .pyi-compatible (#183), but:
I'm not sure if upstream would be receptive
It might be a fair bit of work (I don't know!)
Nobody's got round to it yet/there's always been lower-hanging fruit to work on :)
AlexWaygood
changed the title
FDecl class resolution
Spurious F821 error emitted by pyflakes due to forward references
Aug 26, 2022
Repro:
Both mypy and pyright are happy with this
flake8 complains that it can't identify the name
Outer
Within a
.py
file, this construct would not be ok, but it appears to be ok within a.pyi
file.This may be because mypy/pyright do a 2-pass check. I am not sure how flake8/flake8-pyi works here.
The text was updated successfully, but these errors were encountered: