-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add Flag to Suppress Warnings for Dynamically Typed Functions #87
Comments
Suppressing |
Yes, but it doesn't give any violation for So, to be consistent with Mypy, I'm expecting violations for: |
i.e. Mypy assumes an implicit return type of None for |
Ok, I'm following now, sorry. Right now we don't have a mechanism for discriminating between statically and dynamically typed functions like Mypy does (not just for In the interim you could probably fake it with the |
Indeed, I actually just disabled that flag, as Mypy will complain about no return types on regular functions. It's only |
Unfortunately, that doesn't really resolve the problem, although still a nice addition to have. For me, I want to:
If there is a typed parameter, then it is considered statically typed. Mypy will infer the return type for |
Expected results:
|
Ok. I guess we'll have to take another look at your specific use case. Sorry about that. |
Hopefully I got it right this time, would you be interested in checking out the |
I cloned the branch, however I'm unsure how to make flake8 load it as a plugin.. |
@Dreamsorcerer Activate your virtual environment if you're using one and then run |
Perfect, seems to be working correctly with the extra argument enabled. |
For consistency with mypy, it would be nice to have an option/rule that behaved the same way as mypy regarding typing of
__init__()
.Currently, flake8-annotations always raises a violation if there is no return type annotation.
Mypy, however, raises an error if there are no annotations at all (as this would indicate an untyped function).
i.e. If there are any annotations on parameters, then a return type is not needed. The return type is only needed when there are no parameters in order to mark the function as statically typed.
e.g.
def __init__(self, foo: str):
anddef __init__(self) -> None:
are both correctly typed.The text was updated successfully, but these errors were encountered: