1
+ from google .protobuf .internal .enum_type_wrapper import (
2
+ EnumTypeWrapper ,
3
+ )
1
4
from google .protobuf .internal .containers import (
2
5
RepeatedCompositeFieldContainer ,
3
6
RepeatedScalarFieldContainer ,
@@ -12,6 +15,7 @@ from typing import (
12
15
Text ,
13
16
Tuple ,
14
17
cast ,
18
+ NewType ,
15
19
)
16
20
17
21
@@ -171,66 +175,38 @@ class ExtensionRangeOptions(Message):
171
175
def FromString (cls , s : bytes ) -> ExtensionRangeOptions : ...
172
176
173
177
174
- class FieldDescriptorProto (Message ):
178
+ _FieldDescriptorProto_Type = NewType ('_FieldDescriptorProto_Type' , int )
179
+ _FieldDescriptorProto_Label = NewType ('_FieldDescriptorProto_Label' , int )
175
180
176
- class Type (int ):
177
181
178
- @classmethod
179
- def Name (cls , number : int ) -> bytes : ...
180
-
181
- @classmethod
182
- def Value (cls , name : bytes ) -> FieldDescriptorProto .Type : ...
183
-
184
- @classmethod
185
- def keys (cls ) -> List [bytes ]: ...
186
-
187
- @classmethod
188
- def values (cls ) -> List [FieldDescriptorProto .Type ]: ...
189
-
190
- @classmethod
191
- def items (cls ) -> List [Tuple [bytes , FieldDescriptorProto .Type ]]: ...
192
- TYPE_DOUBLE : Type
193
- TYPE_FLOAT : Type
194
- TYPE_INT64 : Type
195
- TYPE_UINT64 : Type
196
- TYPE_INT32 : Type
197
- TYPE_FIXED64 : Type
198
- TYPE_FIXED32 : Type
199
- TYPE_BOOL : Type
200
- TYPE_STRING : Type
201
- TYPE_GROUP : Type
202
- TYPE_MESSAGE : Type
203
- TYPE_BYTES : Type
204
- TYPE_UINT32 : Type
205
- TYPE_ENUM : Type
206
- TYPE_SFIXED32 : Type
207
- TYPE_SFIXED64 : Type
208
- TYPE_SINT32 : Type
209
- TYPE_SINT64 : Type
210
-
211
- class Label (int ):
212
-
213
- @classmethod
214
- def Name (cls , number : int ) -> bytes : ...
215
-
216
- @classmethod
217
- def Value (cls , name : bytes ) -> FieldDescriptorProto .Label : ...
218
-
219
- @classmethod
220
- def keys (cls ) -> List [bytes ]: ...
221
-
222
- @classmethod
223
- def values (cls ) -> List [FieldDescriptorProto .Label ]: ...
224
-
225
- @classmethod
226
- def items (cls ) -> List [Tuple [bytes , FieldDescriptorProto .Label ]]: ...
227
- LABEL_OPTIONAL : Label
228
- LABEL_REQUIRED : Label
229
- LABEL_REPEATED : Label
182
+ class FieldDescriptorProto (Message ):
183
+ Type : EnumTypeWrapper [_FieldDescriptorProto_Type ]
184
+ TYPE_DOUBLE : _FieldDescriptorProto_Type
185
+ TYPE_FLOAT : _FieldDescriptorProto_Type
186
+ TYPE_INT64 : _FieldDescriptorProto_Type
187
+ TYPE_UINT64 : _FieldDescriptorProto_Type
188
+ TYPE_INT32 : _FieldDescriptorProto_Type
189
+ TYPE_FIXED64 : _FieldDescriptorProto_Type
190
+ TYPE_FIXED32 : _FieldDescriptorProto_Type
191
+ TYPE_BOOL : _FieldDescriptorProto_Type
192
+ TYPE_STRING : _FieldDescriptorProto_Type
193
+ TYPE_GROUP : _FieldDescriptorProto_Type
194
+ TYPE_MESSAGE : _FieldDescriptorProto_Type
195
+ TYPE_BYTES : _FieldDescriptorProto_Type
196
+ TYPE_UINT32 : _FieldDescriptorProto_Type
197
+ TYPE_ENUM : _FieldDescriptorProto_Type
198
+ TYPE_SFIXED32 : _FieldDescriptorProto_Type
199
+ TYPE_SFIXED64 : _FieldDescriptorProto_Type
200
+ TYPE_SINT32 : _FieldDescriptorProto_Type
201
+ TYPE_SINT64 : _FieldDescriptorProto_Type
202
+ Label : EnumTypeWrapper [_FieldDescriptorProto_Label ]
203
+ LABEL_OPTIONAL : _FieldDescriptorProto_Label
204
+ LABEL_REQUIRED : _FieldDescriptorProto_Label
205
+ LABEL_REPEATED : _FieldDescriptorProto_Label
230
206
name = ... # type: Text
231
207
number = ... # type: int
232
- label = ... # type: FieldDescriptorProto.Label
233
- type = ... # type: FieldDescriptorProto.Type
208
+ label = ... # type: _FieldDescriptorProto_Label
209
+ type = ... # type: _FieldDescriptorProto_Type
234
210
type_name = ... # type: Text
235
211
extendee = ... # type: Text
236
212
default_value = ... # type: Text
@@ -243,8 +219,8 @@ class FieldDescriptorProto(Message):
243
219
def __init__ (self ,
244
220
name : Optional [Text ] = ...,
245
221
number : Optional [int ] = ...,
246
- label : Optional [FieldDescriptorProto . Label ] = ...,
247
- type : Optional [FieldDescriptorProto . Type ] = ...,
222
+ label : Optional [_FieldDescriptorProto_Label ] = ...,
223
+ type : Optional [_FieldDescriptorProto_Type ] = ...,
248
224
type_name : Optional [Text ] = ...,
249
225
extendee : Optional [Text ] = ...,
250
226
default_value : Optional [Text ] = ...,
@@ -372,33 +348,20 @@ class MethodDescriptorProto(Message):
372
348
def FromString (cls , s : bytes ) -> MethodDescriptorProto : ...
373
349
374
350
375
- class FileOptions (Message ):
376
-
377
- class OptimizeMode (int ):
378
-
379
- @classmethod
380
- def Name (cls , number : int ) -> bytes : ...
381
-
382
- @classmethod
383
- def Value (cls , name : bytes ) -> FileOptions .OptimizeMode : ...
384
-
385
- @classmethod
386
- def keys (cls ) -> List [bytes ]: ...
351
+ _FileOptions_OptimizeMode = NewType ('_FileOptions_OptimizeMode' , int )
387
352
388
- @classmethod
389
- def values (cls ) -> List [FileOptions .OptimizeMode ]: ...
390
353
391
- @ classmethod
392
- def items ( cls ) -> List [ Tuple [ bytes , FileOptions . OptimizeMode ]]: ...
393
- SPEED : OptimizeMode
394
- CODE_SIZE : OptimizeMode
395
- LITE_RUNTIME : OptimizeMode
354
+ class FileOptions ( Message ):
355
+ OptimizeMode : EnumTypeWrapper [ _FileOptions_OptimizeMode ]
356
+ SPEED : _FileOptions_OptimizeMode
357
+ CODE_SIZE : _FileOptions_OptimizeMode
358
+ LITE_RUNTIME : _FileOptions_OptimizeMode
396
359
java_package = ... # type: Text
397
360
java_outer_classname = ... # type: Text
398
361
java_multiple_files = ... # type: bool
399
362
java_generate_equals_and_hash = ... # type: bool
400
363
java_string_check_utf8 = ... # type: bool
401
- optimize_for = ... # type: FileOptions.OptimizeMode
364
+ optimize_for = ... # type: _FileOptions_OptimizeMode
402
365
go_package = ... # type: Text
403
366
cc_generic_services = ... # type: bool
404
367
java_generic_services = ... # type: bool
@@ -422,7 +385,7 @@ class FileOptions(Message):
422
385
java_multiple_files : Optional [bool ] = ...,
423
386
java_generate_equals_and_hash : Optional [bool ] = ...,
424
387
java_string_check_utf8 : Optional [bool ] = ...,
425
- optimize_for : Optional [FileOptions . OptimizeMode ] = ...,
388
+ optimize_for : Optional [_FileOptions_OptimizeMode ] = ...,
426
389
go_package : Optional [Text ] = ...,
427
390
cc_generic_services : Optional [bool ] = ...,
428
391
java_generic_services : Optional [bool ] = ...,
@@ -464,50 +427,22 @@ class MessageOptions(Message):
464
427
def FromString (cls , s : bytes ) -> MessageOptions : ...
465
428
466
429
467
- class FieldOptions (Message ):
468
-
469
- class CType (int ):
430
+ _FieldOptions_CType = NewType ('_FieldOptions_CType' , int )
431
+ _FieldOptions_JSType = NewType ('_FieldOptions_JSType' , int )
470
432
471
- @classmethod
472
- def Name (cls , number : int ) -> bytes : ...
473
-
474
- @classmethod
475
- def Value (cls , name : bytes ) -> FieldOptions .CType : ...
476
-
477
- @classmethod
478
- def keys (cls ) -> List [bytes ]: ...
479
-
480
- @classmethod
481
- def values (cls ) -> List [FieldOptions .CType ]: ...
482
433
483
- @classmethod
484
- def items (cls ) -> List [Tuple [bytes , FieldOptions .CType ]]: ...
485
- STRING : CType
486
- CORD : CType
487
- STRING_PIECE : CType
488
-
489
- class JSType (int ):
490
-
491
- @classmethod
492
- def Name (cls , number : int ) -> bytes : ...
493
-
494
- @classmethod
495
- def Value (cls , name : bytes ) -> FieldOptions .JSType : ...
496
-
497
- @classmethod
498
- def keys (cls ) -> List [bytes ]: ...
499
-
500
- @classmethod
501
- def values (cls ) -> List [FieldOptions .JSType ]: ...
502
-
503
- @classmethod
504
- def items (cls ) -> List [Tuple [bytes , FieldOptions .JSType ]]: ...
505
- JS_NORMAL : JSType
506
- JS_STRING : JSType
507
- JS_NUMBER : JSType
508
- ctype = ... # type: FieldOptions.CType
434
+ class FieldOptions (Message ):
435
+ CType : EnumTypeWrapper [_FieldOptions_CType ]
436
+ STRING : _FieldOptions_CType
437
+ CORD : _FieldOptions_CType
438
+ STRING_PIECE : _FieldOptions_CType
439
+ JSType : EnumTypeWrapper [_FieldOptions_JSType ]
440
+ JS_NORMAL : _FieldOptions_JSType
441
+ JS_STRING : _FieldOptions_JSType
442
+ JS_NUMBER : _FieldOptions_JSType
443
+ ctype = ... # type: _FieldOptions_CType
509
444
packed = ... # type: bool
510
- jstype = ... # type: FieldOptions.JSType
445
+ jstype = ... # type: _FieldOptions_JSType
511
446
lazy = ... # type: bool
512
447
deprecated = ... # type: bool
513
448
weak = ... # type: bool
@@ -517,9 +452,9 @@ class FieldOptions(Message):
517
452
self ) -> RepeatedCompositeFieldContainer [UninterpretedOption ]: ...
518
453
519
454
def __init__ (self ,
520
- ctype : Optional [FieldOptions . CType ] = ...,
455
+ ctype : Optional [_FieldOptions_CType ] = ...,
521
456
packed : Optional [bool ] = ...,
522
- jstype : Optional [FieldOptions . JSType ] = ...,
457
+ jstype : Optional [_FieldOptions_JSType ] = ...,
523
458
lazy : Optional [bool ] = ...,
524
459
deprecated : Optional [bool ] = ...,
525
460
weak : Optional [bool ] = ...,
@@ -594,37 +529,24 @@ class ServiceOptions(Message):
594
529
def FromString (cls , s : bytes ) -> ServiceOptions : ...
595
530
596
531
597
- class MethodOptions (Message ):
598
-
599
- class IdempotencyLevel (int ):
600
-
601
- @classmethod
602
- def Name (cls , number : int ) -> bytes : ...
603
-
604
- @classmethod
605
- def Value (cls , name : bytes ) -> MethodOptions .IdempotencyLevel : ...
606
-
607
- @classmethod
608
- def keys (cls ) -> List [bytes ]: ...
532
+ _MethodOptions_IdempotencyLevel = NewType ('_MethodOptions_IdempotencyLevel' , int )
609
533
610
- @classmethod
611
- def values (cls ) -> List [MethodOptions .IdempotencyLevel ]: ...
612
534
613
- @ classmethod
614
- def items ( cls ) -> List [ Tuple [ bytes , MethodOptions . IdempotencyLevel ]]: ...
615
- IDEMPOTENCY_UNKNOWN : IdempotencyLevel
616
- NO_SIDE_EFFECTS : IdempotencyLevel
617
- IDEMPOTENT : IdempotencyLevel
535
+ class MethodOptions ( Message ):
536
+ IdempotencyLevel : EnumTypeWrapper [ _MethodOptions_IdempotencyLevel ]
537
+ IDEMPOTENCY_UNKNOWN : _MethodOptions_IdempotencyLevel
538
+ NO_SIDE_EFFECTS : _MethodOptions_IdempotencyLevel
539
+ IDEMPOTENT : _MethodOptions_IdempotencyLevel
618
540
deprecated = ... # type: bool
619
- idempotency_level = ... # type: MethodOptions.IdempotencyLevel
541
+ idempotency_level = ... # type: _MethodOptions_IdempotencyLevel
620
542
621
543
@property
622
544
def uninterpreted_option (
623
545
self ) -> RepeatedCompositeFieldContainer [UninterpretedOption ]: ...
624
546
625
547
def __init__ (self ,
626
548
deprecated : Optional [bool ] = ...,
627
- idempotency_level : Optional [MethodOptions . IdempotencyLevel ] = ...,
549
+ idempotency_level : Optional [_MethodOptions_IdempotencyLevel ] = ...,
628
550
uninterpreted_option : Optional [Iterable [UninterpretedOption ]] = ...,
629
551
) -> None : ...
630
552
0 commit comments