aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/google/protobuf/pyext
diff options
context:
space:
mode:
Diffstat (limited to '.venv/lib/python3.12/site-packages/google/protobuf/pyext')
-rw-r--r--.venv/lib/python3.12/site-packages/google/protobuf/pyext/__init__.py0
-rw-r--r--.venv/lib/python3.12/site-packages/google/protobuf/pyext/cpp_message.py49
2 files changed, 49 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/google/protobuf/pyext/__init__.py b/.venv/lib/python3.12/site-packages/google/protobuf/pyext/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/google/protobuf/pyext/__init__.py
diff --git a/.venv/lib/python3.12/site-packages/google/protobuf/pyext/cpp_message.py b/.venv/lib/python3.12/site-packages/google/protobuf/pyext/cpp_message.py
new file mode 100644
index 00000000..54cfe306
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/google/protobuf/pyext/cpp_message.py
@@ -0,0 +1,49 @@
+# Protocol Buffers - Google's data interchange format
+# Copyright 2008 Google Inc. All rights reserved.
+#
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Protocol message implementation hooks for C++ implementation.
+
+Contains helper functions used to create protocol message classes from
+Descriptor objects at runtime backed by the protocol buffer C++ API.
+"""
+
+__author__ = 'tibell@google.com (Johan Tibell)'
+
+from google.protobuf.internal import api_implementation
+
+
+# pylint: disable=protected-access
+_message = api_implementation._c_module
+# TODO: Remove this import after fix api_implementation
+if _message is None:
+ from google.protobuf.pyext import _message
+
+
+class GeneratedProtocolMessageType(_message.MessageMeta):
+
+ """Metaclass for protocol message classes created at runtime from Descriptors.
+
+ The protocol compiler currently uses this metaclass to create protocol
+ message classes at runtime. Clients can also manually create their own
+ classes at runtime, as in this example:
+
+ mydescriptor = Descriptor(.....)
+ factory = symbol_database.Default()
+ factory.pool.AddDescriptor(mydescriptor)
+ MyProtoClass = message_factory.GetMessageClass(mydescriptor)
+ myproto_instance = MyProtoClass()
+ myproto.foo_field = 23
+ ...
+
+ The above example will not work for nested types. If you wish to include them,
+ use reflection.MakeClass() instead of manually instantiating the class in
+ order to create the appropriate class structure.
+ """
+
+ # Must be consistent with the protocol-compiler code in
+ # proto2/compiler/internal/generator.*.
+ _DESCRIPTOR_KEY = 'DESCRIPTOR'