HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //lib/python3.9/site-packages/google/protobuf/__pycache__/message_factory.cpython-39.pyc
a

x��g��@szdZdZddlmZddlmZddlmZe��dkrFddlm	Z
nddlmZ
e
jZ
Gd	d
�d
e�Ze�Zdd�Zd
S)aoProvides a factory class for generating dynamic messages.

The easiest way to use this class is if you have access to the FileDescriptor
protos containing the messages you want to create you can just do the following:

message_classes = message_factory.GetMessages(iterable_of_file_descriptors)
my_proto_instance = message_classes['some.proto.package.MessageName']()
z"matthewtoia@google.com (Matt Toia)�)�api_implementation)�descriptor_pool)�messageZcpp)�cpp_message)�python_messagec@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
�MessageFactoryz@Factory for creating Proto2 messages from descriptors in a pool.NcCs|p
t��|_i|_dS)zInitializes a new factory.N)rZDescriptorPool�pool�_classes)�selfr�r�C/usr/lib/python3.9/site-packages/google/protobuf/message_factory.py�__init__;szMessageFactory.__init__cCs�||jvr�|j}ttur&|j�dd�}t|tjf|dd��}||_||j|<|j	D]}|j
rR|�|j
�qR|jj
D]2}|j|jvr�|�|j�|j|j}|�|�qr|j|S)aDBuilds a proto2 message class based on the passed in descriptor.

    Passing a descriptor with a fully qualified name matching a previous
    invocation will cause the same class to be returned.

    Args:
      descriptor: The descriptor to build from.

    Returns:
      A class describing the passed in descriptor.
    �ascii�ignoreN)�
DESCRIPTOR�
__module__)r	�name�str�bytes�encode� _GENERATED_PROTOCOL_MESSAGE_TYPErZMessage�_FACTORY�fieldsZmessage_type�GetPrototyper�
extensions�containing_type�RegisterExtension)r
Z
descriptorZdescriptor_nameZresult_classZfield�	extension�extended_classrrrrBs(
�

zMessageFactory.GetPrototypecCs|i}|D]n}|j�|�}|j��D]}|�|�||j<q"|j��D]2}|j|jvr^|�|j�|j|j}|�	|�qBq|S)a�Gets all the messages from a specified file.

    This will find and resolve dependencies, failing if the descriptor
    pool cannot satisfy them.

    Args:
      files: The file names to extract messages from.

    Returns:
      A dictionary mapping proto names to the message classes. This will include
      any dependent messages as well as any messages defined in the same file as
      a specified message.
    )
rZFindFileByNameZmessage_types_by_name�valuesrZ	full_nameZextensions_by_namerr	r)r
�files�result�	file_nameZ	file_descZdescrrrrr�GetMessagesdszMessageFactory.GetMessages)N)�__name__r�__qualname__�__doc__r
rr#rrrrr8s
"rcsFdd�|D����fdd���r2����d�qt�dd�|D��S)a^Builds a dictionary of all the messages available in a set of files.

  Args:
    file_protos: Iterable of FileDescriptorProto to build messages out of.

  Returns:
    A dictionary mapping proto names to the message classes. This will include
    any dependent messages as well as any messages defined in the same file as
    a specified message.
  cSsi|]}|j|�qSr�r��.0�
file_protorrr�
<dictcomp>��zGetMessages.<locals>.<dictcomp>cs2|jD]}|�vr���|��qtj�|�dS)N)�
dependency�poprrZAdd)r*r-��_AddFileZfile_by_namerrr0�s
zGetMessages.<locals>._AddFile�cSsg|]
}|j�qSrr'r(rrr�
<listcomp>�r,zGetMessages.<locals>.<listcomp>)�popitemrr#)Zfile_protosrr/rr#�s

r#N)r&�
__author__Zgoogle.protobuf.internalrZgoogle.protobufrr�TypeZgoogle.protobuf.pyextrZmessage_implrZGeneratedProtocolMessageTyper�objectrrr#rrrr�<module>s	Q