Ignore typehinting for line that already has a pylint ignore

Viewed 212

I'm wondering how to go about ignoring the mypy error for the following:

# check.py
def add(a, b):  # pylint: disable=invalid-name
    return a + b

running mypy . --strict will raise the following:

check.py:1: error: Function is missing a type annotation

So, how do i ignore typing for this line as well as pylint?

1 Answers

As per PEP 484, disabling mypy first, then pylance, should work:

def add(a, b):  # type: ignore # pylint: disable=invalid-name
    return a + b
Related