Mypy: Ignoring error does not work for "Unexpected keyword argument"

Created on 9 May 2019  路  2Comments  路  Source: python/mypy

# typing: ignore is a way to ignore MyPy errors. But it does not work for the "Unexpected keyword argument" error. So I cannot silence errors in typeshed (see https://github.com/python/typeshed/issues/2976).

$ cat a.py
def foo() -> None:
    pass

foo(a=1)  # typing: ignore

$ mypy a.py
a.py:1: note: "foo" defined here
a.py:4: error: Unexpected keyword argument "a" for "foo"

$ mypy --version
mypy 0.701

Is there other workaround?

question

All 2 comments

@serhiy-storchaka the spelling is # type: ignore, not # typing: ignore. (I verified just in case that # type: ignore does silence the error in your example).

Thanks @ethanhs!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tjltjl picture tjltjl  路  35Comments

JukkaL picture JukkaL  路  41Comments

Starwort picture Starwort  路  32Comments

snakescott picture snakescott  路  27Comments

msullivan picture msullivan  路  26Comments