HEX
Server: LiteSpeed
System: Linux server384.web-hosting.com 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User: drivkxoj (2377)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/google/protobuf/__pycache__/proto_builder.cpython-36.opt-1.pyc
3

���hX�@s|dZyddlmZWn ek
r4ddlmZYnXddlZddlZddlmZddlm	Z	dd�Z
ddd	�Zd
d�ZdS)
zDynamic Protobuf class creator.�)�OrderedDictN)�descriptor_pb2)�message_factorycCs|jj|�}|j|�}|S)a8Get a proto class from the MessageFactory by name.

  Args:
    factory: a MessageFactory instance.
    full_name: str, the fully qualified name of the proto type.
  Returns:
    A class, for the type identified by full_name.
  Raises:
    KeyError, if the proto is not found in the factory's descriptor pool.
  )�poolZFindMessageTypeByNameZGetPrototype)�factory�	full_nameZproto_descriptor�	proto_cls�r	�#/usr/lib/python3.6/proto_builder.py�_GetMessageFromFactory,s
rc
Cs�tj|d�}|dk	r8yt||�}|Stk
r6YnXt|j��}t|t�sVt|�}t	j
�}x4|D],\}}|j|jd��|jt
|�jd��qdW|j�d}	|dkr�d|j�}yt||�}|Stk
r�YnX|jjt|	||��t||�S)a�Create a Protobuf class whose fields are basic types.

  Note: this doesn't validate field names!

  Args:
    fields: dict of {name: field_type} mappings for each field in the proto. If
        this is an OrderedDict the order will be maintained, otherwise the
        fields will be sorted by name.
    full_name: optional str, the fully-qualified name of the proto type.
    pool: optional DescriptorPool instance.
  Returns:
    a class, the new protobuf class with a FileDescriptor.
  )rNzutf-8z.protoz6net.proto2.python.public.proto_builder.AnonymousProto_)rZMessageFactoryr�KeyError�list�items�
isinstancer�sorted�hashlibZsha1�update�encode�strZ	hexdigestrZAdd�_MakeFileDescriptorProto)
Zfieldsrrrr�field_itemsZfields_hash�f_name�f_type�proto_file_namer	r	r
�MakeSimpleProtoClass<s4



rcCs�|jdd�\}}tj�}tjj|jdd�|�|_||_|j	j
�}||_x@t|d�D]2\}\}}	|jj
�}
||
_||
_
tjj|
_|	|
_qRW|S)zAPopulate FileDescriptorProto for MessageFactory's DescriptorPool.�.��/)�rsplitrZFileDescriptorProto�os�path�join�replace�name�packageZmessage_type�add�	enumerateZfieldZnumberZFieldDescriptorProtoZLABEL_OPTIONALZlabel�type)rrrr$r#Z
file_protoZ
desc_protoZf_numberrrZfield_protor	r	r
rts



r)NN)
�__doc__�collectionsr�ImportErrorZordereddictrrZgoogle.protobufrrrrrr	r	r	r
�<module>s
8