We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent adc1f93 commit 0707f2eCopy full SHA for 0707f2e
python/google/protobuf/internal/enum_type_wrapper.py
@@ -43,6 +43,15 @@ class EnumTypeWrapper(object):
43
44
DESCRIPTOR = None
45
46
+ # This is a type alias, which mypy typing stubs can type as
47
+ # a genericized parameter constrained to an int, allowing subclasses
48
+ # to be typed with more constraint in .pyi stubs
49
+ # Eg.
50
+ # def MyGeneratedEnum(Message):
51
+ # ValueType = NewType('ValueType', int)
52
+ # def Name(self, number: MyGeneratedEnum.ValueType) -> str
53
+ ValueType = int
54
+
55
def __init__(self, enum_type):
56
"""Inits EnumTypeWrapper with an EnumDescriptor."""
57
self._enum_type = enum_type
0 commit comments