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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
U
£ý°dÀ½ã@sšdZdZddlZddlZddlmZddlmZddlmZejZdd„Z    d    d
„Z
d d „Z d d„Z Gdd„de ƒZdd„ZerˆejjZneƒZdd„ZdS)aKProvides DescriptorPool to use as a container for proto2 descriptors.
 
The DescriptorPool is used in conjection with a DescriptorDatabase to maintain
a collection of protocol buffer descriptors for use when dynamically creating
message types at runtime.
 
For most applications protocol buffers should be used via modules generated by
the protocol buffer compiler tool. This should only be used when the type of
protocol buffers used in an application or library cannot be predetermined.
 
Below is a straightforward example on how to use this class::
 
  pool = DescriptorPool()
  file_descriptor_protos = [ ... ]
  for file_descriptor_proto in file_descriptor_protos:
    pool.Add(file_descriptor_proto)
  my_message_descriptor = pool.FindMessageTypeByName('some.package.MessageType')
 
The message descriptor can be used in conjunction with the message_factory
module in order to create a protocol buffer class that can be encoded and
decoded.
 
If you want to get a Python class for the specified proto, use the
helper functions inside google.protobuf.message_factory
directly instead of this class.
z"matthewtoia@google.com (Matt Toia)éN)Ú
descriptor)Údescriptor_database)Ú text_encodingcs.‡fdd„}ˆj|_ˆj|_|j ˆj¡|S)zMark functions as deprecated.cstjdˆjtdˆ||ŽS)NzŠCall to deprecated function %s(). Note: Do add unlinked descriptors to descriptor_pool is wrong. Use Add() or AddSerializedFile() instead.)Úcategory)ÚwarningsÚwarnÚ__name__ÚDeprecationWarning)ÚargsÚkwargs©Úfunc©úVd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\google/protobuf/descriptor_pool.pyÚNewFuncJsþüz_Deprecated.<locals>.NewFunc)rÚ__doc__Ú__dict__Úupdate)r rrr rÚ _DeprecatedGs
 rcCs
| d¡S)aIRemove leading period from fully-qualified type name.
 
  Due to b/13860351 in descriptor_database.py, types in the root namespace are
  generated with a leading period. This function removes that prefix.
 
  Args:
    name (str): The fully-qualified symbol name.
 
  Returns:
    str: The normalized fully-qualified symbol name.
  Ú.)Úlstrip©ÚnamerrrÚ_NormalizeFullyQualifiedNameWs rcCs| d¡r|jSdSdS)zCReturns the value of the field `options`, or None if it is not set.ÚoptionsN)ÚHasFieldr)Zdescriptor_protorrrÚ_OptionsOrNonefs
rcCs6|jo4|jjo4|j ¡jo4|jtjjko4|j    tjj
kS©N) Ú is_extensionÚcontaining_typeZ has_optionsZ
GetOptionsZmessage_set_wire_formatÚtyperÚFieldDescriptorÚ TYPE_MESSAGEÚlabelZLABEL_OPTIONAL)ÚfieldrrrÚ_IsMessageSetExtensionnsÿ
þ ý ür%c@s„eZdZdZerdXdd„ZdYdd„Zdd„Zd    d
„Zd d „Z    e
d d„ƒZ dd„Z e
dd„ƒZ dd„Ze
dd„ƒZdd„Ze
dd„ƒZdd„Ze
dd„ƒZdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Z d9d:„Z!d;d<„Z"d=d>„Z#d?d@„Z$dZdAdB„Z%d[dDdE„Z&d\dFdG„Z'dHdI„Z(dJdK„Z)dLdM„Z*dNdO„Z+dPdQ„Z,dRdS„Z-d]dTdU„Z.dVdW„Z/dS)^ÚDescriptorPoolzGA collection of protobufs dynamically constructed by descriptor protos.NcCs tj |¡Sr)rÚ_messager&)ÚclsÚ descriptor_dbrrrÚ__new__{szDescriptorPool.__new__cCsVt ¡|_||_i|_i|_i|_i|_i|_i|_    i|_
t   t ¡|_t   t ¡|_dS)aîInitializes a Pool of proto buffs.
 
    The descriptor_db argument to the constructor is provided to allow
    specialized file descriptor proto lookup code to be triggered on demand. An
    example would be an implementation which will read and compile a file
    specified in a call to FindFileByName() and not require the call to Add()
    at all. Results from this database will be cached internally here as well.
 
    Args:
      descriptor_db: A secondary source of file descriptors.
    N)rZDescriptorDatabaseÚ _internal_dbÚ_descriptor_dbÚ _descriptorsÚ_enum_descriptorsÚ_service_descriptorsÚ_file_descriptorsÚ_toplevel_extensionsÚ _file_desc_by_toplevel_extensionÚ_top_enum_valuesÚ collectionsÚ defaultdictÚdictÚ_extensions_by_nameÚ_extensions_by_number)Úselfr)rrrÚ__init__s
 zDescriptorPool.__init__c    CsÄ|jtjf|jtjf|jtjf|jtjf|j    tj
ffD]ˆ\}}||kr6||}t |tj
ƒrf|j j j}n|j j}t ||ƒr€||kr¸d|d|d|d}t |tj
ƒr°|d7}t|ƒ‚dSq6dS)aCheck if the descriptor name conflicts with another of the same name.
 
    Args:
      desc: Descriptor of a message, enum, service, extension or enum value.
      desc_name (str): the full name of desc.
      file_name (str): The file name of descriptor.
    zConflict register for file "z": z is already defined in file "zo". Please fix the conflict by adding package name on the proto file, or use different name for the duplication.zQ
Note: enum values appear as siblings of the enum type instead of children of it.N)r-rÚ
Descriptorr.ÚEnumDescriptorr/ÚServiceDescriptorr1r!r3ÚEnumValueDescriptorÚ
isinstancer ÚfilerÚ    TypeError)    r9ÚdescÚ    desc_nameÚ    file_nameÚregisterZdescriptor_typeZold_descZold_fileÚ    error_msgrrrÚ_CheckConflictRegisters:    
 
 
 
 
û   
ÿÿÿþýý z%DescriptorPool._CheckConflictRegistercCs|j |¡dS)z‘Adds the FileDescriptorProto and its types to this pool.
 
    Args:
      file_desc_proto (FileDescriptorProto): The file descriptor to add.
    N)r+ÚAdd)r9Úfile_desc_protorrrrHÃszDescriptorPool.AddcCs,ddlm}|j |¡}| |¡}||_|S)aAdds the FileDescriptorProto and its types to this pool.
 
    Args:
      serialized_file_desc_proto (bytes): A bytes string, serialization of the
        :class:`FileDescriptorProto` to add.
 
    Returns:
      FileDescriptor: Descriptor for the added file.
    r)Údescriptor_pb2)Úgoogle.protobufrJZFileDescriptorProtoZ
FromStringÚ!_ConvertFileProtoToFileDescriptorÚ serialized_pb)r9Zserialized_file_desc_protorJrIÚ    file_descrrrÚAddSerializedFileÌs ÿ
z DescriptorPool.AddSerializedFilecCs| |¡dSr)Ú_AddDescriptor©r9rBrrrÚ AddDescriptorászDescriptorPool.AddDescriptorcCsDt|tjƒstdƒ‚| ||j|jj¡||j|j<|     |j¡dS)aAdds a Descriptor to the pool, non-recursively.
 
    If the Descriptor contains nested messages or enums, the caller must
    explicitly register them. This method also registers the FileDescriptor
    associated with the message.
 
    Args:
      desc: A Descriptor.
    z+Expected instance of descriptor.Descriptor.N)
r?rr;rArGÚ    full_namer@rr-Ú_AddFileDescriptorrQrrrrPæs
 
 zDescriptorPool._AddDescriptorcCs| |¡dSr)Ú_AddEnumDescriptor)r9Ú    enum_descrrrÚAddEnumDescriptorúsz DescriptorPool.AddEnumDescriptorcCsÌt|tjƒstdƒ‚|jj}| ||j|¡||j|j<|jj    r`|j 
d¡|jj     
d¡dk}n|j 
d¡dk}|r¼|jj}|jj    }|j D]0}t d  ||jf¡ƒ}| |||¡||j|<qŠ| |j¡dS)z¤Adds an EnumDescriptor to the pool.
 
    This method also registers the FileDescriptor associated with the enum.
 
    Args:
      enum_desc: An EnumDescriptor.
    z/Expected instance of descriptor.EnumDescriptor.rérN)r?rr<rAr@rrGrSr.ÚpackageÚcountÚvaluesrÚjoinr3rT)r9rVrDÚ    top_levelrYZ
enum_valuerSrrrrUÿs,      
 ÿÿ
ÿ z!DescriptorPool._AddEnumDescriptorcCs| |¡dSr)Ú_AddServiceDescriptor©r9Z service_descrrrÚAddServiceDescriptor#sz#DescriptorPool.AddServiceDescriptorcCs8t|tjƒstdƒ‚| ||j|jj¡||j|j<dS)z^Adds a ServiceDescriptor to the pool.
 
    Args:
      service_desc: A ServiceDescriptor.
    z2Expected instance of descriptor.ServiceDescriptor.N)    r?rr=rArGrSr@rr/r_rrrr^(s  
ÿz$DescriptorPool._AddServiceDescriptorcCs| |¡dSr)Ú_AddExtensionDescriptor)r9Ú    extensionrrrÚAddExtensionDescriptor8sz%DescriptorPool.AddExtensionDescriptorcCsÆt|tjƒr|jstdƒ‚|jdkr0||j|j<z|j|j    |j
}Wnt k
rZYn(X||k    r‚t d|j|j|j    j|j
fƒ‚||j|j    |j
<||j |j    |j<t|ƒrÂ||j |j    |jj<dS)a;Adds a FieldDescriptor describing an extension to the pool.
 
    Args:
      extension: A FieldDescriptor.
 
    Raises:
      AssertionError: when another extension with the same number extends the
        same message.
      TypeError: when the specified extension is not a
        descriptor.FieldDescriptor.
    z!Expected an extension descriptor.NzSExtensions "%s" and "%s" both try to extend message type "%s" with field number %d.)r?rr!rrAÚextension_scoper1rSr8rÚnumberÚKeyErrorÚAssertionErrorr7r%Ú message_type)r9rbZ existing_descrrrra=sH ÿ
 ÿÿÿþÿÿ
ÿÿ
ÿÿ
ÿz&DescriptorPool._AddExtensionDescriptorcCs| |¡dSr)Ú_InternalAddFileDescriptor©r9rNrrrÚAddFileDescriptorgsz DescriptorPool.AddFileDescriptorcCs*| |¡|j ¡D]}||j|j<qdS)úËAdds a FileDescriptor to the pool, non-recursively.
 
    If the FileDescriptor contains messages or enums, the caller must explicitly
    register them.
 
    Args:
      file_desc: A FileDescriptor.
    N)rTÚextensions_by_namer[r2rS)r9rNrbrrrrils
 
ÿÿz)DescriptorPool._InternalAddFileDescriptorcCs$t|tjƒstdƒ‚||j|j<dS)rlz/Expected instance of descriptor.FileDescriptor.N)r?rÚFileDescriptorrAr0rrjrrrrT~s
z!DescriptorPool._AddFileDescriptorc
Csˆz |j|WStk
r YnXz|j |¡}Wn:tk
rl}z|jrX|j |¡}n|‚W5d}~XYnX|s~td|ƒ‚| |¡S)aGets a FileDescriptor by file name.
 
    Args:
      file_name (str): The path to the file to get a descriptor for.
 
    Returns:
      FileDescriptor: The descriptor for the named file.
 
    Raises:
      KeyError: if the file cannot be found in the pool.
    NzCannot find a file named %s)r0rfr+ÚFindFileByNamer,rL)r9rDÚ
file_protoÚerrorrrrroŒs   zDescriptorPool.FindFileByNamecCsft|ƒ}z | |¡WStk
r(YnXz| |¡| |¡WStk
r`td|ƒ‚YnXdS)a;Gets the FileDescriptor for the file containing the specified symbol.
 
    Args:
      symbol (str): The name of the symbol to search for.
 
    Returns:
      FileDescriptor: Descriptor for the file that contains the specified
      symbol.
 
    Raises:
      KeyError: if the file cannot be found in the pool.
    ú Cannot find a file containing %sN)rÚ!_InternalFindFileContainingSymbolrfÚ_FindFileContainingSymbolInDb)r9ÚsymbolrrrÚFindFileContainingSymbol©s 
 z'DescriptorPool.FindFileContainingSymbolc    Cs*z|j|jWStk
r"YnXz|j|jWStk
rFYnXz|j|jWStk
rjYnXz|j|jjWStk
rYnXz |j|WStk
r²YnX| d¡\}}}z:|     |¡}||j
ksø||j ksø||j ksøt ‚|jWStt fk
r$td|ƒ‚YnXdS)a<Gets the already built FileDescriptor containing the specified symbol.
 
    Args:
      symbol (str): The name of the symbol to search for.
 
    Returns:
      FileDescriptor: Descriptor for the file that contains the specified
      symbol.
 
    Raises:
      KeyError: if the file cannot be found in the pool.
    rrrN)r-r@rfr.r/r3r r2Ú
rpartitionÚFindMessageTypeByNamermÚfields_by_nameZenum_values_by_namerg)r9ruZtop_nameÚ_Zsub_nameÚmessagerrrrsÄs>  
 ÿþz0DescriptorPool._InternalFindFileContainingSymbolcCs&t|ƒ}||jkr| |¡|j|S)aLoads the named descriptor from the pool.
 
    Args:
      full_name (str): The full name of the descriptor to load.
 
    Returns:
      Descriptor: The descriptor for the named type.
 
    Raises:
      KeyError: if the message cannot be found in the pool.
    )rr-rt©r9rSrrrrxõs 
 
z$DescriptorPool.FindMessageTypeByNamecCs&t|ƒ}||jkr| |¡|j|S)aLoads the named enum descriptor from the pool.
 
    Args:
      full_name (str): The full name of the enum descriptor to load.
 
    Returns:
      EnumDescriptor: The enum descriptor for the named type.
 
    Raises:
      KeyError: if the enum cannot be found in the pool.
    )rr.rtr|rrrÚFindEnumTypeByNames 
 
z!DescriptorPool.FindEnumTypeByNamecCs,t|ƒ}| d¡\}}}| |¡}|j|S)aLoads the named field descriptor from the pool.
 
    Args:
      full_name (str): The full name of the field descriptor to load.
 
    Returns:
      FieldDescriptor: The field descriptor for the named field.
 
    Raises:
      KeyError: if the field cannot be found in the pool.
    r)rrwrxry)r9rSÚ message_namerzÚ
field_nameÚmessage_descriptorrrrÚFindFieldByNames 
zDescriptorPool.FindFieldByNamecCs,t|ƒ}| d¡\}}}| |¡}|j|S)aLoads the named oneof descriptor from the pool.
 
    Args:
      full_name (str): The full name of the oneof descriptor to load.
 
    Returns:
      OneofDescriptor: The oneof descriptor for the named oneof.
 
    Raises:
      KeyError: if the oneof cannot be found in the pool.
    r)rrwrxZoneofs_by_name)r9rSr~rzZ
oneof_namer€rrrÚFindOneofByName*s 
zDescriptorPool.FindOneofByNamecCsrt|ƒ}z |j|WStk
r(YnX| d¡\}}}z| |¡}Wntk
rf| |¡}YnX|j|S)a+Loads the named extension descriptor from the pool.
 
    Args:
      full_name (str): The full name of the extension descriptor to load.
 
    Returns:
      FieldDescriptor: The field descriptor for the named extension.
 
    Raises:
      KeyError: if the extension cannot be found in the pool.
    r)rr1rfrwrxrtrm)r9rSr~rzZextension_nameÚscoperrrÚFindExtensionByName;s  z"DescriptorPool.FindExtensionByNamecCsDz|j||WStk
r>| ||¡|j||YSXdS)aýGets the extension of the specified message with the specified number.
 
    Extensions have to be registered to this pool by calling :func:`Add` or
    :func:`AddExtensionDescriptor`.
 
    Args:
      message_descriptor (Descriptor): descriptor of the extended message.
      number (int): Number of the extension field.
 
    Returns:
      FieldDescriptor: The descriptor for the extension.
 
    Raises:
      KeyError: when no extension with the given number is known for the
        specified message.
    N)r8rfÚ_TryLoadExtensionFromDB)r9r€rerrrÚFindExtensionByNumberYs
 z$DescriptorPool.FindExtensionByNumbercCs\|jrJt|jdƒrJ|j}|j |¡}|D] }||j|kr<q(| ||¡q(t|j| ¡ƒS)a[Gets all the known extensions of a given message.
 
    Extensions have to be registered to this pool by build related
    :func:`Add` or :func:`AddExtensionDescriptor`.
 
    Args:
      message_descriptor (Descriptor): Descriptor of the extended message.
 
    Returns:
      list[FieldDescriptor]: Field descriptors describing the extensions.
    ÚFindAllExtensionNumbers)r,ÚhasattrrSr‡r8r…Úlistr[)r9r€rSZ all_numbersrerrrÚFindAllExtensionsps ÿ z DescriptorPool.FindAllExtensionscCst|js
dSt|jdƒsdS|j}|j ||¡}|dkr:dSz| |¡Wn&d|j|f}t |t¡YnXdS)z´Try to Load extensions from descriptor db.
 
    Args:
      message_descriptor: descriptor of the extended message.
      number: the extension number that needs to be loaded.
    NÚFindFileContainingExtensionz5Unable to load proto file %s for extension number %d.)    r,rˆrSr‹rLrrrÚRuntimeWarning)r9r€rerSrpZwarn_msgrrrr…ˆs*ÿÿÿz&DescriptorPool._TryLoadExtensionFromDBcCs&t|ƒ}||jkr| |¡|j|S)a'Loads the named service descriptor from the pool.
 
    Args:
      full_name (str): The full name of the service descriptor to load.
 
    Returns:
      ServiceDescriptor: The service descriptor for the named service.
 
    Raises:
      KeyError: if the service cannot be found in the pool.
    )rr/rtr|rrrÚFindServiceByName¤s 
 
z DescriptorPool.FindServiceByNamecCs,t|ƒ}| d¡\}}}| |¡}|j|S)a+Loads the named service method descriptor from the pool.
 
    Args:
      full_name (str): The full name of the method descriptor to load.
 
    Returns:
      MethodDescriptor: The method descriptor for the service method.
 
    Raises:
      KeyError: if the method cannot be found in the pool.
    r)rrwrZmethods_by_name)r9rSÚ service_namerzÚ method_nameZservice_descriptorrrrÚFindMethodByNameµs 
zDescriptorPool.FindMethodByNamec
Csfz|j |¡}Wn:tk
rJ}z|jr6|j |¡}n|‚W5d}~XYnX|s\td|ƒ‚| |¡S)a0Finds the file in descriptor DB containing the specified symbol.
 
    Args:
      symbol (str): The name of the symbol to search for.
 
    Returns:
      FileDescriptor: The file that contains the specified symbol.
 
    Raises:
      KeyError: if the file cannot be found in the descriptor database.
    Nrr)r+rvrfr,rL)r9rurprqrrrrtÆs  z,DescriptorPool._FindFileContainingSymbolInDbc sf|jˆjkrtˆ |j¡ƒ}‡fdd„|jDƒ‰‡fdd„|jDƒ}tjˆ|j|j|j    t
|ƒ|  ¡ˆ|tj d    }i}|D]4}|  ˆ |j ¡¡¡|  dd„|j ¡Dƒ¡qz|jD]&}ˆ ||j|||j    ¡}||j|j<q¶|jD]"}    ˆ |    |j|d|d¡|j|    j<qät|jƒD]^\}
} ˆj| |j|
|dd    } ˆ |j| j|¡| _ˆ | | |j|¡| |j| j<|ˆj| j<q|jD]} ˆ  |j| |¡qx|jr¤t!|jƒ}nd
}|jD]"} ˆ || j|¡}||j| j<q®t|j"ƒD]&\}
}ˆ #||
||j|¡|j$|j<qÜ|ˆj|j<ˆj|j}|j ¡D]}ˆ %|¡q&|j ¡D]}|j&D]}ˆ %|¡qLqB|S) aDCreates a FileDescriptor from a proto or returns a cached copy.
 
    This method also has the side effect of loading all the symbols found in
    the file into the appropriate dictionaries in the pool.
 
    Args:
      file_proto: The proto to convert.
 
    Returns:
      A FileDescriptor matching the passed in proto.
    csg|]}ˆ |¡‘qSr)ro)Ú.0Ún©r9rrÚ
<listcomp>ëszDDescriptorPool._ConvertFileProtoToFileDescriptor.<locals>.<listcomp>csg|] }ˆ|‘qSrr)r‘Úi)Ú direct_depsrrr”ìs)    ÚpoolrrYÚsyntaxrrMÚ dependenciesÚpublic_dependenciesÚ
create_keycss|]}t|jƒ|fVqdSr)Ú_PrefixWithDotrS©r‘ÚenumrrrÚ    <genexpr>sÿzCDescriptorPool._ConvertFileProtoToFileDescriptor.<locals>.<genexpr>NT©rÚ)'rr0r‰Ú_GetDepsÚ
dependencyZpublic_dependencyrrnrYr˜rZSerializeToStringÚ_internal_create_keyrÚ_ExtractSymbolsZmessage_types_by_namer[Zenum_types_by_namerhÚ_ConvertMessageDescriptorÚ    enum_typeÚ_ConvertEnumDescriptorÚ    enumeraterbÚ_MakeFieldDescriptorÚ_GetTypeFromScopeÚextendeerÚ _SetFieldTypermr2rSÚ_SetAllFieldTypesrœZserviceÚ_MakeServiceDescriptorZservices_by_nameraÚ
extensions)r9rpZ
built_depsZ public_depsZfile_descriptorrƒr£rhZ message_descr§ÚindexÚextension_protoÚextension_descÚ
desc_protoZdesc_proto_prefixrBÚ service_protorNrbr)r–r9rrLÝs° ö ÿ
ÿ
 
þÿ 
 
ÿÿ þÿÿÿ
ÿ
 
ÿ
ÿÿ  
z0DescriptorPool._ConvertFileProtoToFileDescriptorcs´|rd ||jf¡‰n|j‰ˆdkr*d}nˆj}ˆdkr<i‰‡‡‡‡‡fdd„|jDƒ}‡‡‡‡fdd„|jDƒ}‡‡‡fdd„t|jƒDƒ}    ‡‡‡fdd„t|jƒDƒ}
‡fdd„t|jƒDƒ} d    d„|jDƒ} | rÜd
} nd } t    j
|jˆ|d|    | |||
t |ƒ| | ˆddˆt    j d }|j D] }||_q|jD] }||_q.t|jƒD]>\}}| d ¡rF|j}| |j |    |¡| ||    |_qF|ˆtˆƒ<ˆ ||j|jj¡|ˆjˆ<|S)a¹Adds the proto to the pool in the specified package.
 
    Args:
      desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
      package: The package the proto should be located in.
      file_desc: The file containing this message.
      scope: Dict mapping short and full symbols to message and enum types.
      syntax: string indicating syntax of the file ("proto2" or "proto3")
 
    Returns:
      The added descriptor.
    rNc    sg|]}ˆ |ˆˆˆˆ¡‘qSr)r¦)r‘Únested©rCrNrƒr9r˜rrr”Xsþÿz<DescriptorPool._ConvertMessageDescriptor.<locals>.<listcomp>c
s g|]}ˆ |ˆˆdˆd¡‘qS)NF)r¨r)rCrNrƒr9rrr”\s
þ ÿcs g|]\}}ˆ |ˆ|ˆ¡‘qSr©rª)r‘r±r$©rCrNr9rrr”`sÿc    s$g|]\}}ˆj|ˆ|ˆdd‘qS)Tr r¸)r‘r±rbr¹rrr”bsþ ÿc s<g|]4\}}tj|jd ˆ|jf¡|dgt|ƒtjd‘qS)rN)r›)rZOneofDescriptorrr\rr¤)r‘r±rB)rCrrr”fs ÷øcSsg|]}|j|jf‘qSr)ÚstartÚend)r‘Úrrrrr”ssTF)rrSÚfilenamerÚfieldsÚoneofsÚ nested_typesÚ
enum_typesr°rÚ is_extendableÚextension_rangesr@Zserialized_startZserialized_endr˜r›Ú oneof_index)r\rÚ nested_typer§r©r$rbZ
oneof_declZextension_rangerr;rr¤rÀrrÁrrÄr¾ÚappendZcontaining_oneofrœrGrSr@r-)r9r´rYrNrƒr˜rDr¶Úenumsr¾r°r¿rÃrÂrBržZ field_indexÚ
field_descrÄrr·rr¦<svýýÿý
õ î
 
 
 
 
z(DescriptorPool._ConvertMessageDescriptorFc
sÒ|rd ||jf¡}n|j}|dkr*d}n|j}‡fdd„t|jƒDƒ}    tj|j||||    |t|ƒtjd}
|
|d|<ˆ |
|
j    |
j
j¡|
ˆj |<|rÎ|    D]0} t d || jf¡ƒ} ˆ | | |¡| ˆj | <qœ|
S)a%Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.
 
    Args:
      enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
      package: Optional package name for the new message EnumDescriptor.
      file_desc: The file containing the enum descriptor.
      containing_type: The type containing this enum.
      scope: Scope containing available types.
      top_level: If True, the enum is a top level symbol. If False, the enum
          is defined inside a message.
 
    Returns:
      The added descriptor
    rNcsg|]\}}ˆ ||¡‘qSr)Ú_MakeEnumValueDescriptor)r‘r±Úvaluer“rrr”µsÿz9DescriptorPool._ConvertEnumDescriptor.<locals>.<listcomp>)rrSr½r@r[rrr›ú.%s)r\rr©rÊrr<rr¤rGrSr@r.rr3) r9Z
enum_protorYrNrrƒr]Z    enum_namerDr[rBrÊrSrr“rr¨šs:
ÿø     
ÿ z%DescriptorPool._ConvertEnumDescriptorcCsj|rd ||jf¡}n|j}|jr*|j}nd}tj|j|||j|jdddd|jdd|dt|ƒ||tj    dS)a£Creates a field descriptor from a FieldDescriptorProto.
 
    For message and enum type fields, this method will do a look up
    in the pool for the appropriate descriptor for that type. If it
    is unavailable, it will fall back to the _source function to
    create it. If this type is still unavailable, construction will
    fail.
 
    Args:
      field_proto: The proto describing the field.
      message_name: The name of the containing message.
      index: Index of the field
      file_desc: The file containing the field descriptor.
      is_extension: Indication that this field is for an extension.
 
    Returns:
      An initialized FieldDescriptor object
    rNF)rrSr±rer Úcpp_typerhr§rr#Úhas_default_valueÚ default_valuerrdrÚ    json_namer@r›)
r\rrÏrr!rer r#rr¤)r9Ú field_protor~r±rNrrSrÏrrrrªÎs4íz#DescriptorPool._MakeFieldDescriptorc Cs¼t|ƒ}| ||j|¡}|dkr,t|jƒ}nd ||jg¡}t|j|jƒD]\}}| ||||¡qJt|j|j    ƒD]*\}}    | ||j
|¡|    _ | ||    ||¡qr|j D]}
|  ||
|¡q¤dS)aSets all the descriptor's fields's types.
 
    This method also sets the containing types on any extensions.
 
    Args:
      package: The current package of desc_proto.
      desc_proto: The message descriptor to update.
      scope: Enclosing scope of available types.
    rN)rœr«rr\Úzipr$r¾r­rbr°r¬rrÅr®) r9rYr´rƒZ    main_descZnested_packagerÐrÈr²r³rÅrrrr®s"   ÿ
ÿ
z DescriptorPool._SetAllFieldTypescCsh|jr| ||j|¡}nd}| d¡sHt|tjƒr>tjj|_n
tjj    |_tj 
|j¡|_ |jtjjkst|jtjj krz||_ |jtjj    krŽ||_|jtjjkr¬d|_g|_n°| d¡rŽd|_|jtjjksÚ|jtjjkrèt|jƒ|_n¤|jtjjkr|j|_nŠ|jtjjkr$|j ¡dk|_nh|jtjj    krH|jj|jj|_nD|jtjjkrht |j¡|_n$|jtjjkr€d|_n t|jƒ|_nÎd|_|jtjjks´|jtjjkr¼d|_n |jtjjkrÔd|_nˆ|jtjjkrìd|_np|jtjj    kr|jjd    j|_nN|jtjjkr&d
|_n6|jtjjkr>d|_n|jtjj krVd|_nd    |_|j|_dS) aSets the field's type, cpp_type, message_type and enum_type.
 
    Args:
      field_proto: Data about the field in proto format.
      field_desc: The descriptor to modify.
      package: The package the field's container is in.
      scope: Enclosing scope of available types.
    Nr FrÎTÚtruegr¡ró) Ú    type_namer«rr?rr;r!r"r Z    TYPE_ENUMZProtoTypeToCppProtoTyperÌZ
TYPE_GROUPrhr§r#ZLABEL_REPEATEDrÍrÎZ TYPE_DOUBLEZ
TYPE_FLOATÚfloatZ TYPE_STRINGZ    TYPE_BOOLÚlowerZvalues_by_namereZ
TYPE_BYTESrZ    CUnescapeÚintr[)r9rÐrÈrYrƒrBrrrr­"sv    
 
ÿ ÿ
  ÿ
ÿ
ÿ ÿzDescriptorPool._SetFieldTypecCs tj|j||jt|ƒdtjdS)zðCreates a enum value descriptor object from a enum value proto.
 
    Args:
      value_proto: The proto describing the enum value.
      index: The index of the enum value.
 
    Returns:
      An initialized EnumValueDescriptor object.
    N)rr±rerr r›)rr>rrerr¤)r9Z value_protor±rrrrÉns ùz'DescriptorPool._MakeEnumValueDescriptorc    s|ˆrd ˆ|jf¡‰n|j‰‡‡‡‡fdd„t|jƒDƒ}tj|jˆ||t|ƒ|tjd}ˆ ||j    |j
j¡|ˆj ˆ<|S)aÙMake a protobuf ServiceDescriptor given a ServiceDescriptorProto.
 
    Args:
      service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message.
      service_index: The index of the service in the File.
      scope: Dict mapping short and full symbols to message and enum types.
      package: Optional package name for the new message EnumDescriptor.
      file_desc: The file containing the service descriptor.
 
    Returns:
      The added descriptor.
    rc    s"g|]\}}ˆ |ˆˆˆ|¡‘qSr)Ú_MakeMethodDescriptor)r‘r±Ú method_proto©rYrƒr9rŽrrr”–s
þ
ÿz9DescriptorPool._MakeServiceDescriptor.<locals>.<listcomp>)rrSr±Úmethodsrr@r›) r\rr©Úmethodrr=rr¤rGrSr@r/)r9rµZ service_indexrƒrYrNrÛrBrrÚrr¯‚s$þø    
z%DescriptorPool._MakeServiceDescriptorc     CsZd ||jf¡}| ||j|¡}| ||j|¡}tj|j||d|||j|jt    |ƒtj
d
S)aCreates a method descriptor from a MethodDescriptorProto.
 
    Args:
      method_proto: The proto describing the method.
      service_name: The name of the containing service.
      package: Optional package name to look up for types.
      scope: Scope containing available types.
      index: Index of the method in the service.
 
    Returns:
      An initialized MethodDescriptor object.
    rN)
rrSr±Zcontaining_serviceÚ
input_typeÚ output_typeÚclient_streamingÚserver_streamingrr›) r\rr«rÝrÞrZMethodDescriptorrßràrr¤)    r9rÙrŽrYrƒr±rSrÝrÞrrrrئs.ÿÿõz$DescriptorPool._MakeMethodDescriptorccsR|D]H}t|jƒ|fV| |j¡D]
}|Vq$|jD]}t|jƒ|fVq6qdS)zÌPulls out all the symbols from descriptor protos.
 
    Args:
      descriptors: The messages to extract descriptors from.
    Yields:
      A two element tuple of the type name and descriptor object.
    N)rœrSr¥rÀrÁ)r9Z descriptorsrBruržrrrr¥Æs     
zDescriptorPool._ExtractSymbolsccs\|ptƒ}|D]H}||kr| |¡| |¡}|Vdd„|jDƒ}| ||¡EdHqdS)zæRecursively finds dependencies for file protos.
 
    Args:
      dependencies: The names of the files being depended on.
      visited: The names of files already found.
 
    Yields:
      Each direct and indirect dependency.
    cSsg|]
}|j‘qSrr)r‘Údrrrr”çsz+DescriptorPool._GetDeps.<locals>.<listcomp>N)ÚsetÚaddroršr¢)r9r™Úvisitedr£Zdep_descZ public_filesrrrr¢Ös
 
 
zDescriptorPool._GetDepscCsN||krFt|ƒ d¡}|rFd ||g¡}||kr:|}qFq| d¡q||S)a?Finds a given type name in the current scope.
 
    Args:
      package: The package the proto should be located in.
      type_name: The name of the type to be found in the scope.
      scope: Dict mapping short and full symbols to message and enum types.
 
    Returns:
      The descriptor for the requested type.
    réÿÿÿÿ)rœÚsplitr\Úpop)r9rYrÔrƒÚ
componentsZpossible_matchrrrr«ês  z DescriptorPool._GetTypeFromScope)N)N)NNNN)NNNNF)F)N)0rÚ
__module__Ú __qualname__rÚ_USE_C_DESCRIPTORSr*r:rGrHrOrrRrPrWrUr`r^rcrarkrirTrorvrsrxr}rr‚r„r†rŠr…rrrtrLr¦r¨rªr®r­rÉr¯rØr¥r¢r«rrrrr&vsr
 
&    
 
$
 
*
1_ÿ
^ÿ
5ÿ
4 L$ 
r&cCs| d¡r|Sd|S)NrrË)Ú
startswithrrrrrœsrœcCstSr)Ú_DEFAULTrrrrÚDefaultsrî)rÚ
__author__r4rrKrrrrërrrr%Úobjectr&rœr'Z default_poolrírîrrrrÚ<module>s4