✏️ 正在编辑: python_message.cpython-36.pyc
路径:
/usr/lib/python3.6/site-packages/google/protobuf/internal/__pycache__/python_message.cpython-36.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
3 ���h� � @ s� d Z dZddlmZ ddlZddlZddlZddlZddlm Z ddlm Z ddlmZ ddlmZ dd lm Z dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ejZdZG dd� de�Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#d d!� Z$d"d#� Z%d$d%� Z&d&d'� Z'd(d)� Z(d*d+� Z)d,d-� Z*d.d/� Z+d0d1� Z,d2d3� Z-d4d5� Z.d6d7� Z/d8d9� Z0d:d;� Z1d<d=� Z2d>d?� Z3d@dA� Z4dBZ5dCZ6dDdE� Z7dFdG� Z8dHdI� Z9dJdK� Z:dLdM� Z;dNdO� Z<dPdQ� Z=dRdS� Z>dTdU� Z?dVdW� Z@dXdY� ZAdZd[� ZBd\d]� ZCd^d_� ZDd`da� ZEdbdc� ZFddde� ZGdfdg� ZHdhdi� ZIdjdk� ZJdldm� ZKdndo� ZLdpdq� ZMG drds� dseN�ZOG dtdu� dueO�ZPG dvdw� dweN�ZQdS )xa Contains a metaclass and helper functions used to create protocol message classes from Descriptor objects at runtime. Recall that a metaclass is the "type" of a class. (A class is to a metaclass what an instance is to a class.) In this case, we use the GeneratedProtocolMessageType metaclass to inject all the useful functionality into the classes output by the protocol compiler at compile-time. The upshot of all this is that the real implementation details for ALL pure-Python protocol buffers are *here in this file*. z#robinson@google.com (Will Robinson)� )�BytesION)�api_implementation)� containers)�decoder)�encoder)�enum_type_wrapper)�message_listener)� type_checkers)�well_known_types)�wire_format)� descriptor)�message)�text_formatzgoogle.protobuf.Anyc s0 e Zd ZdZdZ� fdd�Z� fdd�Z� ZS )�GeneratedProtocolMessageTypeaQ Metaclass for protocol message classes created at runtime from Descriptors. We add implementations for all methods described in the Message class. We also create properties to allow getting/setting all fields in the protocol message. Finally, we create slots to prevent users from accidentally "setting" nonexistent fields in the protocol message, which then wouldn't get serialized / deserialized properly. 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 = factory.GetPrototype(mydescriptor) myproto_instance = MyProtoClass() myproto.foo_field = 23 ... � DESCRIPTORc sZ |t j }|jtjkr(|tj|j f7 }t||� t||� tt | �}|j| |||�}|S )a Custom allocation for runtime-generated class types. We override __new__ because this is apparently the only place where we can meaningfully set __slots__ on the class we're creating(?). (The interplay between metaclasses and slots is not very well-documented). Args: name: Name of the class (ignored, but required by the metaclass protocol). bases: Base classes of the class we're constructing. (Should be message.Message). We ignore this field, but it's required by the metaclass protocol dictionary: The class dictionary of the class we're constructing. dictionary[_DESCRIPTOR_KEY] must contain a Descriptor object describing this protocol message type. Returns: Newly-allocated class. ) r �_DESCRIPTOR_KEY� full_namer ZWKTBASES�&_AddClassAttributesForNestedExtensions� _AddSlots�super�__new__)�cls�name�bases� dictionaryr � superclass� new_class)� __class__� �$/usr/lib/python3.6/python_message.pyr i s z$GeneratedProtocolMessageType.__new__c s� |t j }i | _|jr6|j� jr6tj|�df| jtj<