使pylint知道protobuf生成类的字段的插件

pylint-protobuf的Python项目详细描述


Pylint协议

pylint-protobuf是一个Pylint插件,用于使Pylint知道生成的 protobuf类型的字段。

用法

$ cat <<EOF >person.proto
message Person {
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;
}
EOF
$ cat <<EOF >example.py
from person_pb2 import Person
a = Person()
a.invalid_field = 123
EOF
$ protoc person.proto --python_out=.
$ pip install pylint-protobuf
$ pylint --load-plugin=pylint_protobuf example.py
************* Module example
E:  4, 0: Field 'invalid_field' does not appear in the declared fields of
protobuf-generated class 'Person' and will raise AttributeError on access
(protobuf-undefined-attribute)

------------------------------------
Your code has been rated at -6.67/10

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
多次调用预期方法的java捕获参数(EasyMock)   java我试图得到某个学生的平均值,但它将所有值相加   使用Java更新文件中所有出现的字符串   java从依赖包导入Spring配置(*.xml)   在Java中,如何从不同的偏移量读取大块的字符串文件?   java 安卓 studio未在windows 8中运行   java getResourceAsStream()不读取任何内容   java Google Collections 1.0是否已经专业化?   模型视图控制器ASP。NET母版页在Java中的等效性   计时器TimerTask类在java中只能运行一次   多级继承和foreach Java循环   excel csv到xsl java,有一列带有某种货币(如$400)   java在来电时多次更改BlackBerry的callIncoming()   java通过JNLP启动JavaFX2.0应用程序会引发异常