禁止 Mypy 注释

Gar*_*ett 12 python mypy

我从 Mypy 的表单输出中得到了大量的“注释”:

note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Run Code Online (Sandbox Code Playgroud)

check_untyped_defs = false即使在 my 中明确设置也pyproject.toml无济于事。

我怎样才能抑制这些注释?

smi*_*ido 3

You can solve this with --disable-error-code "annotation-unchecked"

除了摆脱大量终端线之外,如果您使用“junit”样式报告,并且您的 CI/Jenkins 会将此构建标记为失败,则可能需要它,即使 mypy 命令本身返回 0(成功:未发现问题)