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