Skip to content

Exclude *args and **kwargs from ANN401 #135

@jpy-git

Description

@jpy-git

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions