K ikhdZddlmZddlZddlZddlmZddlmZddlmZddlm Z dZ d d Z d Z y) zDynamic Protobuf class creator.) OrderedDictN)descriptor_pb2) descriptor)descriptor_pool)message_factorycR|j|}tj|}|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. )FindMessageTypeByNamerGetMessageClass)pool full_nameproto_descriptor proto_clss c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/google/protobuf/proto_builder.py_GetMessageFromFactoryrs,// :--.>?) cr|xstj}| t||}|S|j }t |t s t|}tj}|D]N\}}|j|jd|jt|jdP|jdz} |"d|jz} t||}|S|jt| ||t||S#t$rYwxYw#t$rYBwxYw)aCreate 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. zutf-8z.protoz6net.proto2.python.public.proto_builder.AnonymousProto_)rDescriptorPoolrKeyErroritems isinstancersortedhashlibsha1updateencodestr hexdigestAdd_MakeFileDescriptorProto) fieldsr r pool_instancer field_items fields_hashf_namef_typeproto_file_names rMakeSimpleProtoClassr'$sE:/88:- ( Bi  + FK (%K +#4nffv}}W-.s6{))'234 ))+h6/I&&()I ( Bi   ;GI  y 99C    4    s# D% D* D'&D'* D65D6c|jdd\}}tj}tjj |j dd||_||_|jj}||_t|dD]\}\}} |jj} || _|tjjk\r;|tjj tjjz dzz }|| _tj$j&| _| | _|S)zAPopulate FileDescriptorProto for MessageFactory's DescriptorPool../)rsplitrFileDescriptorProtoospathjoinreplacenamepackage message_typeadd enumeratefieldrFieldDescriptorFIRST_RESERVED_FIELD_NUMBERLAST_RESERVED_FIELD_NUMBERnumberFieldDescriptorProtoLABEL_OPTIONALlabeltype) r&r r"r3r2 file_proto desc_protof_numberr$r% field_protos rrr[s"""3*-'4113*GGLLc!:OL*/*&&**,**/$-k1$=  h ""&&(KK:--III  $ $ ? ?  $ $ @ @ ACD EFh"K&;;JJKK  r)NN) __doc__ collectionsrrr.google.protobufrrrrrr'rrrrHs/&# *&++  4:nr