Skip to content

False positive 'Too many arguments' error #9069

Closed
@ciaranby

Description

@ciaranby

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions