File: D:/Python311/Lib/site-packages/google/protobuf/__pycache__/proto_builder.cpython-311.pyc
�
�nc� � �^ � d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ d� Z d
d�Z
d � ZdS )zDynamic Protobuf class creator.� )�OrderedDictN)�descriptor_pb2)�
descriptor)�message_factoryc �d � | j � |� � }| � |� � }|S )a8 Get 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.
)�pool�FindMessageTypeByName�GetPrototype)�factory� full_name�proto_descriptor� proto_clss �?D:\Python311\Lib\site-packages\google/protobuf/proto_builder.py�_GetMessageFromFactoryr * s4 � � �\�7�7� �B�B���"�"�#3�4�4�)� �� c �� � t j |�� � }|�# t ||� � }|S # t $ r Y nw xY w| � � � }t | t � � st |� � }t j � � }|D ]b\ }}|�
|� d� � � � |�
t |� � � d� � � � �c|�
� � dz } |�:d|�
� � z } t ||� � }|S # t $ r Y nw xY w|j � t! | ||� � � � 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.
)r Nzutf-8z.protoz6net.proto2.python.public.proto_builder.AnonymousProto_)r �MessageFactoryr �KeyError�items�
isinstancer �sorted�hashlib�sha1�update�encode�str� hexdigestr �Add�_MakeFileDescriptorProto)
�fieldsr r r r �field_items�fields_hash�f_name�f_type�proto_file_names
r �MakeSimpleProtoClassr&