zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
U
£ý°dTã@sLdZdZddlZGdd„deƒZGdd„deƒZGdd    „d    eƒZd
d „ZdS) z*Provides a container for DescriptorProtos.z"matthewtoia@google.com (Matt Toia)éNc@s eZdZdS)ÚErrorN)Ú__name__Ú
__module__Ú __qualname__©rrúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\google/protobuf/descriptor_database.pyr&src@seZdZdZdS)Ú,DescriptorDatabaseConflictingDefinitionErrorzGRaised when a proto is added with the same name & different descriptor.N)rrrÚ__doc__rrrrr*src@sHeZdZdZdd„Zdd„Zdd„Zdd    „Zd
d „Zd d „Z    dd„Z
dS)ÚDescriptorDatabasezEA container accepting FileDescriptorProtos and maps DescriptorProtos.cCsi|_i|_dS©N)Ú_file_desc_protos_by_fileÚ_file_desc_protos_by_symbol)ÚselfrrrÚ__init__1szDescriptorDatabase.__init__c
Csü|j}||jkr||j|<n |j||kr8td|ƒ‚ndS|j}|jD] }t||ƒD]}| ||¡qVqH|jD]>}| d ||jf¡|¡|j    D]}||j
d ||jf¡<q’qp|j D]}| d ||jf¡|¡q¶|j D]}    | d ||    jf¡|¡qÚdS)aLAdds the FileDescriptorProto and its types to this database.
 
    Args:
      file_desc_proto: The FileDescriptorProto to add.
    Raises:
      DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
        add a proto with the same name but different definition than an
        existing proto in the database.
    z0%s already added, but with different descriptor.NÚ.) Únamer rÚpackageZ message_typeÚ_ExtractSymbolsÚ
_AddSymbolÚ    enum_typeÚjoinÚvaluer Ú    extensionÚservice)
rÚfile_desc_protoZ
proto_namerÚmessagerÚenumZ
enum_valuerrrrrÚAdd5s.
 
 ÿ
 
 
ÿÿ
 
zDescriptorDatabase.AddcCs
|j|S)a¸Finds the file descriptor proto by file name.
 
    Typically the file name is a relative path ending to a .proto file. The
    proto with the given name will have to have been added to this database
    using the Add method or else an error will be raised.
 
    Args:
      name: The file name to find.
 
    Returns:
      The file descriptor proto matching the name.
 
    Raises:
      KeyError if no file by the given name was added.
    )r )rrrrrÚFindFileByNameWsz!DescriptorDatabase.FindFileByNamec Csdz |j|WStk
r^| d¡\}}}z|j|WYStk
rXt|ƒ‚YnXYnXdS)a¢Finds the file descriptor proto containing the specified symbol.
 
    The symbol should be a fully qualified name including the file descriptor's
    package and any containing messages. Some examples:
 
    'some.package.name.Message'
    'some.package.name.Message.NestedEnum'
    'some.package.name.Message.some_field'
 
    The file descriptor proto containing the specified symbol must be added to
    this database using the Add method or else an error will be raised.
 
    Args:
      symbol: The fully qualified symbol name.
 
    Returns:
      The file descriptor proto containing the symbol.
 
    Raises:
      KeyError if no file contains the specified symbol.
    rN)r ÚKeyErrorÚ
rpartition)rÚsymbolZ    top_levelÚ_rrrÚFindFileContainingSymboljs z+DescriptorDatabase.FindFileContainingSymbolcCsdSr r)rÚ extendee_nameZextension_numberrrrÚFindFileContainingExtensionsz.DescriptorDatabase.FindFileContainingExtensioncCsgSr r)rr$rrrÚFindAllExtensionNumbers“sz*DescriptorDatabase.FindAllExtensionNumberscCsJ||jkr<d|jd|d|j|jd}t |t¡||j|<dS)NzConflict register for file "z": z is already defined in file "ú")r rÚwarningsÚwarnÚRuntimeWarning)rrrZwarn_msgrrrr—s
ÿÿþ
ýý zDescriptorDatabase._AddSymbolN) rrrr    rrrr#r%r&rrrrrr
.s"%r
ccsb|r|d|jn|j}|V|jD]}t||ƒD]
}|Vq2q$|jD]}d ||jf¡VqFdS)zëPulls out all the symbols from a descriptor proto.
 
  Args:
    desc_proto: The proto to extract symbols from.
    package: The package containing the descriptor type.
 
  Yields:
    The fully qualified name found in the descriptor.
  rN)rÚ nested_typerrr)Z
desc_protorZ message_namer+r!rrrrr¡s
 
 
 
r)    r    Ú
__author__r(Ú    ExceptionrrÚobjectr
rrrrrÚ<module>s s