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

Exclude *args and **kwargs from ANN401 #135

Closed
jpy-git opened this issue Mar 31, 2022 · 1 comment · Fixed by #136
Closed

Exclude *args and **kwargs from ANN401 #135

jpy-git opened this issue Mar 31, 2022 · 1 comment · Fixed by #136
Labels
enhancement New feature or request
Milestone

Comments

@jpy-git
Copy link

jpy-git commented Mar 31, 2022

Describe the bug
I like the new ANN401 rule added in the v2.8.0 release.

However, one place where it's pretty common to use Any is in annotations for *args and **kwargs since they often (not always) can take mulitple types.

To Reproduce

def foo(*args: Any, **kwargs: Any): ...

gives

test.py:1:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed
test.py:1:23: ANN401 Dynamically typed expressions (typing.Any) are disallowed

Could we make checking these either an option to ANN401 or we could exclude them from ANN401 and make ANN402 should someone want to disallow Any for these unpackings?

Version Information

$ flake8 --version
4.0.1 (black: 0.2.3, flake8-annotations: 2.8.0, flake8-bugbear: 22.3.23,
flake8-docstrings: 1.6.0, pydocstyle: 6.1.1, mccabe: 0.6.1, pycodestyle:
2.8.0, pyflakes: 2.4.0) CPython 3.7.13 on Darwin

As well as your Python version:

$ python -V
Python 3.9.12
@jpy-git jpy-git added the bug Something isn't working label Mar 31, 2022
@sco1 sco1 added enhancement New feature or request and removed bug Something isn't working labels Mar 31, 2022
@sco1 sco1 added this to the 2.8.1 milestone Mar 31, 2022
@sco1
Copy link
Owner

sco1 commented Mar 31, 2022

I think this should be fairly straightforward, since the argument type is already being classified. I'll have to think about what error code approach I like best for the adjustment.

@sco1 sco1 mentioned this issue Apr 4, 2022
@sco1 sco1 closed this as completed in #136 Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants