Skip to content

False positive 'Too many arguments' error #9069

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

Closed
ciaranby opened this issue Jun 29, 2020 · 1 comment
Closed

False positive 'Too many arguments' error #9069

ciaranby opened this issue Jun 29, 2020 · 1 comment

Comments

@ciaranby
Copy link

Mypy seems to treat keyword argument unpacking as containing at least one element. For example:

from typing import Dict
  
class Foo:
    pass

args: Dict[str, str] = {}
packet = Foo(**args)
test.py:7: error: Too many arguments for "Foo"

In my case I have a function which retrieves the args dict for many classes and will give an empty dict when there are no arguments required. Mypy still complains though since it assumes the dict is not empty.

Using mypy==0.782 and 3.7.4 with no mypy flags.

A similar issue was resolved here but seems to have only solved for list or tuple unpacking.

@JelleZijlstra
Copy link
Member

Duplicate of #9007.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants