Name, Value, keys, and values. However pylint-protobuf 0.14.1 doesn't seem to recognize these.
Consider:
$ cat direction.proto
syntax = "proto3";
enum Direction {
UP = 0;
DOWN = 1;
}
$ protoc direction.proto --python_out=.
$ cat test.py
"""
Enum Test!
"""
from direction_pb2 import Direction
print(Direction.Name(Direction.UP))
$ python test.py
UP
but:
$ pylint test.py
************* Module test
test.py:7:6: E5901: Field 'Name' does not appear in the declared fields of protobuf-generated class 'Direction' and will raise AttributeError on access (protobuf-undefined-attribute)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
enum
protobuf messages are implemented asEnumTypeWrapper
python class, which adds several special methods:https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/internal/enum_type_wrapper.py#L43-L106
Name
,Value
,keys
, andvalues
. Howeverpylint-protobuf
0.14.1 doesn't seem to recognize these.Consider:
but: