Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/google/protobuf/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/google/protobuf/__pycache__/descriptor.cpython-38.pyc
U

N��g��@s�dZdZddlZddlZddlZddlZddlZddlmZdZ	e�
�dkrjejZedkrfddl
mZdZ	Gd	d
�d
e�ZGdd�de�Ze	r�Gd
d�de�ZnejZGdd�de�Ze��Zdd�ZdZdZdZdZdZde_e�ZGdd�ded�Z Gdd�de �Z!Gdd�de!�Z"Gdd�de �Z#Gd d!�d!e!�Z$Gd"d#�d#e �Z%Gd$d%�d%e �Z&Gd&d'�d'e!�Z'Gd(d)�d)e �Z(Gd*d+�d+e �Z)d,d-�Z*d.d/�Z+d0d1�Z,d2d3�Z-d7d5d6�Z.dS)8z�Descriptors essentially contain exactly the information found in a .proto
file, in types that make this information accessible in Python.
z#robinson@google.com (Will Robinson)�N)�api_implementationF�python)�_messageTc@seZdZdZdS)�ErrorzBase error for this module.N��__name__�
__module__�__qualname__�__doc__�rr�G/opt/cppython/lib/python3.8/site-packages/google/protobuf/descriptor.pyr src@seZdZdZdS)�TypeTransformationErrorzHError transforming between python proto type and corresponding C++ type.Nrrrrrr
$sr
cseZdZ�fdd�Z�ZS)�DescriptorMetaclasscs(tt|��|�rdSt||j�r$dSdS)NTF)�superr�__instancecheck__�
isinstance�_C_DESCRIPTOR_CLASS)�cls�obj��	__class__rrr/s
z%DescriptorMetaclass.__instancecheck__)rrr	r�
__classcell__rrrrr-src@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Lockz>Wrapper class of threading.Lock(), which is allowed by 'with'.cCst�|�}t��|_|S�N)�object�__new__�	threading�Lock�_lock)r�selfrrrr=s

z
_Lock.__new__cCs|j��dSr)r�acquire�rrrr�	__enter__Bsz_Lock.__enter__cCs|j��dSr)r�release)r�exc_type�	exc_value�exc_tbrrr�__exit__Esz_Lock.__exit__N)rrr	r
rr"r'rrrrr:srcCs0tjdkr,tjd8_tjd|tdd�dS)Nr�z�Call to deprecated create function %s(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.�)�category�
stacklevel)�_Deprecated�count�warnings�warn�DeprecationWarning��namerrrr,Ls
��r,�r)r(�dc@sZeZdZdZerdZdd�Zeej	dd���Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�ZdS)�DescriptorBaseaDescriptors base class.

  This class is the base of all descriptor classes. It provides common options
  related functionality.

  Attributes:
    has_options:  True if the descriptor has non-default options.  Usually it is
      not necessary to read this -- just call GetOptions() which will happily
      return the default instance.  However, it's sometimes useful for
      efficiency, and also useful inside the protobuf implementation to avoid
      some bootstrapping issues.
    file (FileDescriptor): Reference to file info.
  rcCs>d|_||_||_d|_||_||_|jdk	p6|jdk	|_dS)z�Initialize the descriptor given its options message and the name of the
    class of the options message. The name of the class is required in case
    the options message is None and has to be created.
    N)�	_features�file�_options�_loaded_options�_options_class_name�_serialized_options�has_options)rr7�options�serialized_options�options_class_namerrr�__init__|s
�zDescriptorBase.__init__cCsdSrrr!rrr�_parent�szDescriptorBase._parentcCsdS)a,Infers features from proto2/proto3 syntax so that editions logic can be used everywhere.

    Args:
      edition: The edition to infer features for.
      options: The options for this descriptor that are being processed.
      features: The feature set object to modify with inferred features.
    Nr)r�editionr=�featuresrrr�_InferLegacyFeatures�sz#DescriptorBase._InferLegacyFeaturescCs|js|��|jSr)r6�_LazyLoadOptionsr!rrr�_GetFeatures�szDescriptorBase._GetFeaturescCstddlm}|jr,|��}|�|j���n|jj�|�}|��}|�|j	�|�
|||�|�|�|jj�|�S)aResolves features from the raw options of this descriptor.

    Args:
      edition: The edition to use for feature defaults.
      raw_options: The options for this descriptor that are being processed.

    Returns:
      A fully resolved feature set for making runtime decisions.
    r��descriptor_pb2)
�google.protobufrHrA�
FeatureSet�CopyFromrFr7�poolZ_CreateDefaultFeaturesrCrD�	MergeFromZ_InternFeatures)rrBZraw_optionsrHrCZ
unresolvedrrr�_ResolveFeatures�s
zDescriptorBase._ResolveFeaturesc	Cs|jr
dSddlm}t||j�s0td|j��t||j�}d}|jj}|j	s�|j
sj|�|j�
|�|��}t�|�|_|j
s�||_
W5QRXn�|js�|j}nt|�|j�}|j
s�|�|j�
|�|�}t�F||_|j
s�||_
|�d��r|�d�|���s|�|_d|_	W5QRXdS)zCLazily initializes descriptor options towards the end of the build.NrrGzUnknown options class name %s!rCF)r9rIrH�hasattrr:�RuntimeError�getattrr7�_editionr<r6rN�Edition�Valuerr;r8�
_ParseOptions�HasFieldZ
ClearFieldZSerializeToString)rrHZ
options_classrCrBr=rrrrE�sJ�
�
�

zDescriptorBase._LazyLoadOptionscCs|js|��|jS)zZRetrieves descriptor options.

    Returns:
      The options set on this descriptor.
    )r9rEr!rrr�
GetOptions�szDescriptorBase.GetOptionsN)rrr	r
�_USE_C_DESCRIPTORSrr@�property�abc�abstractmethodrArDrFrNrErWrrrrr5gs
-r5)�	metaclasscs*eZdZdZd�fdd�	Zdd�Z�ZS)�_NestedDescriptorBasez0Common class for descriptors that can be nested.Nc

s8tt|��|||	|�||_||_||_||_||_dS)aLConstructor.

    Args:
      options: Protocol message options or None to use default message options.
      options_class_name (str): The class name of the above options.
      name (str): Name of this protocol message type.
      full_name (str): Fully-qualified name of this protocol message type, which
        will include protocol "package" name and the name of any enclosing
        types.
      containing_type: if provided, this is a nested descriptor, with this
        descriptor as parent, otherwise None.
      serialized_start: The start index (inclusive) in block in the
        file.serialized_pb that describes this descriptor.
      serialized_end: The end index (exclusive) in block in the
        file.serialized_pb that describes this descriptor.
      serialized_options: Protocol message serialized options or None.
    N)rr]r@r2�	full_name�containing_type�_serialized_start�_serialized_end)
rr=r?r2r^r7r_�serialized_start�serialized_endr>rrrr@�s
�z_NestedDescriptorBase.__init__cCsF|jdk	r:|jdk	r:|jdk	r:|�|jj|j|j��ntd��dS)z�Copies this to the matching proto in descriptor_pb2.

    Args:
      proto: An empty proto instance from descriptor_pb2.

    Raises:
      Error: If self couldn't be serialized, due to to few constructor
        arguments.
    Nz*Descriptor does not contain serialization.)r7r`ra�ParseFromString�
serialized_pbr�r�protorrr�CopyToProtos

��
�
z!_NestedDescriptorBase.CopyToProto)NNN)rrr	r
r@rhrrrrrr]�s�!r]csbeZdZdZer ejZddd�Zd�fdd�	Z	e
d	d
��Ze
dd��Zd
d�Z
�fdd�Z�ZS)�
Descriptorau	Descriptor for a protocol message type.

  Attributes:
      name (str): Name of this protocol message type.
      full_name (str): Fully-qualified name of this protocol message type,
          which will include protocol "package" name and the name of any
          enclosing types.
      containing_type (Descriptor): Reference to the descriptor of the type
          containing us, or None if this is top-level.
      fields (list[FieldDescriptor]): Field descriptors for all fields in
          this type.
      fields_by_number (dict(int, FieldDescriptor)): Same
          :class:`FieldDescriptor` objects as in :attr:`fields`, but indexed
          by "number" attribute in each FieldDescriptor.
      fields_by_name (dict(str, FieldDescriptor)): Same
          :class:`FieldDescriptor` objects as in :attr:`fields`, but indexed by
          "name" attribute in each :class:`FieldDescriptor`.
      nested_types (list[Descriptor]): Descriptor references
          for all protocol message types nested within this one.
      nested_types_by_name (dict(str, Descriptor)): Same Descriptor
          objects as in :attr:`nested_types`, but indexed by "name" attribute
          in each Descriptor.
      enum_types (list[EnumDescriptor]): :class:`EnumDescriptor` references
          for all enums contained within this type.
      enum_types_by_name (dict(str, EnumDescriptor)): Same
          :class:`EnumDescriptor` objects as in :attr:`enum_types`, but
          indexed by "name" attribute in each EnumDescriptor.
      enum_values_by_name (dict(str, EnumValueDescriptor)): Dict mapping
          from enum value name to :class:`EnumValueDescriptor` for that value.
      extensions (list[FieldDescriptor]): All extensions defined directly
          within this message type (NOT within a nested type).
      extensions_by_name (dict(str, FieldDescriptor)): Same FieldDescriptor
          objects as :attr:`extensions`, but indexed by "name" attribute of each
          FieldDescriptor.
      is_extendable (bool):  Does this type define any extension ranges?
      oneofs (list[OneofDescriptor]): The list of descriptors for oneof fields
          in this message.
      oneofs_by_name (dict(str, OneofDescriptor)): Same objects as in
          :attr:`oneofs`, but indexed by "name" attribute.
      file (FileDescriptor): Reference to file descriptor.
      is_map_entry: If the message type is a map entry.

  NTFcCstj��tj�|�Sr)r�Message�_CheckCalledFromGeneratedFile�default_poolZFindMessageTypeByName)rr2r^�filenamer_�fields�nested_types�
enum_types�
extensionsr=r>�
is_extendable�extension_ranges�oneofsr7rbrc�syntax�is_map_entry�
create_keyrrrr[s
zDescriptor.__new__csn|tk	rtd�tt|�j|	d|||||||
d�	||_|jD]}||_||_q>tdd�|D��|_	tdd�|D��|_
d|_||_|D]
}||_q�tdd�|D��|_
||_|jD]
}||_q�td	d�|D��|_td
d�|D��|_||_|jD]
}||_q�tdd�|D��|_||_||_|
dk	�r.|
ng|_tdd�|jD��|_|jD]}||_||_�qP||_dS)
z�Arguments to __init__() are as described in the description
    of Descriptor fields above.

    Note that filename is an obsolete argument, that is not used anymore.
    Please use file.name to access this as an attribute.
    riZMessageOptions�rbrcr>css|]}|j|fVqdSr��number��.0�frrr�	<genexpr>�sz&Descriptor.__init__.<locals>.<genexpr>css|]}|j|fVqdSrr1r{rrrr~�sNcss|]}|j|fVqdSrr1�r|�trrrr~�scss|]}|j|fVqdSrr1rrrrr~�scss$|]}|jD]}|j|fVqqdSr)�valuesr2)r|r��vrrrr~�scss|]}|j|fVqdSrr1r{rrrr~�scss|]}|j|fVqdSrr1)r|�orrrr~�s)�_internal_create_keyr,rrir@rnr_r7�dictZfields_by_numberZfields_by_name�_fields_by_camelcase_nameroZnested_types_by_namerp�enum_types_by_nameZenum_values_by_namerq�extension_scope�extensions_by_namerrrsrtZoneofs_by_nameZ
_is_map_entry)rr2r^rmr_rnrorprqr=r>rrrsrtr7rbrcrurvrw�field�nested_type�	enum_type�	extensionZoneofrrrr@vsV
�


�



zDescriptor.__init__cCs|jp
|jSr�r_r7r!rrrrA�szDescriptor._parentcCs&|jdkr tdd�|jD��|_|jS)zrSame FieldDescriptor objects as in :attr:`fields`, but indexed by
    :attr:`FieldDescriptor.camelcase_name`.
    Ncss|]}|j|fVqdSr)�camelcase_namer{rrrr~�sz6Descriptor.fields_by_camelcase_name.<locals>.<genexpr>)r�r�rnr!rrr�fields_by_camelcase_name�s

�
z#Descriptor.fields_by_camelcase_namecCs|j|j|jS)asReturns the string name of an enum value.

    This is just a small helper method to simplify a common operation.

    Args:
      enum: string name of the Enum.
      value: int, value of the enum.

    Returns:
      string name of the enum value.

    Raises:
      KeyError if either the Enum doesn't exist or the value is not a valid
        value for the enum.
    )r��values_by_numberr2)r�enum�valuerrr�
EnumValueName�szDescriptor.EnumValueNamecstt|��|�dS)zvCopies this to a descriptor_pb2.DescriptorProto.

    Args:
      proto: An empty descriptor_pb2.DescriptorProto.
    N)rrirhrfrrrrh�szDescriptor.CopyToProto)NNNNNNNNNNTNNNNNNFN)NNTNNNNNNFN)rrr	r
rXrrirrr@rYrAr�r�rhrrrrrri*sR,�
�:

	ric$s�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd	Zd
ZdZ dZ!eeeeeeeeeeeeeee	eeeeeeeeee
eeeeeeeee e
e iZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)e*�re+j,Z-d.dd�Z.d/�fdd�	Z/e0dd��Z1dd �Z2e0d!d"��Z3e3j4d#d"��Z3e0d$d%��Z5e0d&d'��Z6e0d(d)��Z7e0d*d+��Z8e9d,d-��Z:�Z;S)0�FieldDescriptora+	Descriptor for a single field in a .proto file.

  Attributes:
    name (str): Name of this field, exactly as it appears in .proto.
    full_name (str): Name of this field, including containing scope.  This is
      particularly relevant for extensions.
    index (int): Dense, 0-indexed index giving the order that this
      field textually appears within its message in the .proto file.
    number (int): Tag number declared for this field in the .proto file.

    type (int): (One of the TYPE_* constants below) Declared type.
    cpp_type (int): (One of the CPPTYPE_* constants below) C++ type used to
      represent this field.

    label (int): (One of the LABEL_* constants below) Tells whether this
      field is optional, required, or repeated.
    has_default_value (bool): True if this field has a default value defined,
      otherwise false.
    default_value (Varies): Default value of this field.  Only
      meaningful for non-repeated scalar fields.  Repeated fields
      should always set this to [], and non-repeated composite
      fields should always set this to None.

    containing_type (Descriptor): Descriptor of the protocol message
      type that contains this field.  Set by the Descriptor constructor
      if we're passed into one.
      Somewhat confusingly, for extension fields, this is the
      descriptor of the EXTENDED message, not the descriptor
      of the message containing this field.  (See is_extension and
      extension_scope below).
    message_type (Descriptor): If a composite field, a descriptor
      of the message type contained in this field.  Otherwise, this is None.
    enum_type (EnumDescriptor): If this field contains an enum, a
      descriptor of that enum.  Otherwise, this is None.

    is_extension: True iff this describes an extension field.
    extension_scope (Descriptor): Only meaningful if is_extension is True.
      Gives the message that immediately contains this extension field.
      Will be None iff we're a top-level (file-level) extension field.

    options (descriptor_pb2.FieldOptions): Protocol message field options or
      None to use default field options.

    containing_oneof (OneofDescriptor): If the field is a member of a oneof
      union, contains its descriptor. Otherwise, None.

    file (FileDescriptor): Reference to file descriptor.
  r(r3r)������	�
���
�����i���i8JiNNTcCs*tj��|rtj�|�Stj�|�SdSr)rrjrkrl�FindExtensionByName�FindFieldByName)rr2r^�indexrz�type�cpp_type�label�
default_value�message_typer�r_�is_extensionr�r=r>�has_default_value�containing_oneof�	json_namer7rwrrrrgs
zFieldDescriptor.__new__cs�|tk	rtd�tt|��|||d�||_||_d|_|dkrLt|�|_	n||_	||_
||_||_||_
||_||_||_||_|	|_|
|_||_|
|_||_t��dkr�d|_n"|r�tj�|�|_ntj�|�|_dS)aThe arguments are as described in the description of FieldDescriptor
    attributes above.

    Note that containing_type may be None, and may be set later if necessary
    (to deal with circular references between message types, for example).
    Likewise for extension_scope.
    r�ZFieldOptionsNr)r�r,rr�r@r2r^�_camelcase_name�_ToJsonNamer�r�rz�_typer��_labelr�r�r_r�r�r�r�r�r�TypeZ_cdescriptorrrlr�r�)rr2r^r�rzr�r�r�r�r�r�r_r�r�r=r>r�r�r�r7rwrrrr@ss@

�zFieldDescriptor.__init__cCs$|jr|jS|jr|jp|jS|jSr)r�r�r�r7r_r!rrrrA�s
zFieldDescriptor._parentcCsvddlm}||jjkrdS|jtjkr4|jjj	|_
|jtjkrL|jj
j|_|�d�rr|jrf|jjjn|jjj|_dS)NrrG�packed)rIrHrSZEDITION_2023r�r��LABEL_REQUIREDrJZ
FieldPresenceZLEGACY_REQUIRED�field_presencer��
TYPE_GROUPZMessageEncodingZ	DELIMITED�message_encodingrVr�ZRepeatedFieldEncodingZPACKEDZEXPANDED�repeated_field_encoding)rrBr=rCrHrrrrD�s��
��z$FieldDescriptor._InferLegacyFeaturescCs8|��jtkr2|jr2|j��js2|j��js2tjS|j	Sr)
rFr��&_FEATURESET_MESSAGE_ENCODING_DELIMITEDr�rWZ	map_entryr_r�r�r�r!rrrr��s���
�
�zFieldDescriptor.typecCs
||_dSr)r�)r�valrrrr��scCs|��jtkrtjS|jSr)rFr��*_FEATURESET_FIELD_PRESENCE_LEGACY_REQUIREDr�r�r�r!rrrr��s��zFieldDescriptor.labelcCs|jdkrt|j�|_|jS)zRCamelcase name of this field.

    Returns:
      str: the name in CamelCase.
    N)r��_ToCamelCaser2r!rrrr��s
zFieldDescriptor.camelcase_namecCs:|jtjkrdS|jtjks(|js(|jr,dS|��jt	kS)z�Whether the field distinguishes between unpopulated and default values.

    Raises:
      RuntimeError: singular field that is not linked with message nor file.
    FT)
r�r��LABEL_REPEATEDr��CPPTYPE_MESSAGEr�r�rFr��#_FEATURESET_FIELD_PRESENCE_IMPLICITr!rrr�has_presence�s
�����zFieldDescriptor.has_presencecCsP|jtjkrdS|j}|tjks>|tjks>|tjks>|tjkrBdS|��j	t
kS)zReturns if the field is packed.F)r�r�r�r��TYPE_STRINGr��TYPE_MESSAGE�
TYPE_BYTESrFr��*_FEATURESET_REPEATED_FIELD_ENCODING_PACKED)rZ
field_typerrr�	is_packed�s
�����zFieldDescriptor.is_packedcCs2ztj|WStk
r,td|��YnXdS)a�Converts from a Python proto type to a C++ Proto Type.

    The Python ProtocolBuffer classes specify both the 'Python' datatype and the
    'C++' datatype - and they're not the same. This helper method should
    translate from one to another.

    Args:
      proto_type: the Python proto type (descriptor.FieldDescriptor.TYPE_*)
    Returns:
      int: descriptor.FieldDescriptor.CPPTYPE_*, the C++ type.
    Raises:
      TypeTransformationError: when the Python proto type isn't known.
    zUnknown proto_type: %sN)r��_PYTHON_TO_CPP_PROTO_TYPE_MAP�KeyErrorr
)Z
proto_typerrr�ProtoTypeToCppProtoTypesz'FieldDescriptor.ProtoTypeToCppProtoType)NNTNNNN)NNTNNNN)<rrr	r
ZTYPE_DOUBLEZ
TYPE_FLOATZ
TYPE_INT64ZTYPE_UINT64Z
TYPE_INT32ZTYPE_FIXED64ZTYPE_FIXED32Z	TYPE_BOOLr�r�r�r�ZTYPE_UINT32Z	TYPE_ENUMZ
TYPE_SFIXED32Z
TYPE_SFIXED64ZTYPE_SINT32ZTYPE_SINT64ZMAX_TYPEZ
CPPTYPE_INT32Z
CPPTYPE_INT64ZCPPTYPE_UINT32ZCPPTYPE_UINT64ZCPPTYPE_DOUBLEZ
CPPTYPE_FLOATZCPPTYPE_BOOLZCPPTYPE_ENUMZCPPTYPE_STRINGr�ZMAX_CPPTYPEr�ZLABEL_OPTIONALr�r�Z	MAX_LABELZMAX_FIELD_NUMBERZFIRST_RESERVED_FIELD_NUMBERZLAST_RESERVED_FIELD_NUMBERrXrr�rrr@rYrArDr��setterr�r�r�r��staticmethodr�rrrrrr��s�5��
�/







r�csZeZdZdZer ejZd
dd�Zd�fdd�	Z	e
dd��Ze
d	d
��Z�fdd�Z
�ZS)�EnumDescriptora�Descriptor for an enum defined in a .proto file.

  Attributes:
    name (str): Name of the enum type.
    full_name (str): Full name of the type, including package name
      and any enclosing type(s).

    values (list[EnumValueDescriptor]): List of the values
      in this enum.
    values_by_name (dict(str, EnumValueDescriptor)): Same as :attr:`values`,
      but indexed by the "name" field of each EnumValueDescriptor.
    values_by_number (dict(int, EnumValueDescriptor)): Same as :attr:`values`,
      but indexed by the "number" field of each EnumValueDescriptor.
    containing_type (Descriptor): Descriptor of the immediate containing
      type of this enum, or None if this is an enum defined at the
      top level in a .proto file.  Set by Descriptor's constructor
      if we're passed into one.
    file (FileDescriptor): Reference to file descriptor.
    options (descriptor_pb2.EnumOptions): Enum options message or
      None to use default enum options.
  NcCstj��tj�|�Sr)rrjrkrlZFindEnumTypeByName)rr2r^rmr�r_r=r>r7rbrcrwrrrr<s
zEnumDescriptor.__new__c
s�|tk	rtd�tt|�j|d|||||	|
|d�	||_|jD]}||_||_q>tdd�|D��|_	tdd�t
|�D��|_dS)z�Arguments are as described in the attribute description above.

    Note that filename is an obsolete argument, that is not used anymore.
    Please use file.name to access this as an attribute.
    r�ZEnumOptionsrxcss|]}|j|fVqdSrr1�r|r�rrrr~Xsz*EnumDescriptor.__init__.<locals>.<genexpr>css|]}|j|fVqdSrryr�rrrr~ZsN)r�r,rr�r@r�r7r�r�Zvalues_by_name�reversedr�)
rr2r^rmr�r_r=r>r7rbrcrwr�rrrr@Cs&	
�
zEnumDescriptor.__init__cCs|jp
|jSrr�r!rrrrA\szEnumDescriptor._parentcCs|��jtkS)a:Returns true whether this is a "closed" enum.

    This means that it:
    - Has a fixed set of values, rather than being equivalent to an int32.
    - Encountering values not in this set causes them to be treated as unknown
      fields.
    - The first value (i.e., the default) may be nonzero.

    WARNING: Some runtimes currently have a quirk where non-closed enums are
    treated as closed when used as the type of fields defined in a
    `syntax = proto2;` file. This quirk is not present in all runtimes; as of
    writing, we know that:

    - C++, Java, and C++-based Python share this quirk.
    - UPB and UPB-based Python do not.
    - PHP and Ruby treat all enums as open regardless of declaration.

    Care should be taken when using this function to respect the target
    runtime's enum handling quirks.
    )rFr��_FEATURESET_ENUM_TYPE_CLOSEDr!rrr�	is_closed`szEnumDescriptor.is_closedcstt|��|�dS)z�Copies this to a descriptor_pb2.EnumDescriptorProto.

    Args:
      proto (descriptor_pb2.EnumDescriptorProto): An empty descriptor proto.
    N)rr�rhrfrrrrhxszEnumDescriptor.CopyToProto)NNNNNNN)NNNNNNN)rrr	r
rXrr�rrr@rYrAr�rhrrrrrr�!s0�
�

r�csBeZdZdZer ejZd	dd�Zd
�fdd�	Z	e
dd��Z�ZS)�EnumValueDescriptoraLDescriptor for a single value within an enum.

  Attributes:
    name (str): Name of this value.
    index (int): Dense, 0-indexed index giving the order that this
      value appears textually within its enum in the .proto file.
    number (int): Actual number assigned to this enum value.
    type (EnumDescriptor): :class:`EnumDescriptor` to which this value
      belongs.  Set by :class:`EnumDescriptor`'s constructor if we're
      passed into one.
    options (descriptor_pb2.EnumValueOptions): Enum value options message or
      None to use default enum value options options.
  NcCstj��dSr)rrjrk)rr2r�rzr�r=r>rwrrrr�s
zEnumValueDescriptor.__new__csL|tk	rtd�tt|��|r$|jnd||d�||_||_||_||_	dS)�>Arguments are as described in the attribute description above.r�NZEnumValueOptions)
r�r,rr�r@r7r2r�rzr�)rr2r�rzr�r=r>rwrrrr@�s
�zEnumValueDescriptor.__init__cCs|jSr)r�r!rrrrA�szEnumValueDescriptor._parent)NNNN)NNNN)
rrr	r
rXrr�rrr@rYrArrrrrr��s�
�r�csBeZdZdZer ejZd	dd�Zd
�fdd�	Z	e
dd��Z�ZS)�OneofDescriptora'Descriptor for a oneof field.

  Attributes:
    name (str): Name of the oneof field.
    full_name (str): Full name of the oneof field, including package name.
    index (int): 0-based index giving the order of the oneof field inside
      its containing type.
    containing_type (Descriptor): :class:`Descriptor` of the protocol message
      type that contains this field.  Set by the :class:`Descriptor` constructor
      if we're passed into one.
    fields (list[FieldDescriptor]): The list of field descriptors this
      oneof can contain.
  Nc		Cstj��tj�|�Sr)rrjrkrlZFindOneofByName)	rr2r^r�r_rnr=r>rwrrrr�s
zOneofDescriptor.__new__c		sR|tk	rtd�tt|��|r$|jnd||d�||_||_||_||_	||_
dS)r�r�NZOneofOptions)r�r,rr�r@r7r2r^r�r_rn)	rr2r^r�r_rnr=r>rwrrrr@�s
�zOneofDescriptor.__init__cCs|jSr)r_r!rrrrA�szOneofDescriptor._parent)NNN)NNN)
rrr	r
rXrr�rrr@rYrArrrrrr��s�
�r�c
sVeZdZdZer ejZd
dd�Zd�fdd�	Z	e
dd��Zd	d
�Z�fdd�Z
�ZS)�ServiceDescriptora�Descriptor for a service.

  Attributes:
    name (str): Name of the service.
    full_name (str): Full name of the service, including package name.
    index (int): 0-indexed index giving the order that this services
      definition appears within the .proto file.
    methods (list[MethodDescriptor]): List of methods provided by this
      service.
    methods_by_name (dict(str, MethodDescriptor)): Same
      :class:`MethodDescriptor` objects as in :attr:`methods_by_name`, but
      indexed by "name" attribute in each :class:`MethodDescriptor`.
    options (descriptor_pb2.ServiceOptions): Service options message or
      None to use default service options.
    file (FileDescriptor): Reference to file info.
  NcCstj��tj�|�Sr)rrjrkrlZFindServiceByName)rr2r^r��methodsr=r>r7rbrcrwrrrr�s
zServiceDescriptor.__new__csp|
tk	rtd�tt|�j|d|||d||	|d�	||_||_tdd�|D��|_|jD]}|j	|_	||_
qXdS)Nr�ZServiceOptionsrxcss|]}|j|fVqdSrr1)r|�mrrrr~sz-ServiceDescriptor.__init__.<locals>.<genexpr>)r�r,rr�r@r�r�r��methods_by_namer7�containing_service)rr2r^r�r�r=r>r7rbrcrw�methodrrrr@s&
�
zServiceDescriptor.__init__cCs|jSr)r7r!rrrrAszServiceDescriptor._parentcCs
|j|S)aSearches for the specified method, and returns its descriptor.

    Args:
      name (str): Name of the method.

    Returns:
      MethodDescriptor: The descriptor for the requested method.

    Raises:
      KeyError: if the method cannot be found in the service.
    )r�)rr2rrr�FindMethodByName!sz"ServiceDescriptor.FindMethodByNamecstt|��|�dS)z�Copies this to a descriptor_pb2.ServiceDescriptorProto.

    Args:
      proto (descriptor_pb2.ServiceDescriptorProto): An empty descriptor proto.
    N)rr�rhrfrrrrh/szServiceDescriptor.CopyToProto)
NNNNNNNNNN)NNNNNN)rrr	r
rXrr�rrr@rYrAr�rhrrrrrr��s2�
�
r�csJeZdZdZer ejZddd�Zd
�fdd�	Z	e
dd	��Zd
d�Z�Z
S)�MethodDescriptora�Descriptor for a method in a service.

  Attributes:
    name (str): Name of the method within the service.
    full_name (str): Full name of method.
    index (int): 0-indexed index of the method inside the service.
    containing_service (ServiceDescriptor): The service that contains this
      method.
    input_type (Descriptor): The descriptor of the message that this method
      accepts.
    output_type (Descriptor): The descriptor of the message that this method
      returns.
    client_streaming (bool): Whether this method uses client streaming.
    server_streaming (bool): Whether this method uses server streaming.
    options (descriptor_pb2.MethodOptions or None): Method options message, or
      None to use default method options.
  FNcCstj��tj�|�Sr)rrjrkrlr�)rr2r^r�r��
input_type�output_type�client_streaming�server_streamingr=r>rwrrrrPs
zMethodDescriptor.__new__csd|tk	rtd�tt|��|r$|jnd|	|
d�||_||_||_||_	||_
||_||_||_
dS)z�The arguments are as described in the description of MethodDescriptor
    attributes above.

    Note that containing_service may be None, and may be set later if necessary.
    r�NZ
MethodOptions)r�r,rr�r@r7r2r^r�r�r�r�r�r�)rr2r^r�r�r�r�r�r�r=r>rwrrrr@_s 
�zMethodDescriptor.__init__cCs|jSr)r�r!rrrrA�szMethodDescriptor._parentcCsJ|jdk	r>ddlm}|��}|j�|�|�|j|j�ntd��dS)z�Copies this to a descriptor_pb2.MethodDescriptorProto.

    Args:
      proto (descriptor_pb2.MethodDescriptorProto): An empty descriptor proto.

    Raises:
      Error: If self couldn't be serialized, due to too few constructor
        arguments.
    NrrGz&Descriptor does not contain a service.)	r�rIrHZServiceDescriptorProtorhrKr�r�r)rrgrHZ
service_protorrrrh�s

zMethodDescriptor.CopyToProto)FFNNN)FFNNN)rrr	r
rXrr�rrr@rYrArhrrrrrr�9s$	�
�#
r�c	sNeZdZdZer$ejZd�fdd�	Zd�fdd�	Z	dd�Z
ed	d
��Z�Z
S)
�FileDescriptora�Descriptor for a file. Mimics the descriptor_pb2.FileDescriptorProto.

  Note that :attr:`enum_types_by_name`, :attr:`extensions_by_name`, and
  :attr:`dependencies` fields are only set by the
  :py:mod:`google.protobuf.message_factory` module, and not by the generated
  proto code.

  Attributes:
    name (str): Name of file, relative to root of source tree.
    package (str): Name of the package
    edition (Edition): Enum value indicating edition of the file
    serialized_pb (bytes): Byte string of serialized
      :class:`descriptor_pb2.FileDescriptorProto`.
    dependencies (list[FileDescriptor]): List of other :class:`FileDescriptor`
      objects this :class:`FileDescriptor` depends on.
    public_dependencies (list[FileDescriptor]): A subset of
      :attr:`dependencies`, which were declared as "public".
    message_types_by_name (dict(str, Descriptor)): Mapping from message names to
      their :class:`Descriptor`.
    enum_types_by_name (dict(str, EnumDescriptor)): Mapping from enum names to
      their :class:`EnumDescriptor`.
    extensions_by_name (dict(str, FieldDescriptor)): Mapping from extension
      names declared at file scope to their :class:`FieldDescriptor`.
    services_by_name (dict(str, ServiceDescriptor)): Mapping from services'
      names to their :class:`ServiceDescriptor`.
    pool (DescriptorPool): The pool this descriptor belongs to.  When not passed
      to the constructor, the global default pool is used.
  Ncs$|rtj�|�Stt|��|�SdSr)rrlZAddSerializedFilerr�r)rr2�packager=r>re�dependencies�public_dependenciesrurBrLrwrrrr�szFileDescriptor.__new__c
s�|tk	rtd�tt|��|||d�|	r:|	dkr:|	|_n|dkrJd|_nd|_|
dkrldd	lm}|��}
|
|_	i|_
||_||_||_
i|_i|_i|_|p�g|_|p�g|_dS)
zConstructor.r�ZFileOptionsZEDITION_UNKNOWNZproto3ZEDITION_PROTO3ZEDITION_PROTO2Nr)�descriptor_pool)r�r,rr�r@rRrIr�ZDefaultrL�message_types_by_namer2r�rer�r�Zservices_by_namer�r�)
rr2r�r=r>rer�r�rurBrLrwr�rrrr@�s4
�
zFileDescriptor.__init__cCs|�|j�dS)z~Copies this to a descriptor_pb2.FileDescriptorProto.

    Args:
      proto: An empty descriptor_pb2.FileDescriptorProto.
    N)rdrerfrrrrh�szFileDescriptor.CopyToProtocCsdSrrr!rrrrAszFileDescriptor._parent)	NNNNNNNNN)	NNNNNNNNN)rrr	r
rXrr�rrr@rhrYrArrrrrr��s4��,r�cCs|�|�|S)z�Parses serialized options.

  This helper function is used to parse serialized options in generated
  proto2 files. It must not be used outside proto2.
  )rd)�message�stringrrrrU	s
rUcCsnd}g}|D]6}|dkr"|rBd}q|r:|�|���d}q||7}q|rd|d��rd|d��|d<d�|�S)z+Converts name to camel-case and returns it.F�_Tr�)�append�upper�isupper�lower�join�r2Zcapitalize_next�result�crrrr�s
r�cCs|�d�r|jSdSdS)zCReturns the value of the field `options`, or None if it is not set.r=N)rVr=)Zdescriptor_protorrr�_OptionsOrNone(s
r�cCsJd}g}|D]2}|dkrd}q|r6|�|���d}q||7}qd�|�S)z*Converts name to Json name and returns it.Fr�Tr�)r�r�r�r�rrrr�0s
r�r�cCs�ddlm}t�t�d���d�}|rBtj�|�	dd�|d�}n|d}t
��dkr�|r�|��}	|	j
���|�|r|||	_||	_tj�|	�tj�|	j�}
tr�|
j|jS|d	kr�td	||||d	d
ggtd�
}|jg}|r�|�d|�i}|jD]D}
d�||
jg�}t|
j|d	dd
�t|
j�D�|td�}|||<q�i}|jD]:}d�||jg�}t |d�|�d|||d�}|||<�qBg}|j!D]�}d�||jg�}d	}d	}|j"�r�|j"}nd	}|�#d��r|j$}d�|||�%d�dd	�g�}||k�r||}n||k�r||}t&|j||j'd|j'|j(t&�)|j(�|j*d	||d	dd	t+|�d||td�}|�,|��q�d�|�}t-|j|d	d	|t.|�/��t.|�/��gt+|�|td�S)apMake a protobuf Descriptor given a DescriptorProto protobuf.

  Handles nested descriptors. Note that this is limited to the scope of defining
  a message inside of another message. Composite fields can currently only be
  resolved if the message is defined in the same scope as the field.

  Args:
    desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
    package: Optional package name for the new message Descriptor (string).
    build_file_if_cpp: Update the C++ descriptor pool if api matches. Set to
      False on recursion, so no duplicates are created.
    syntax: The syntax/semantics that should be used.  Set to "proto3" to get
      proto3 field presence semantics.
    edition: The edition that should be used if syntax is "edition".
    file_desc: A FileDescriptor to place this descriptor into.

  Returns:
    A Descriptor for protobuf messages.
  rrGr��ascii�.�/z.protorNr�)
rLr2r�rurBr=rer�r�rwcSs$g|]\}}t|j||jtd��qS))rw)r�r2rzr�)r|�iiZenum_valrrr�
<listcomp>�s��z"MakeDescriptor.<locals>.<listcomp>)r7rwF)r��build_file_if_cpprurB�	file_desc�	type_namer()r=r�r�r7rw)r=r7rw)0rIrH�binascii�hexlify�os�urandom�decode�pathr��replacerr�ZFileDescriptorProtor��addrMr�r2rrl�AddZFindFileByNamerXr�r�r��insertr�r��	enumerater�r��MakeDescriptorr�r�rVr��rfindr�rzr�r�r�r�r�ri�listr�)Z
desc_protor�r�rurBr�rHZ
proto_name�	file_nameZfile_descriptor_protor�Zfull_message_namerpZ
enum_protor^Z	enum_descroZnested_protoZnested_descrnZfield_protor�r�Zfull_type_namer�Z	desc_namerrrrAs��
�	�

�
�



�


�r)r�TNNN)/r
�
__author__rZr�r�rr.Zgoogle.protobuf.internalrrXr�Z	_c_modulerZgoogle.protobuf.pyext�	Exceptionrr
r�r�ABCMetarrrrr,r�r�r�r�r�r-r�r5r]rir�r�r�r�r�r�r�rUr�r�r�rrrrr�<module>sh


7<>a40S`p
�

F1le Man4ger