1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
U
£ý°dã@sbdZddlmZddlZddlZddlmZddlmZddlmZdd„Z    d d    d
„Z
d d „Z dS)zDynamic Protobuf class creator.é)Ú OrderedDictN)Údescriptor_pb2)Ú
descriptor)Úmessage_factorycCs|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
úTd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\google/protobuf/proto_builder.pyÚ_GetMessageFromFactory*s 
r c
Csòtj|d}|dk    r:zt||ƒ}|WStk
r8YnX| ¡}t|tƒsTt|ƒ}t     ¡}|D],\}}| 
|  d¡¡| 
t |ƒ  d¡¡q`|  ¡d}    |dkrÔd|  ¡}zt||ƒ}|WStk
rÒYnX|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.
  )rNzutf-8z.protoz6net.proto2.python.public.proto_builder.AnonymousProto_)rZMessageFactoryr ÚKeyErrorÚitemsÚ
isinstancerÚsortedÚhashlibÚsha1ÚupdateÚencodeÚstrÚ    hexdigestrZAddÚ_MakeFileDescriptorProto)
Úfieldsrrrr    Ú field_itemsZ fields_hashÚf_nameÚf_typeÚproto_file_namer
r
r ÚMakeSimpleProtoClass:s8 
 
  ÿ
 
ÿrc Cs¬| dd¡\}}t ¡}tj | dd¡|¡|_||_|j     
¡}||_t |dƒD]V\}\}}    |j  
¡}
||
_|t jjkr|t jjt jjd7}||
_tjj|
_|    |
_qP|S)zAPopulate FileDescriptorProto for MessageFactory's DescriptorPool.Ú.éú/)ÚrsplitrZFileDescriptorProtoÚosÚpathÚjoinÚreplaceÚnameÚpackageZ message_typeÚaddÚ    enumerateÚfieldrZFieldDescriptorZFIRST_RESERVED_FIELD_NUMBERZLAST_RESERVED_FIELD_NUMBERÚnumberZFieldDescriptorProtoZLABEL_OPTIONALÚlabelÚtype) rrrr'r&Z
file_protoZ
desc_protoZf_numberrrZ field_protor
r
r rrs*
 
 ÿÿÿ
r)NN) Ú__doc__Ú collectionsrrr"Zgoogle.protobufrrrr rrr
r
r
r Ú<module>s    
8