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
Overloaded functions and methods with type annotations trigger F811 #230
Comments
In GitLab by @wjwwood on May 23, 2018, 23:20 changed the description |
In GitLab by @asottile on Oct 13, 2018, 18:09 This is an issue with upstream pyflakes -- I'd suggest following this issue |
In GitLab by @asottile on Oct 23, 2018, 23:51 (closing given the pyflakes issue) |
In GitLab by @asottile on Oct 23, 2018, 23:51 closed |
In GitLab by @erichiller on Jan 27, 2019, 10:53 It appears the issue has been resolved, and new PyFlakes 2.1.0 released, but I am still having the same issue with Overloads getting F811 |
In GitLab by @asottile on Jan 27, 2019, 11:00 We have not made a release enabling the new pyflakes yet. It's in progress though, I'm currently waiting on pycodestyle to make a release as well so we can batch up the bumps in the same release |
In GitLab by @Melevir on May 13, 2019, 22:35
Any progress here? Maybe I can help somehow? |
In GitLab by @asottile on May 14, 2019, 24:31 Yes it's fixed, please upgrade to latest |
In GitLab by @douardda1 on Apr 2, 2020, 08:17 Looks to me it's not fixed for methods. Am I missing something? Given a python3.7 (3.7.3, debian buster) venv in which I have:
and this 'test.py' file: from typing import overload
@overload
def test1(arg: str) -> None:
...
@overload
def test1(arg: int) -> None:
...
def test1(arg) -> None:
print(arg)
class A:
@overload
def test1(self, arg: str) -> None:
...
@overload
def test1(self, arg: int) -> None:
...
def test1(self, arg) -> None:
print(arg) then:
Thanks, |
In GitLab by @asottile on Apr 2, 2020, 08:19 it's fixed on master in pyflakes |
In GitLab by @douardda1 on Apr 2, 2020, 08:45 I guess this might answer my next question :-) Thanks |
In GitLab by @adithyabsk on Apr 11, 2020, 19:41 @asottile Can we leave this issue open until the version of pyflakes is updated? It'll help with people tracking this issue. |
In GitLab by @asottile on Apr 11, 2020, 19:49
|
In GitLab by @adithyabsk on Apr 11, 2020, 19:53 I guess that's fair enough. |
In GitLab by @asottile on Apr 11, 2020, 19:56 consider also watching !417 for pyflakes specifically, though I'm not sure that helps you all that much |
In GitLab by @adithyabsk on Apr 11, 2020, 19:58 @asottile Actually's that more helpful and what I was looking for. I can peg to master once that's merged in. |
In GitLab by @wjwwood on May 23, 2018, 23:20
I installed
flake8
with:I ran my examples on macOS 10.13.3 using
Python 3.6.5
from Homebrew.Please provide the exact, unmodified output of
flake8 --bug-report
Feature request or bug report:
When using type annotations (Python 3.5+), you can use the
typing.overload
decorator to redefine functions or methods in order to express how different overloads can map to different return types. Here's a working example based on the example from the Python documentation (https://docs.python.org/3/library/typing.html#typing.overload):If you run this (
python3 ./example.py
) it works:But if you run
flake8
on it you getF811
triggered:Which I suppose makes sense, and I could disable this check explicitly, but I also think it's a valid use case and pattern so it would be nice if flake8 could use the
@overload
decorator as a hint to suppressF811
automatically.The text was updated successfully, but these errors were encountered: