有没有办法忽略 mypy 对单个函数的检查?

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

您可以忽略个别行的 mypy 检查,如回答 。有没有办法忽略 mypy 的完整功能?

通过在函数顶部添加 @typing.no_type_check 装饰器,可以忽略完整函数的 mypy 检查。

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