protobuf 6.33.0rc1__cp39-abi3-manylinux2014_s390x.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of protobuf might be problematic. Click here for more details.

Files changed (59) hide show
  1. google/_upb/_message.abi3.so +0 -0
  2. google/protobuf/__init__.py +10 -0
  3. google/protobuf/any.py +53 -0
  4. google/protobuf/any_pb2.py +37 -0
  5. google/protobuf/api_pb2.py +47 -0
  6. google/protobuf/compiler/__init__.py +0 -0
  7. google/protobuf/compiler/plugin_pb2.py +46 -0
  8. google/protobuf/descriptor.py +1676 -0
  9. google/protobuf/descriptor_database.py +172 -0
  10. google/protobuf/descriptor_pb2.py +3363 -0
  11. google/protobuf/descriptor_pool.py +1370 -0
  12. google/protobuf/duration.py +100 -0
  13. google/protobuf/duration_pb2.py +37 -0
  14. google/protobuf/empty_pb2.py +37 -0
  15. google/protobuf/field_mask_pb2.py +37 -0
  16. google/protobuf/internal/__init__.py +7 -0
  17. google/protobuf/internal/api_implementation.py +136 -0
  18. google/protobuf/internal/builder.py +118 -0
  19. google/protobuf/internal/containers.py +690 -0
  20. google/protobuf/internal/decoder.py +1066 -0
  21. google/protobuf/internal/encoder.py +806 -0
  22. google/protobuf/internal/enum_type_wrapper.py +112 -0
  23. google/protobuf/internal/extension_dict.py +194 -0
  24. google/protobuf/internal/field_mask.py +312 -0
  25. google/protobuf/internal/message_listener.py +55 -0
  26. google/protobuf/internal/python_edition_defaults.py +5 -0
  27. google/protobuf/internal/python_message.py +1599 -0
  28. google/protobuf/internal/testing_refleaks.py +128 -0
  29. google/protobuf/internal/type_checkers.py +455 -0
  30. google/protobuf/internal/well_known_types.py +695 -0
  31. google/protobuf/internal/wire_format.py +245 -0
  32. google/protobuf/json_format.py +1111 -0
  33. google/protobuf/message.py +448 -0
  34. google/protobuf/message_factory.py +190 -0
  35. google/protobuf/proto.py +153 -0
  36. google/protobuf/proto_builder.py +111 -0
  37. google/protobuf/proto_json.py +83 -0
  38. google/protobuf/proto_text.py +129 -0
  39. google/protobuf/pyext/__init__.py +0 -0
  40. google/protobuf/pyext/cpp_message.py +49 -0
  41. google/protobuf/reflection.py +36 -0
  42. google/protobuf/runtime_version.py +104 -0
  43. google/protobuf/service_reflection.py +272 -0
  44. google/protobuf/source_context_pb2.py +37 -0
  45. google/protobuf/struct_pb2.py +47 -0
  46. google/protobuf/symbol_database.py +179 -0
  47. google/protobuf/testdata/__init__.py +0 -0
  48. google/protobuf/text_encoding.py +106 -0
  49. google/protobuf/text_format.py +1884 -0
  50. google/protobuf/timestamp.py +112 -0
  51. google/protobuf/timestamp_pb2.py +37 -0
  52. google/protobuf/type_pb2.py +53 -0
  53. google/protobuf/unknown_fields.py +96 -0
  54. google/protobuf/util/__init__.py +0 -0
  55. google/protobuf/wrappers_pb2.py +53 -0
  56. protobuf-6.33.0rc1.dist-info/LICENSE +32 -0
  57. protobuf-6.33.0rc1.dist-info/METADATA +17 -0
  58. protobuf-6.33.0rc1.dist-info/RECORD +59 -0
  59. protobuf-6.33.0rc1.dist-info/WHEEL +4 -0
@@ -0,0 +1,100 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ #
4
+ # Use of this source code is governed by a BSD-style
5
+ # license that can be found in the LICENSE file or at
6
+ # https://developers.google.com/open-source/licenses/bsd
7
+
8
+ """Contains the Duration helper APIs."""
9
+
10
+ import datetime
11
+
12
+ from google.protobuf.duration_pb2 import Duration
13
+
14
+
15
+ def from_json_string(value: str) -> Duration:
16
+ """Converts a string to Duration.
17
+
18
+ Args:
19
+ value: A string to be converted. The string must end with 's'. Any
20
+ fractional digits (or none) are accepted as long as they fit into
21
+ precision. For example: "1s", "1.01s", "1.0000001s", "-3.100s"
22
+
23
+ Raises:
24
+ ValueError: On parsing problems.
25
+ """
26
+ duration = Duration()
27
+ duration.FromJsonString(value)
28
+ return duration
29
+
30
+
31
+ def from_microseconds(micros: float) -> Duration:
32
+ """Converts microseconds to Duration."""
33
+ duration = Duration()
34
+ duration.FromMicroseconds(micros)
35
+ return duration
36
+
37
+
38
+ def from_milliseconds(millis: float) -> Duration:
39
+ """Converts milliseconds to Duration."""
40
+ duration = Duration()
41
+ duration.FromMilliseconds(millis)
42
+ return duration
43
+
44
+
45
+ def from_nanoseconds(nanos: float) -> Duration:
46
+ """Converts nanoseconds to Duration."""
47
+ duration = Duration()
48
+ duration.FromNanoseconds(nanos)
49
+ return duration
50
+
51
+
52
+ def from_seconds(seconds: float) -> Duration:
53
+ """Converts seconds to Duration."""
54
+ duration = Duration()
55
+ duration.FromSeconds(seconds)
56
+ return duration
57
+
58
+
59
+ def from_timedelta(td: datetime.timedelta) -> Duration:
60
+ """Converts timedelta to Duration."""
61
+ duration = Duration()
62
+ duration.FromTimedelta(td)
63
+ return duration
64
+
65
+
66
+ def to_json_string(duration: Duration) -> str:
67
+ """Converts Duration to string format.
68
+
69
+ Returns:
70
+ A string converted from self. The string format will contains
71
+ 3, 6, or 9 fractional digits depending on the precision required to
72
+ represent the exact Duration value. For example: "1s", "1.010s",
73
+ "1.000000100s", "-3.100s"
74
+ """
75
+ return duration.ToJsonString()
76
+
77
+
78
+ def to_microseconds(duration: Duration) -> int:
79
+ """Converts a Duration to microseconds."""
80
+ return duration.ToMicroseconds()
81
+
82
+
83
+ def to_milliseconds(duration: Duration) -> int:
84
+ """Converts a Duration to milliseconds."""
85
+ return duration.ToMilliseconds()
86
+
87
+
88
+ def to_nanoseconds(duration: Duration) -> int:
89
+ """Converts a Duration to nanoseconds."""
90
+ return duration.ToNanoseconds()
91
+
92
+
93
+ def to_seconds(duration: Duration) -> int:
94
+ """Converts a Duration to seconds."""
95
+ return duration.ToSeconds()
96
+
97
+
98
+ def to_timedelta(duration: Duration) -> datetime.timedelta:
99
+ """Converts Duration to timedelta."""
100
+ return duration.ToTimedelta()
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: google/protobuf/duration.proto
5
+ # Protobuf Python Version: 6.33.0-rc1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 33,
16
+ 0,
17
+ '-rc1',
18
+ 'google/protobuf/duration.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobuf/duration.proto\x12\x0fgoogle.protobuf\":\n\x08\x44uration\x12\x18\n\x07seconds\x18\x01 \x01(\x03R\x07seconds\x12\x14\n\x05nanos\x18\x02 \x01(\x05R\x05nanosB\x83\x01\n\x13\x63om.google.protobufB\rDurationProtoP\x01Z1google.golang.org/protobuf/types/known/durationpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.duration_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\rDurationProtoP\001Z1google.golang.org/protobuf/types/known/durationpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
35
+ _globals['_DURATION']._serialized_start=51
36
+ _globals['_DURATION']._serialized_end=109
37
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: google/protobuf/empty.proto
5
+ # Protobuf Python Version: 6.33.0-rc1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 33,
16
+ 0,
17
+ '-rc1',
18
+ 'google/protobuf/empty.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\x07\n\x05\x45mptyB}\n\x13\x63om.google.protobufB\nEmptyProtoP\x01Z.google.golang.org/protobuf/types/known/emptypb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.empty_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\nEmptyProtoP\001Z.google.golang.org/protobuf/types/known/emptypb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
35
+ _globals['_EMPTY']._serialized_start=48
36
+ _globals['_EMPTY']._serialized_end=55
37
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: google/protobuf/field_mask.proto
5
+ # Protobuf Python Version: 6.33.0-rc1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 33,
16
+ 0,
17
+ '-rc1',
18
+ 'google/protobuf/field_mask.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/field_mask.proto\x12\x0fgoogle.protobuf\"!\n\tFieldMask\x12\x14\n\x05paths\x18\x01 \x03(\tR\x05pathsB\x85\x01\n\x13\x63om.google.protobufB\x0e\x46ieldMaskProtoP\x01Z2google.golang.org/protobuf/types/known/fieldmaskpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.field_mask_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\016FieldMaskProtoP\001Z2google.golang.org/protobuf/types/known/fieldmaskpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
35
+ _globals['_FIELDMASK']._serialized_start=53
36
+ _globals['_FIELDMASK']._serialized_end=86
37
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,7 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ #
4
+ # Use of this source code is governed by a BSD-style
5
+ # license that can be found in the LICENSE file or at
6
+ # https://developers.google.com/open-source/licenses/bsd
7
+
@@ -0,0 +1,136 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ #
4
+ # Use of this source code is governed by a BSD-style
5
+ # license that can be found in the LICENSE file or at
6
+ # https://developers.google.com/open-source/licenses/bsd
7
+
8
+ """Determine which implementation of the protobuf API is used in this process.
9
+ """
10
+
11
+ import importlib
12
+ import os
13
+ import sys
14
+ import warnings
15
+
16
+ _GOOGLE3_PYTHON_UPB_DEFAULT = True
17
+
18
+
19
+ def _ApiVersionToImplementationType(api_version):
20
+ if api_version == 2:
21
+ return 'cpp'
22
+ if api_version == 1:
23
+ raise ValueError('api_version=1 is no longer supported.')
24
+ if api_version == 0:
25
+ return 'python'
26
+ return None
27
+
28
+
29
+ _implementation_type = None
30
+ try:
31
+ # pylint: disable=g-import-not-at-top
32
+ from google.protobuf.internal import _api_implementation
33
+ # The compile-time constants in the _api_implementation module can be used to
34
+ # switch to a certain implementation of the Python API at build time.
35
+ _implementation_type = _ApiVersionToImplementationType(
36
+ _api_implementation.api_version)
37
+ except ImportError:
38
+ pass # Unspecified by compiler flags.
39
+
40
+
41
+ def _CanImport(mod_name):
42
+ try:
43
+ mod = importlib.import_module(mod_name)
44
+ # Work around a known issue in the classic bootstrap .par import hook.
45
+ if not mod:
46
+ raise ImportError(mod_name + ' import succeeded but was None')
47
+ return True
48
+ except ImportError:
49
+ return False
50
+
51
+
52
+ if _implementation_type is None:
53
+ if _CanImport('google._upb._message'):
54
+ _implementation_type = 'upb'
55
+ elif _CanImport('google.protobuf.pyext._message'):
56
+ _implementation_type = 'cpp'
57
+ else:
58
+ _implementation_type = 'python'
59
+
60
+
61
+ # This environment variable can be used to switch to a certain implementation
62
+ # of the Python API, overriding the compile-time constants in the
63
+ # _api_implementation module. Right now only 'python', 'cpp' and 'upb' are
64
+ # valid values. Any other value will raise error.
65
+ _implementation_type = os.getenv('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION',
66
+ _implementation_type)
67
+
68
+ if _implementation_type not in ('python', 'cpp', 'upb'):
69
+ raise ValueError('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION {0} is not '
70
+ 'supported. Please set to \'python\', \'cpp\' or '
71
+ '\'upb\'.'.format(_implementation_type))
72
+
73
+ if 'PyPy' in sys.version and _implementation_type == 'cpp':
74
+ warnings.warn('PyPy does not work yet with cpp protocol buffers. '
75
+ 'Falling back to the python implementation.')
76
+ _implementation_type = 'python'
77
+
78
+ _c_module = None
79
+
80
+ if _implementation_type == 'cpp':
81
+ try:
82
+ # pylint: disable=g-import-not-at-top
83
+ from google.protobuf.pyext import _message
84
+ sys.modules['google3.net.proto2.python.internal.cpp._message'] = _message
85
+ _c_module = _message
86
+ del _message
87
+ except ImportError:
88
+ # TODO: fail back to python
89
+ warnings.warn(
90
+ 'Selected implementation cpp is not available.')
91
+ pass
92
+
93
+ if _implementation_type == 'upb':
94
+ try:
95
+ # pylint: disable=g-import-not-at-top
96
+ from google._upb import _message
97
+ _c_module = _message
98
+ del _message
99
+ except ImportError:
100
+ warnings.warn('Selected implementation upb is not available. '
101
+ 'Falling back to the python implementation.')
102
+ _implementation_type = 'python'
103
+ pass
104
+
105
+ # Detect if serialization should be deterministic by default
106
+ try:
107
+ # The presence of this module in a build allows the proto implementation to
108
+ # be upgraded merely via build deps.
109
+ #
110
+ # NOTE: Merely importing this automatically enables deterministic proto
111
+ # serialization for C++ code, but we still need to export it as a boolean so
112
+ # that we can do the same for `_implementation_type == 'python'`.
113
+ #
114
+ # NOTE2: It is possible for C++ code to enable deterministic serialization by
115
+ # default _without_ affecting Python code, if the C++ implementation is not in
116
+ # use by this module. That is intended behavior, so we don't actually expose
117
+ # this boolean outside of this module.
118
+ #
119
+ # pylint: disable=g-import-not-at-top,unused-import
120
+ from google.protobuf import enable_deterministic_proto_serialization
121
+ _python_deterministic_proto_serialization = True
122
+ except ImportError:
123
+ _python_deterministic_proto_serialization = False
124
+
125
+
126
+ # Usage of this function is discouraged. Clients shouldn't care which
127
+ # implementation of the API is in use. Note that there is no guarantee
128
+ # that differences between APIs will be maintained.
129
+ # Please don't use this function if possible.
130
+ def Type():
131
+ return _implementation_type
132
+
133
+
134
+ # For internal use only
135
+ def IsPythonDefaultSerializationDeterministic():
136
+ return _python_deterministic_proto_serialization
@@ -0,0 +1,118 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ #
4
+ # Use of this source code is governed by a BSD-style
5
+ # license that can be found in the LICENSE file or at
6
+ # https://developers.google.com/open-source/licenses/bsd
7
+
8
+ """Builds descriptors, message classes and services for generated _pb2.py.
9
+
10
+ This file is only called in python generated _pb2.py files. It builds
11
+ descriptors, message classes and services that users can directly use
12
+ in generated code.
13
+ """
14
+
15
+ __author__ = 'jieluo@google.com (Jie Luo)'
16
+
17
+ from google.protobuf.internal import enum_type_wrapper
18
+ from google.protobuf.internal import python_message
19
+ from google.protobuf import message as _message
20
+ from google.protobuf import reflection as _reflection
21
+ from google.protobuf import symbol_database as _symbol_database
22
+
23
+ _sym_db = _symbol_database.Default()
24
+
25
+
26
+ def BuildMessageAndEnumDescriptors(file_des, module):
27
+ """Builds message and enum descriptors.
28
+
29
+ Args:
30
+ file_des: FileDescriptor of the .proto file
31
+ module: Generated _pb2 module
32
+ """
33
+
34
+ def BuildNestedDescriptors(msg_des, prefix):
35
+ for (name, nested_msg) in msg_des.nested_types_by_name.items():
36
+ module_name = prefix + name.upper()
37
+ module[module_name] = nested_msg
38
+ BuildNestedDescriptors(nested_msg, module_name + '_')
39
+ for enum_des in msg_des.enum_types:
40
+ module[prefix + enum_des.name.upper()] = enum_des
41
+
42
+ for (name, msg_des) in file_des.message_types_by_name.items():
43
+ module_name = '_' + name.upper()
44
+ module[module_name] = msg_des
45
+ BuildNestedDescriptors(msg_des, module_name + '_')
46
+
47
+
48
+ def BuildTopDescriptorsAndMessages(file_des, module_name, module):
49
+ """Builds top level descriptors and message classes.
50
+
51
+ Args:
52
+ file_des: FileDescriptor of the .proto file
53
+ module_name: str, the name of generated _pb2 module
54
+ module: Generated _pb2 module
55
+ """
56
+
57
+ def BuildMessage(msg_des, prefix):
58
+ create_dict = {}
59
+ for (name, nested_msg) in msg_des.nested_types_by_name.items():
60
+ create_dict[name] = BuildMessage(nested_msg, prefix + msg_des.name + '.')
61
+ create_dict['DESCRIPTOR'] = msg_des
62
+ create_dict['__module__'] = module_name
63
+ create_dict['__qualname__'] = prefix + msg_des.name
64
+ message_class = _reflection.GeneratedProtocolMessageType(
65
+ msg_des.name, (_message.Message,), create_dict)
66
+ _sym_db.RegisterMessage(message_class)
67
+ return message_class
68
+
69
+ # top level enums
70
+ for (name, enum_des) in file_des.enum_types_by_name.items():
71
+ module['_' + name.upper()] = enum_des
72
+ module[name] = enum_type_wrapper.EnumTypeWrapper(enum_des)
73
+ for enum_value in enum_des.values:
74
+ module[enum_value.name] = enum_value.number
75
+
76
+ # top level extensions
77
+ for (name, extension_des) in file_des.extensions_by_name.items():
78
+ module[name.upper() + '_FIELD_NUMBER'] = extension_des.number
79
+ module[name] = extension_des
80
+
81
+ # services
82
+ for (name, service) in file_des.services_by_name.items():
83
+ module['_' + name.upper()] = service
84
+
85
+ # Build messages.
86
+ for (name, msg_des) in file_des.message_types_by_name.items():
87
+ module[name] = BuildMessage(msg_des, '')
88
+
89
+
90
+ def AddHelpersToExtensions(file_des):
91
+ """no-op to keep old generated code work with new runtime.
92
+
93
+ Args:
94
+ file_des: FileDescriptor of the .proto file
95
+ """
96
+ # TODO: Remove this on-op
97
+ return
98
+
99
+
100
+ def BuildServices(file_des, module_name, module):
101
+ """Builds services classes and services stub class.
102
+
103
+ Args:
104
+ file_des: FileDescriptor of the .proto file
105
+ module_name: str, the name of generated _pb2 module
106
+ module: Generated _pb2 module
107
+ """
108
+ # pylint: disable=g-import-not-at-top
109
+ from google.protobuf import service_reflection
110
+ # pylint: enable=g-import-not-at-top
111
+ for (name, service) in file_des.services_by_name.items():
112
+ module[name] = service_reflection.GeneratedServiceType(
113
+ name, (),
114
+ dict(DESCRIPTOR=service, __module__=module_name))
115
+ stub_name = name + '_Stub'
116
+ module[stub_name] = service_reflection.GeneratedServiceStubType(
117
+ stub_name, (module[name],),
118
+ dict(DESCRIPTOR=service, __module__=module_name))