Skip to content

CIMultiDict: No overload variant of "get" of "Mapping" matches argument type "str" #687

@ewjoachim

Description

@ewjoachim

Long story short

CIMultiDict().get("str") fails in mypy

Expected behaviour

import multidict

a = multidict.CIMultiDict({"a": "b"})

a.get("Hey")

Should pass in mypy

Actual behaviour

foo.py:5: error: No overload variant of "get" of "Mapping" matches argument type "str"
foo.py:5: note: Possible overload variants:
foo.py:5: note:     def get(self, key: istr) -> Optional[str]
foo.py:5: note:     def [_T] get(self, istr, Union[str, _T]) -> Union[str, _T]

Steps to reproduce

Write the above code in foo.py, run mypy foo.py with the most recent multidict & mypy

Your environment

Python 3.8.10

mypy==0.931
multidict==6.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions