protobuf 6.33.0__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.0.dist-info/LICENSE +32 -0
  57. protobuf-6.33.0.dist-info/METADATA +17 -0
  58. protobuf-6.33.0.dist-info/RECORD +59 -0
  59. protobuf-6.33.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,172 @@
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
+ """Provides a container for DescriptorProtos."""
9
+
10
+ __author__ = 'matthewtoia@google.com (Matt Toia)'
11
+
12
+ import warnings
13
+
14
+
15
+ class Error(Exception):
16
+ pass
17
+
18
+
19
+ class DescriptorDatabaseConflictingDefinitionError(Error):
20
+ """Raised when a proto is added with the same name & different descriptor."""
21
+
22
+
23
+ class DescriptorDatabase(object):
24
+ """A container accepting FileDescriptorProtos and maps DescriptorProtos."""
25
+
26
+ def __init__(self):
27
+ self._file_desc_protos_by_file = {}
28
+ self._file_desc_protos_by_symbol = {}
29
+
30
+ def Add(self, file_desc_proto):
31
+ """Adds the FileDescriptorProto and its types to this database.
32
+
33
+ Args:
34
+ file_desc_proto: The FileDescriptorProto to add.
35
+ Raises:
36
+ DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
37
+ add a proto with the same name but different definition than an
38
+ existing proto in the database.
39
+ """
40
+ proto_name = file_desc_proto.name
41
+ if proto_name not in self._file_desc_protos_by_file:
42
+ self._file_desc_protos_by_file[proto_name] = file_desc_proto
43
+ elif self._file_desc_protos_by_file[proto_name] != file_desc_proto:
44
+ raise DescriptorDatabaseConflictingDefinitionError(
45
+ '%s already added, but with different descriptor.' % proto_name)
46
+ else:
47
+ return
48
+
49
+ # Add all the top-level descriptors to the index.
50
+ package = file_desc_proto.package
51
+ for message in file_desc_proto.message_type:
52
+ for name in _ExtractSymbols(message, package):
53
+ self._AddSymbol(name, file_desc_proto)
54
+ for enum in file_desc_proto.enum_type:
55
+ self._AddSymbol(
56
+ ('.'.join((package, enum.name)) if package else enum.name),
57
+ file_desc_proto,
58
+ )
59
+ for enum_value in enum.value:
60
+ self._file_desc_protos_by_symbol[
61
+ '.'.join((package, enum_value.name)) if package else enum_value.name
62
+ ] = file_desc_proto
63
+ for extension in file_desc_proto.extension:
64
+ self._AddSymbol(
65
+ ('.'.join((package, extension.name)) if package else extension.name),
66
+ file_desc_proto,
67
+ )
68
+ for service in file_desc_proto.service:
69
+ self._AddSymbol(
70
+ ('.'.join((package, service.name)) if package else service.name),
71
+ file_desc_proto,
72
+ )
73
+
74
+ def FindFileByName(self, name):
75
+ """Finds the file descriptor proto by file name.
76
+
77
+ Typically the file name is a relative path ending to a .proto file. The
78
+ proto with the given name will have to have been added to this database
79
+ using the Add method or else an error will be raised.
80
+
81
+ Args:
82
+ name: The file name to find.
83
+
84
+ Returns:
85
+ The file descriptor proto matching the name.
86
+
87
+ Raises:
88
+ KeyError if no file by the given name was added.
89
+ """
90
+
91
+ return self._file_desc_protos_by_file[name]
92
+
93
+ def FindFileContainingSymbol(self, symbol):
94
+ """Finds the file descriptor proto containing the specified symbol.
95
+
96
+ The symbol should be a fully qualified name including the file descriptor's
97
+ package and any containing messages. Some examples:
98
+
99
+ 'some.package.name.Message'
100
+ 'some.package.name.Message.NestedEnum'
101
+ 'some.package.name.Message.some_field'
102
+
103
+ The file descriptor proto containing the specified symbol must be added to
104
+ this database using the Add method or else an error will be raised.
105
+
106
+ Args:
107
+ symbol: The fully qualified symbol name.
108
+
109
+ Returns:
110
+ The file descriptor proto containing the symbol.
111
+
112
+ Raises:
113
+ KeyError if no file contains the specified symbol.
114
+ """
115
+ if symbol.count('.') == 1 and symbol[0] == '.':
116
+ symbol = symbol.lstrip('.')
117
+ warnings.warn(
118
+ 'Please remove the leading "." when '
119
+ 'FindFileContainingSymbol, this will turn to error '
120
+ 'in 2026 Jan.',
121
+ RuntimeWarning,
122
+ )
123
+ try:
124
+ return self._file_desc_protos_by_symbol[symbol]
125
+ except KeyError:
126
+ # Fields, enum values, and nested extensions are not in
127
+ # _file_desc_protos_by_symbol. Try to find the top level
128
+ # descriptor. Non-existent nested symbol under a valid top level
129
+ # descriptor can also be found. The behavior is the same with
130
+ # protobuf C++.
131
+ top_level, _, _ = symbol.rpartition('.')
132
+ try:
133
+ return self._file_desc_protos_by_symbol[top_level]
134
+ except KeyError:
135
+ # Raise the original symbol as a KeyError for better diagnostics.
136
+ raise KeyError(symbol)
137
+
138
+ def FindFileContainingExtension(self, extendee_name, extension_number):
139
+ # TODO: implement this API.
140
+ return None
141
+
142
+ def FindAllExtensionNumbers(self, extendee_name):
143
+ # TODO: implement this API.
144
+ return []
145
+
146
+ def _AddSymbol(self, name, file_desc_proto):
147
+ if name in self._file_desc_protos_by_symbol:
148
+ warn_msg = ('Conflict register for file "' + file_desc_proto.name +
149
+ '": ' + name +
150
+ ' is already defined in file "' +
151
+ self._file_desc_protos_by_symbol[name].name + '"')
152
+ warnings.warn(warn_msg, RuntimeWarning)
153
+ self._file_desc_protos_by_symbol[name] = file_desc_proto
154
+
155
+
156
+ def _ExtractSymbols(desc_proto, package):
157
+ """Pulls out all the symbols from a descriptor proto.
158
+
159
+ Args:
160
+ desc_proto: The proto to extract symbols from.
161
+ package: The package containing the descriptor type.
162
+
163
+ Yields:
164
+ The fully qualified name found in the descriptor.
165
+ """
166
+ message_name = package + '.' + desc_proto.name if package else desc_proto.name
167
+ yield message_name
168
+ for nested_type in desc_proto.nested_type:
169
+ for symbol in _ExtractSymbols(nested_type, message_name):
170
+ yield symbol
171
+ for enum_type in desc_proto.enum_type:
172
+ yield '.'.join((message_name, enum_type.name))