관리-도구
편집 파일: proto_builder.cpython-311.pyc
� P�Dg� � �j � d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z d� Z dd �Zd � ZdS )zDynamic Protobuf class creator.� )�OrderedDictN)�descriptor_pb2)� descriptor)�descriptor_pool)�message_factoryc �X � | � |� � }t j |� � }|S )a- Get a proto class from the MessageFactory by name. Args: pool: a descriptor pool. 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. )�FindMessageTypeByNamer �GetMessageClass)�pool� full_name�proto_descriptor� proto_clss �/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/google/protobuf/proto_builder.py�_GetMessageFromFactoryr + s/ � � �/�/� �:�:���-�.>�?�?�)� �� c �� � |pt 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|� 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. Nzutf-8z.protoz6net.proto2.python.public.proto_builder.AnonymousProto_)r �DescriptorPoolr �KeyError�items� isinstancer �sorted�hashlib�sha1�update�encode�str� hexdigest�Add�_MakeFileDescriptorProto) �fieldsr r � pool_instancer �field_items�fields_hash�f_name�f_type�proto_file_names r �MakeSimpleProtoClassr'