有没有办法完全忽略特定项目包中的所有 MyPy 错误? [英] Is there a way to totally ignore all of the MyPy errors in specific project packages?

查看:37
本文介绍了有没有办法完全忽略特定项目包中的所有 MyPy 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法忽略我项目中某些包中的所有错误?

Is there a way to ignore all of the errors in certain packages within my project?

我项目中的一些代码是编译后的 Protocol Buffers 代码,它没有通过 MyPy 检查.它都位于目录/myproj/generated/proto 中.

Some of the code in my project is compiled Protocol Buffers code which doesn't pass a MyPy check. It all lives within a directory /myproj/generated/proto.

这是我的 mypy 配置文件中的内容:

Here's what I have in my mypy config file:

[mypy-myproject.generated]
ignore_missing_imports = True
ignore_errors = True

我可以添加什么以使其忽略通过分析 myproject.generated 中的任何内容而生成的所有错误消息?

What can I add to this to make it ignore all error messages generated from an analysis of anything that's inside of myproject.generated?

这是一个 GitHub 上的问题的副本.

推荐答案

您可以使用 glob.

You can use a glob.

[mypy-myproject.generated.*]
ignore_errors = True

但是你必须确保你在/generated

这篇关于有没有办法完全忽略特定项目包中的所有 MyPy 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆