Search code examples
pythonpython-typingmypy

Is there a way to ignore mypy checks on a single function?


You can ignore mypy checks on a individual lines as answered here. Is there a way to ignore mypy for a full function?


Solution

  • mypy checks can be ignored for a full function by adding @typing.no_type_check decorator on top of the function.

    import typing
    @typing.no_type_check
    def some_function():
        ...