-
Notifications
You must be signed in to change notification settings - Fork 179
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
Improve @overload detection #435
Improve @overload detection #435
Conversation
Hurray! This fixes another bug too: in the current released version, using a decorator named overload = lambda f: f # or `def overload(arg): return arg
@overload
def func(arg): pass
def func(arg): return ... Happily I've confirmed that this change fixes pyflakes for both the minimal case above (which might be worth adding as another test case for this PR?) and for Hypothesis - thanks @asottile 😍 |
Yeah, probably... still fixed though and still fixed by you 😁 |
heh only fair -- I broke it in the first place /o\ |
Thanks for fixing this! Could you all please cut a pypi release that includes this fix? |
Note that because of a bug fix in Python 3.8, the position of `noqa: F811` for @overload has to be changed (see also https://gitlab.com/pycqa/flake8/issues/583). So, if we want to pass flake8 both with Python 3.7 and 3.8, we need to put `noqa: F811` for two lines per @overload. This situation will be resolved by a new release of pyflakes with improving @overload detection PyCQA/pyflakes#435.
Note that because of a bug fix in Python 3.8 (see https://gitlab.com/pycqa/flake8/issues/583) we need `noqa: F811` for two lines per @overload if we want to pass flake8 both with Python 3.7 and 3.8. This situation will be resolved by a new release of pyflakes with improving @overload detection PyCQA/pyflakes#435.
When is this expected to make it to flake8? |
no current plan, but you can read my thoughts here or as a temporary workaround install from |
Looks like this issue still happens with master on python 3.8. |
doesn't happen for me? try uninstalling |
You are right, I had a system wide flake8 installed and bash already had it cached as flake8. |
@ asottile, unfortunately depending on a git version in setup.py prevents publishing a package. |
it's a bit unusual to depend on pyflakes in (I also don't have pypi permission, I believe @bitglue manages that) |
Sure: Because of this overload bug, I am also depending on pyflake to get this bugfix. |
ah I see -- those dependencies aren't for your consumers so there isn't really a need to put them in |
developers are also consumers. my noxfile is also settings up in the same way. |
yeah I notice you're using pre-commit -- I'm the author (you've got it set up in a less-than-supported manner -- first you don't need when I said consumers above, I meant people that would install your package -- I understand you still want to have a developer workflow, I'm just suggesting that while |
Thanks for the pointers! didn't realize you are the author of pre-commit hooks. |
I fixed the pre-commit config for black to not use the local escape hatch, but I am not sure how to do it for flake8 given the need to install a specific revision of pyflakes. |
something like this: - repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: [-e, git+https://github.com/pycqa/pyflakes@...] |
Awesome, thanks! |
We had this TODO for a long time. That when PyCQA/pyflakes#435 made it into a release we could get rid of the noqa:F811 exceptions. We have indeed upgraded pyflakes since then and now it's doable
Resolves #434