pyspiral 0.6.6__cp312-abi3-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. pyspiral-0.6.6.dist-info/METADATA +51 -0
  2. pyspiral-0.6.6.dist-info/RECORD +102 -0
  3. pyspiral-0.6.6.dist-info/WHEEL +4 -0
  4. pyspiral-0.6.6.dist-info/entry_points.txt +2 -0
  5. spiral/__init__.py +35 -0
  6. spiral/_lib.abi3.so +0 -0
  7. spiral/adbc.py +411 -0
  8. spiral/api/__init__.py +78 -0
  9. spiral/api/admin.py +15 -0
  10. spiral/api/client.py +164 -0
  11. spiral/api/filesystems.py +134 -0
  12. spiral/api/key_space_indexes.py +23 -0
  13. spiral/api/organizations.py +77 -0
  14. spiral/api/projects.py +219 -0
  15. spiral/api/telemetry.py +19 -0
  16. spiral/api/text_indexes.py +56 -0
  17. spiral/api/types.py +22 -0
  18. spiral/api/workers.py +40 -0
  19. spiral/api/workloads.py +52 -0
  20. spiral/arrow_.py +216 -0
  21. spiral/cli/__init__.py +88 -0
  22. spiral/cli/__main__.py +4 -0
  23. spiral/cli/admin.py +14 -0
  24. spiral/cli/app.py +104 -0
  25. spiral/cli/console.py +95 -0
  26. spiral/cli/fs.py +76 -0
  27. spiral/cli/iceberg.py +97 -0
  28. spiral/cli/key_spaces.py +89 -0
  29. spiral/cli/login.py +24 -0
  30. spiral/cli/orgs.py +89 -0
  31. spiral/cli/printer.py +53 -0
  32. spiral/cli/projects.py +147 -0
  33. spiral/cli/state.py +5 -0
  34. spiral/cli/tables.py +174 -0
  35. spiral/cli/telemetry.py +17 -0
  36. spiral/cli/text.py +115 -0
  37. spiral/cli/types.py +50 -0
  38. spiral/cli/workloads.py +58 -0
  39. spiral/client.py +178 -0
  40. spiral/core/__init__.pyi +0 -0
  41. spiral/core/_tools/__init__.pyi +5 -0
  42. spiral/core/authn/__init__.pyi +27 -0
  43. spiral/core/client/__init__.pyi +237 -0
  44. spiral/core/table/__init__.pyi +101 -0
  45. spiral/core/table/manifests/__init__.pyi +35 -0
  46. spiral/core/table/metastore/__init__.pyi +58 -0
  47. spiral/core/table/spec/__init__.pyi +213 -0
  48. spiral/dataloader.py +285 -0
  49. spiral/dataset.py +255 -0
  50. spiral/datetime_.py +27 -0
  51. spiral/debug/__init__.py +0 -0
  52. spiral/debug/manifests.py +87 -0
  53. spiral/debug/metrics.py +56 -0
  54. spiral/debug/scan.py +266 -0
  55. spiral/expressions/__init__.py +276 -0
  56. spiral/expressions/base.py +157 -0
  57. spiral/expressions/http.py +86 -0
  58. spiral/expressions/io.py +100 -0
  59. spiral/expressions/list_.py +68 -0
  60. spiral/expressions/mp4.py +62 -0
  61. spiral/expressions/png.py +18 -0
  62. spiral/expressions/qoi.py +18 -0
  63. spiral/expressions/refs.py +58 -0
  64. spiral/expressions/str_.py +39 -0
  65. spiral/expressions/struct.py +59 -0
  66. spiral/expressions/text.py +62 -0
  67. spiral/expressions/tiff.py +223 -0
  68. spiral/expressions/udf.py +46 -0
  69. spiral/grpc_.py +32 -0
  70. spiral/iceberg.py +31 -0
  71. spiral/iterable_dataset.py +106 -0
  72. spiral/key_space_index.py +44 -0
  73. spiral/project.py +199 -0
  74. spiral/protogen/_/__init__.py +0 -0
  75. spiral/protogen/_/arrow/__init__.py +0 -0
  76. spiral/protogen/_/arrow/flight/__init__.py +0 -0
  77. spiral/protogen/_/arrow/flight/protocol/__init__.py +0 -0
  78. spiral/protogen/_/arrow/flight/protocol/sql/__init__.py +2548 -0
  79. spiral/protogen/_/google/__init__.py +0 -0
  80. spiral/protogen/_/google/protobuf/__init__.py +2310 -0
  81. spiral/protogen/_/message_pool.py +3 -0
  82. spiral/protogen/_/py.typed +0 -0
  83. spiral/protogen/_/scandal/__init__.py +190 -0
  84. spiral/protogen/_/spfs/__init__.py +72 -0
  85. spiral/protogen/_/spql/__init__.py +61 -0
  86. spiral/protogen/_/substrait/__init__.py +6196 -0
  87. spiral/protogen/_/substrait/extensions/__init__.py +169 -0
  88. spiral/protogen/__init__.py +0 -0
  89. spiral/protogen/util.py +41 -0
  90. spiral/py.typed +0 -0
  91. spiral/scan.py +285 -0
  92. spiral/server.py +17 -0
  93. spiral/settings.py +114 -0
  94. spiral/snapshot.py +56 -0
  95. spiral/streaming_/__init__.py +3 -0
  96. spiral/streaming_/reader.py +133 -0
  97. spiral/streaming_/stream.py +157 -0
  98. spiral/substrait_.py +274 -0
  99. spiral/table.py +293 -0
  100. spiral/text_index.py +17 -0
  101. spiral/transaction.py +58 -0
  102. spiral/types_.py +6 -0
@@ -0,0 +1,2310 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # sources: google/protobuf/any.proto, google/protobuf/descriptor.proto, google/protobuf/empty.proto
3
+ # plugin: python-betterproto2
4
+ # This file has been @generated
5
+
6
+ __all__ = (
7
+ "Any",
8
+ "DescriptorProto",
9
+ "DescriptorProtoExtensionRange",
10
+ "DescriptorProtoReservedRange",
11
+ "Edition",
12
+ "Empty",
13
+ "EnumDescriptorProto",
14
+ "EnumDescriptorProtoEnumReservedRange",
15
+ "EnumOptions",
16
+ "EnumValueDescriptorProto",
17
+ "EnumValueOptions",
18
+ "ExtensionRangeOptions",
19
+ "ExtensionRangeOptionsDeclaration",
20
+ "ExtensionRangeOptionsVerificationState",
21
+ "FeatureSet",
22
+ "FeatureSetDefaults",
23
+ "FeatureSetDefaultsFeatureSetEditionDefault",
24
+ "FeatureSetEnforceNamingStyle",
25
+ "FeatureSetEnumType",
26
+ "FeatureSetFieldPresence",
27
+ "FeatureSetJsonFormat",
28
+ "FeatureSetMessageEncoding",
29
+ "FeatureSetRepeatedFieldEncoding",
30
+ "FeatureSetUtf8Validation",
31
+ "FeatureSetVisibilityFeature",
32
+ "FeatureSetVisibilityFeatureDefaultSymbolVisibility",
33
+ "FieldDescriptorProto",
34
+ "FieldDescriptorProtoLabel",
35
+ "FieldDescriptorProtoType",
36
+ "FieldOptions",
37
+ "FieldOptionsCType",
38
+ "FieldOptionsEditionDefault",
39
+ "FieldOptionsFeatureSupport",
40
+ "FieldOptionsJsType",
41
+ "FieldOptionsOptionRetention",
42
+ "FieldOptionsOptionTargetType",
43
+ "FileDescriptorProto",
44
+ "FileDescriptorSet",
45
+ "FileOptions",
46
+ "FileOptionsOptimizeMode",
47
+ "GeneratedCodeInfo",
48
+ "GeneratedCodeInfoAnnotation",
49
+ "GeneratedCodeInfoAnnotationSemantic",
50
+ "MessageOptions",
51
+ "MethodDescriptorProto",
52
+ "MethodOptions",
53
+ "MethodOptionsIdempotencyLevel",
54
+ "OneofDescriptorProto",
55
+ "OneofOptions",
56
+ "ServiceDescriptorProto",
57
+ "ServiceOptions",
58
+ "SourceCodeInfo",
59
+ "SourceCodeInfoLocation",
60
+ "SymbolVisibility",
61
+ "UninterpretedOption",
62
+ "UninterpretedOptionNamePart",
63
+ )
64
+
65
+ import typing
66
+ import warnings
67
+ from dataclasses import dataclass
68
+
69
+ import betterproto2
70
+
71
+ from ...message_pool import default_message_pool
72
+
73
+ _COMPILER_VERSION = "0.9.0"
74
+ betterproto2.check_compiler_version(_COMPILER_VERSION)
75
+
76
+
77
+ class Edition(betterproto2.Enum):
78
+ """
79
+ The full set of known editions.
80
+ """
81
+
82
+ UNKNOWN = 0
83
+ """
84
+ A placeholder for an unknown edition value.
85
+ """
86
+
87
+ LEGACY = 900
88
+ """
89
+ A placeholder edition for specifying default behaviors *before* a feature
90
+ was first introduced. This is effectively an "infinite past".
91
+ """
92
+
93
+ PROTO2 = 998
94
+ """
95
+ Legacy syntax "editions". These pre-date editions, but behave much like
96
+ distinct editions. These can't be used to specify the edition of proto
97
+ files, but feature definitions must supply proto2/proto3 defaults for
98
+ backwards compatibility.
99
+ """
100
+
101
+ PROTO3 = 999
102
+
103
+ _2023 = 1000
104
+ """
105
+ Editions that have been released. The specific values are arbitrary and
106
+ should not be depended on, but they will always be time-ordered for easy
107
+ comparison.
108
+ """
109
+
110
+ _2024 = 1001
111
+
112
+ _1_TEST_ONLY = 1
113
+ """
114
+ Placeholder editions for testing feature resolution. These should not be
115
+ used or relied on outside of tests.
116
+ """
117
+
118
+ _2_TEST_ONLY = 2
119
+
120
+ _99997_TEST_ONLY = 99997
121
+
122
+ _99998_TEST_ONLY = 99998
123
+
124
+ _99999_TEST_ONLY = 99999
125
+
126
+ MAX = 2147483647
127
+ """
128
+ Placeholder for specifying unbounded edition support. This should only
129
+ ever be used by plugins that can expect to never require any changes to
130
+ support a new edition.
131
+ """
132
+
133
+ @classmethod
134
+ def betterproto_value_to_renamed_proto_names(cls) -> dict[int, str]:
135
+ return {
136
+ 0: "EDITION_UNKNOWN",
137
+ 900: "EDITION_LEGACY",
138
+ 998: "EDITION_PROTO2",
139
+ 999: "EDITION_PROTO3",
140
+ 1000: "EDITION_2023",
141
+ 1001: "EDITION_2024",
142
+ 1: "EDITION_1_TEST_ONLY",
143
+ 2: "EDITION_2_TEST_ONLY",
144
+ 99997: "EDITION_99997_TEST_ONLY",
145
+ 99998: "EDITION_99998_TEST_ONLY",
146
+ 99999: "EDITION_99999_TEST_ONLY",
147
+ 2147483647: "EDITION_MAX",
148
+ }
149
+
150
+ @classmethod
151
+ def betterproto_renamed_proto_names_to_value(cls) -> dict[str, int]:
152
+ return {
153
+ "EDITION_UNKNOWN": 0,
154
+ "EDITION_LEGACY": 900,
155
+ "EDITION_PROTO2": 998,
156
+ "EDITION_PROTO3": 999,
157
+ "EDITION_2023": 1000,
158
+ "EDITION_2024": 1001,
159
+ "EDITION_1_TEST_ONLY": 1,
160
+ "EDITION_2_TEST_ONLY": 2,
161
+ "EDITION_99997_TEST_ONLY": 99997,
162
+ "EDITION_99998_TEST_ONLY": 99998,
163
+ "EDITION_99999_TEST_ONLY": 99999,
164
+ "EDITION_MAX": 2147483647,
165
+ }
166
+
167
+
168
+ class ExtensionRangeOptionsVerificationState(betterproto2.Enum):
169
+ """
170
+ The verification state of the extension range.
171
+ """
172
+
173
+ DECLARATION = 0
174
+ """
175
+ All the extensions of the range must be declared.
176
+ """
177
+
178
+ UNVERIFIED = 1
179
+
180
+
181
+ class FeatureSetEnforceNamingStyle(betterproto2.Enum):
182
+ ENFORCE_NAMING_STYLE_UNKNOWN = 0
183
+
184
+ STYLE2024 = 1
185
+
186
+ STYLE_LEGACY = 2
187
+
188
+
189
+ class FeatureSetEnumType(betterproto2.Enum):
190
+ ENUM_TYPE_UNKNOWN = 0
191
+
192
+ OPEN = 1
193
+
194
+ CLOSED = 2
195
+
196
+
197
+ class FeatureSetFieldPresence(betterproto2.Enum):
198
+ FIELD_PRESENCE_UNKNOWN = 0
199
+
200
+ EXPLICIT = 1
201
+
202
+ IMPLICIT = 2
203
+
204
+ LEGACY_REQUIRED = 3
205
+
206
+
207
+ class FeatureSetJsonFormat(betterproto2.Enum):
208
+ JSON_FORMAT_UNKNOWN = 0
209
+
210
+ ALLOW = 1
211
+
212
+ LEGACY_BEST_EFFORT = 2
213
+
214
+
215
+ class FeatureSetMessageEncoding(betterproto2.Enum):
216
+ MESSAGE_ENCODING_UNKNOWN = 0
217
+
218
+ LENGTH_PREFIXED = 1
219
+
220
+ DELIMITED = 2
221
+
222
+
223
+ class FeatureSetRepeatedFieldEncoding(betterproto2.Enum):
224
+ REPEATED_FIELD_ENCODING_UNKNOWN = 0
225
+
226
+ PACKED = 1
227
+
228
+ EXPANDED = 2
229
+
230
+
231
+ class FeatureSetUtf8Validation(betterproto2.Enum):
232
+ UTF8_VALIDATION_UNKNOWN = 0
233
+
234
+ VERIFY = 2
235
+
236
+ NONE = 3
237
+
238
+
239
+ class FeatureSetVisibilityFeatureDefaultSymbolVisibility(betterproto2.Enum):
240
+ DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0
241
+
242
+ EXPORT_ALL = 1
243
+ """
244
+ Default pre-EDITION_2024, all UNSET visibility are export.
245
+ """
246
+
247
+ EXPORT_TOP_LEVEL = 2
248
+ """
249
+ All top-level symbols default to export, nested default to local.
250
+ """
251
+
252
+ LOCAL_ALL = 3
253
+ """
254
+ All symbols default to local.
255
+ """
256
+
257
+ STRICT = 4
258
+ """
259
+ All symbols local by default. Nested types cannot be exported.
260
+ With special case caveat for message { enum {} reserved 1 to max; }
261
+ This is the recommended setting for new protos.
262
+ """
263
+
264
+
265
+ class FieldDescriptorProtoLabel(betterproto2.Enum):
266
+ OPTIONAL = 1
267
+ """
268
+ 0 is reserved for errors
269
+ """
270
+
271
+ REPEATED = 3
272
+
273
+ REQUIRED = 2
274
+ """
275
+ The required label is only allowed in google.protobuf. In proto3 and Editions
276
+ it's explicitly prohibited. In Editions, the `field_presence` feature
277
+ can be used to get this behavior.
278
+ """
279
+
280
+ @classmethod
281
+ def betterproto_value_to_renamed_proto_names(cls) -> dict[int, str]:
282
+ return {
283
+ 1: "LABEL_OPTIONAL",
284
+ 3: "LABEL_REPEATED",
285
+ 2: "LABEL_REQUIRED",
286
+ }
287
+
288
+ @classmethod
289
+ def betterproto_renamed_proto_names_to_value(cls) -> dict[str, int]:
290
+ return {
291
+ "LABEL_OPTIONAL": 1,
292
+ "LABEL_REPEATED": 3,
293
+ "LABEL_REQUIRED": 2,
294
+ }
295
+
296
+
297
+ class FieldDescriptorProtoType(betterproto2.Enum):
298
+ DOUBLE = 1
299
+ """
300
+ 0 is reserved for errors.
301
+ Order is weird for historical reasons.
302
+ """
303
+
304
+ FLOAT = 2
305
+
306
+ INT64 = 3
307
+ """
308
+ Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
309
+ negative values are likely.
310
+ """
311
+
312
+ UINT64 = 4
313
+
314
+ INT32 = 5
315
+ """
316
+ Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
317
+ negative values are likely.
318
+ """
319
+
320
+ FIXED64 = 6
321
+
322
+ FIXED32 = 7
323
+
324
+ BOOL = 8
325
+
326
+ STRING = 9
327
+
328
+ GROUP = 10
329
+ """
330
+ Tag-delimited aggregate.
331
+ Group type is deprecated and not supported after google.protobuf. However, Proto3
332
+ implementations should still be able to parse the group wire format and
333
+ treat group fields as unknown fields. In Editions, the group wire format
334
+ can be enabled via the `message_encoding` feature.
335
+ """
336
+
337
+ MESSAGE = 11
338
+ """
339
+ Length-delimited aggregate.
340
+ """
341
+
342
+ BYTES = 12
343
+ """
344
+ New in version 2.
345
+ """
346
+
347
+ UINT32 = 13
348
+
349
+ ENUM = 14
350
+
351
+ SFIXED32 = 15
352
+
353
+ SFIXED64 = 16
354
+
355
+ SINT32 = 17
356
+ """
357
+ Uses ZigZag encoding.
358
+ """
359
+
360
+ SINT64 = 18
361
+ """
362
+ Uses ZigZag encoding.
363
+ """
364
+
365
+ @classmethod
366
+ def betterproto_value_to_renamed_proto_names(cls) -> dict[int, str]:
367
+ return {
368
+ 1: "TYPE_DOUBLE",
369
+ 2: "TYPE_FLOAT",
370
+ 3: "TYPE_INT64",
371
+ 4: "TYPE_UINT64",
372
+ 5: "TYPE_INT32",
373
+ 6: "TYPE_FIXED64",
374
+ 7: "TYPE_FIXED32",
375
+ 8: "TYPE_BOOL",
376
+ 9: "TYPE_STRING",
377
+ 10: "TYPE_GROUP",
378
+ 11: "TYPE_MESSAGE",
379
+ 12: "TYPE_BYTES",
380
+ 13: "TYPE_UINT32",
381
+ 14: "TYPE_ENUM",
382
+ 15: "TYPE_SFIXED32",
383
+ 16: "TYPE_SFIXED64",
384
+ 17: "TYPE_SINT32",
385
+ 18: "TYPE_SINT64",
386
+ }
387
+
388
+ @classmethod
389
+ def betterproto_renamed_proto_names_to_value(cls) -> dict[str, int]:
390
+ return {
391
+ "TYPE_DOUBLE": 1,
392
+ "TYPE_FLOAT": 2,
393
+ "TYPE_INT64": 3,
394
+ "TYPE_UINT64": 4,
395
+ "TYPE_INT32": 5,
396
+ "TYPE_FIXED64": 6,
397
+ "TYPE_FIXED32": 7,
398
+ "TYPE_BOOL": 8,
399
+ "TYPE_STRING": 9,
400
+ "TYPE_GROUP": 10,
401
+ "TYPE_MESSAGE": 11,
402
+ "TYPE_BYTES": 12,
403
+ "TYPE_UINT32": 13,
404
+ "TYPE_ENUM": 14,
405
+ "TYPE_SFIXED32": 15,
406
+ "TYPE_SFIXED64": 16,
407
+ "TYPE_SINT32": 17,
408
+ "TYPE_SINT64": 18,
409
+ }
410
+
411
+
412
+ class FieldOptionsCType(betterproto2.Enum):
413
+ STRING = 0
414
+ """
415
+ Default mode.
416
+ """
417
+
418
+ CORD = 1
419
+ """
420
+ The option [ctype=CORD] may be applied to a non-repeated field of type
421
+ "bytes". It indicates that in C++, the data should be stored in a Cord
422
+ instead of a string. For very large strings, this may reduce memory
423
+ fragmentation. It may also allow better performance when parsing from a
424
+ Cord, or when parsing with aliasing enabled, as the parsed Cord may then
425
+ alias the original buffer.
426
+ """
427
+
428
+ STRING_PIECE = 2
429
+
430
+
431
+ class FieldOptionsJsType(betterproto2.Enum):
432
+ JS_NORMAL = 0
433
+ """
434
+ Use the default type.
435
+ """
436
+
437
+ JS_STRING = 1
438
+ """
439
+ Use JavaScript strings.
440
+ """
441
+
442
+ JS_NUMBER = 2
443
+ """
444
+ Use JavaScript numbers.
445
+ """
446
+
447
+
448
+ class FieldOptionsOptionRetention(betterproto2.Enum):
449
+ """
450
+ If set to RETENTION_SOURCE, the option will be omitted from the binary.
451
+ """
452
+
453
+ RETENTION_UNKNOWN = 0
454
+
455
+ RETENTION_RUNTIME = 1
456
+
457
+ RETENTION_SOURCE = 2
458
+
459
+
460
+ class FieldOptionsOptionTargetType(betterproto2.Enum):
461
+ """
462
+ This indicates the types of entities that the field may apply to when used
463
+ as an option. If it is unset, then the field may be freely used as an
464
+ option on any kind of entity.
465
+ """
466
+
467
+ TARGET_TYPE_UNKNOWN = 0
468
+
469
+ TARGET_TYPE_FILE = 1
470
+
471
+ TARGET_TYPE_EXTENSION_RANGE = 2
472
+
473
+ TARGET_TYPE_MESSAGE = 3
474
+
475
+ TARGET_TYPE_FIELD = 4
476
+
477
+ TARGET_TYPE_ONEOF = 5
478
+
479
+ TARGET_TYPE_ENUM = 6
480
+
481
+ TARGET_TYPE_ENUM_ENTRY = 7
482
+
483
+ TARGET_TYPE_SERVICE = 8
484
+
485
+ TARGET_TYPE_METHOD = 9
486
+
487
+
488
+ class FileOptionsOptimizeMode(betterproto2.Enum):
489
+ """
490
+ Generated classes can be optimized for speed or code size.
491
+ """
492
+
493
+ SPEED = 1
494
+ """
495
+ Generate complete code for parsing, serialization,
496
+ """
497
+
498
+ CODE_SIZE = 2
499
+ """
500
+ etc.
501
+
502
+ Use ReflectionOps to implement these methods.
503
+ """
504
+
505
+ LITE_RUNTIME = 3
506
+ """
507
+ Generate code using MessageLite and the lite runtime.
508
+ """
509
+
510
+
511
+ class GeneratedCodeInfoAnnotationSemantic(betterproto2.Enum):
512
+ """
513
+ Represents the identified object's effect on the element in the original
514
+ .proto file.
515
+ """
516
+
517
+ NONE = 0
518
+ """
519
+ There is no effect or the effect is indescribable.
520
+ """
521
+
522
+ SET = 1
523
+ """
524
+ The element is set or otherwise mutated.
525
+ """
526
+
527
+ ALIAS = 2
528
+ """
529
+ An alias to the element is returned.
530
+ """
531
+
532
+
533
+ class MethodOptionsIdempotencyLevel(betterproto2.Enum):
534
+ """
535
+ Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
536
+ or neither? HTTP based RPC implementation may choose GET verb for safe
537
+ methods, and PUT verb for idempotent methods instead of the default POST.
538
+ """
539
+
540
+ IDEMPOTENCY_UNKNOWN = 0
541
+
542
+ NO_SIDE_EFFECTS = 1
543
+ """
544
+ implies idempotent
545
+ """
546
+
547
+ IDEMPOTENT = 2
548
+ """
549
+ idempotent, but may have side effects
550
+ """
551
+
552
+
553
+ class SymbolVisibility(betterproto2.Enum):
554
+ """
555
+ Describes the 'visibility' of a symbol with respect to the proto import
556
+ system. Symbols can only be imported when the visibility rules do not prevent
557
+ it (ex: local symbols cannot be imported). Visibility modifiers can only set
558
+ on `message` and `enum` as they are the only types available to be referenced
559
+ from other files.
560
+ """
561
+
562
+ VISIBILITY_UNSET = 0
563
+
564
+ VISIBILITY_LOCAL = 1
565
+
566
+ VISIBILITY_EXPORT = 2
567
+
568
+
569
+ @dataclass(eq=False, repr=False)
570
+ class Any(betterproto2.Message):
571
+ """
572
+ `Any` contains an arbitrary serialized protocol buffer message along with a
573
+ URL that describes the type of the serialized message.
574
+
575
+ Protobuf library provides support to pack/unpack Any values in the form
576
+ of utility functions or additional generated methods of the Any type.
577
+
578
+ Example 1: Pack and unpack a message in C++.
579
+
580
+ Foo foo = ...;
581
+ Any any;
582
+ any.PackFrom(foo);
583
+ ...
584
+ if (any.UnpackTo(&foo)) {
585
+ ...
586
+ }
587
+
588
+ Example 2: Pack and unpack a message in Java.
589
+
590
+ Foo foo = ...;
591
+ Any any = Any.pack(foo);
592
+ ...
593
+ if (any.is(Foo.class)) {
594
+ foo = any.unpack(Foo.class);
595
+ }
596
+ // or ...
597
+ if (any.isSameTypeAs(Foo.getDefaultInstance())) {
598
+ foo = any.unpack(Foo.getDefaultInstance());
599
+ }
600
+
601
+ Example 3: Pack and unpack a message in Python.
602
+
603
+ foo = Foo(...)
604
+ any = Any()
605
+ any.Pack(foo)
606
+ ...
607
+ if any.Is(Foo.DESCRIPTOR):
608
+ any.Unpack(foo)
609
+ ...
610
+
611
+ Example 4: Pack and unpack a message in Go
612
+
613
+ foo := &pb.Foo{...}
614
+ any, err := anypb.New(foo)
615
+ if err != nil {
616
+ ...
617
+ }
618
+ ...
619
+ foo := &pb.Foo{}
620
+ if err := any.UnmarshalTo(foo); err != nil {
621
+ ...
622
+ }
623
+
624
+ The pack methods provided by protobuf library will by default use
625
+ 'type.googleapis.com/full.type.name' as the type URL and the unpack
626
+ methods only use the fully qualified type name after the last '/'
627
+ in the type URL, for example "foo.bar.com/x/y.z" will yield type
628
+ name "y.z".
629
+
630
+ JSON
631
+ ====
632
+ The JSON representation of an `Any` value uses the regular
633
+ representation of the deserialized, embedded message, with an
634
+ additional field `@type` which contains the type URL. Example:
635
+
636
+ package google.profile;
637
+ message Person {
638
+ string first_name = 1;
639
+ string last_name = 2;
640
+ }
641
+
642
+ {
643
+ "@type": "type.googleapis.com/google.profile.Person",
644
+ "firstName": <string>,
645
+ "lastName": <string>
646
+ }
647
+
648
+ If the embedded message type is well-known and has a custom JSON
649
+ representation, that representation will be embedded adding a field
650
+ `value` which holds the custom JSON in addition to the `@type`
651
+ field. Example (for message [google.protobuf.Duration][]):
652
+
653
+ {
654
+ "@type": "type.googleapis.com/google.protobuf.Duration",
655
+ "value": "1.212s"
656
+ }
657
+ """
658
+
659
+ type_url: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
660
+ """
661
+ A URL/resource name that uniquely identifies the type of the serialized
662
+ protocol buffer message. This string must contain at least
663
+ one "/" character. The last segment of the URL's path must represent
664
+ the fully qualified name of the type (as in
665
+ `path/google.protobuf.Duration`). The name should be in a canonical form
666
+ (e.g., leading "." is not accepted).
667
+
668
+ In practice, teams usually precompile into the binary all types that they
669
+ expect it to use in the context of Any. However, for URLs which use the
670
+ scheme `http`, `https`, or no scheme, one can optionally set up a type
671
+ server that maps type URLs to message definitions as follows:
672
+
673
+ * If no scheme is provided, `https` is assumed.
674
+ * An HTTP GET on the URL must yield a [google.protobuf.Type][]
675
+ value in binary format, or produce an error.
676
+ * Applications are allowed to cache lookup results based on the
677
+ URL, or have them precompiled into a binary to avoid any
678
+ lookup. Therefore, binary compatibility needs to be preserved
679
+ on changes to types. (Use versioned type names to manage
680
+ breaking changes.)
681
+
682
+ Note: this functionality is not currently available in the official
683
+ protobuf release, and it is not used for type URLs beginning with
684
+ type.googleapis.com. As of May 2023, there are no widely used type server
685
+ implementations and no plans to implement one.
686
+
687
+ Schemes other than `http`, `https` (or the empty scheme) might be
688
+ used with implementation specific semantics.
689
+ """
690
+
691
+ value: "bytes" = betterproto2.field(2, betterproto2.TYPE_BYTES)
692
+ """
693
+ Must be a valid serialized protocol buffer of the above specified type.
694
+ """
695
+
696
+ @classmethod
697
+ def pack(cls, message: betterproto2.Message, message_pool: "betterproto2.MessagePool | None" = None) -> "Any":
698
+ """
699
+ Pack the given message in the `Any` object.
700
+
701
+ The message type must be registered in the message pool, which is done automatically when the module defining
702
+ the message type is imported.
703
+ """
704
+ message_pool = message_pool or default_message_pool
705
+
706
+ type_url = message_pool.type_to_url[type(message)]
707
+ value = bytes(message)
708
+
709
+ return cls(type_url=type_url, value=value)
710
+
711
+ def unpack(self, message_pool: "betterproto2.MessagePool | None" = None) -> betterproto2.Message | None:
712
+ """
713
+ Return the message packed inside the `Any` object.
714
+
715
+ The target message type must be registered in the message pool, which is done automatically when the module
716
+ defining the message type is imported.
717
+ """
718
+ if not self.type_url:
719
+ return None
720
+
721
+ message_pool = message_pool or default_message_pool
722
+
723
+ try:
724
+ message_type = message_pool.url_to_type[self.type_url]
725
+ except KeyError:
726
+ raise TypeError(f"Can't unpack unregistered type: {self.type_url}")
727
+
728
+ return message_type.parse(self.value)
729
+
730
+ def to_dict(self, **kwargs) -> dict[str, typing.Any]:
731
+ # TODO allow passing a message pool to `to_dict`
732
+ output: dict[str, typing.Any] = {"@type": self.type_url}
733
+
734
+ value = self.unpack()
735
+
736
+ if value is None:
737
+ return output
738
+
739
+ if type(value).to_dict == betterproto2.Message.to_dict:
740
+ output.update(value.to_dict(**kwargs))
741
+ else:
742
+ output["value"] = value.to_dict(**kwargs)
743
+
744
+ return output
745
+
746
+ @classmethod
747
+ def from_dict(cls, value, *, ignore_unknown_fields: bool = False):
748
+ value = dict(value) # Make a copy
749
+
750
+ type_url = value.pop("@type", None)
751
+ msg_cls = default_message_pool.url_to_type.get(type_url, None)
752
+
753
+ if not msg_cls:
754
+ raise TypeError(f"Can't unpack unregistered type: {type_url}")
755
+
756
+ if not msg_cls.to_dict == betterproto2.Message.to_dict:
757
+ value = value["value"]
758
+
759
+ return cls(
760
+ type_url=type_url, value=bytes(msg_cls.from_dict(value, ignore_unknown_fields=ignore_unknown_fields))
761
+ )
762
+
763
+
764
+ default_message_pool.register_message("google.protobuf", "Any", Any)
765
+
766
+
767
+ @dataclass(eq=False, repr=False)
768
+ class DescriptorProto(betterproto2.Message):
769
+ """
770
+ Describes a message type.
771
+ """
772
+
773
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
774
+
775
+ field: "list[FieldDescriptorProto]" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, repeated=True)
776
+
777
+ extension: "list[FieldDescriptorProto]" = betterproto2.field(6, betterproto2.TYPE_MESSAGE, repeated=True)
778
+
779
+ nested_type: "list[DescriptorProto]" = betterproto2.field(3, betterproto2.TYPE_MESSAGE, repeated=True)
780
+
781
+ enum_type: "list[EnumDescriptorProto]" = betterproto2.field(4, betterproto2.TYPE_MESSAGE, repeated=True)
782
+
783
+ extension_range: "list[DescriptorProtoExtensionRange]" = betterproto2.field(
784
+ 5, betterproto2.TYPE_MESSAGE, repeated=True
785
+ )
786
+
787
+ oneof_decl: "list[OneofDescriptorProto]" = betterproto2.field(8, betterproto2.TYPE_MESSAGE, repeated=True)
788
+
789
+ options: "MessageOptions | None" = betterproto2.field(7, betterproto2.TYPE_MESSAGE, optional=True)
790
+
791
+ reserved_range: "list[DescriptorProtoReservedRange]" = betterproto2.field(
792
+ 9, betterproto2.TYPE_MESSAGE, repeated=True
793
+ )
794
+
795
+ reserved_name: "list[str]" = betterproto2.field(10, betterproto2.TYPE_STRING, repeated=True)
796
+ """
797
+ Reserved field names, which may not be used by fields in the same message.
798
+ A given name may only be reserved once.
799
+ """
800
+
801
+ visibility: "SymbolVisibility" = betterproto2.field(
802
+ 11, betterproto2.TYPE_ENUM, default_factory=lambda: SymbolVisibility(0)
803
+ )
804
+ """
805
+ Support for `export` and `local` keywords on enums.
806
+ """
807
+
808
+
809
+ default_message_pool.register_message("google.protobuf", "DescriptorProto", DescriptorProto)
810
+
811
+
812
+ @dataclass(eq=False, repr=False)
813
+ class DescriptorProtoExtensionRange(betterproto2.Message):
814
+ start: "int" = betterproto2.field(1, betterproto2.TYPE_INT32)
815
+ """
816
+ Inclusive.
817
+ """
818
+
819
+ end: "int" = betterproto2.field(2, betterproto2.TYPE_INT32)
820
+ """
821
+ Exclusive.
822
+ """
823
+
824
+ options: "ExtensionRangeOptions | None" = betterproto2.field(3, betterproto2.TYPE_MESSAGE, optional=True)
825
+
826
+
827
+ default_message_pool.register_message(
828
+ "google.protobuf", "DescriptorProto.ExtensionRange", DescriptorProtoExtensionRange
829
+ )
830
+
831
+
832
+ @dataclass(eq=False, repr=False)
833
+ class DescriptorProtoReservedRange(betterproto2.Message):
834
+ """
835
+ Range of reserved tag numbers. Reserved tag numbers may not be used by
836
+ fields or extension ranges in the same message. Reserved ranges may
837
+ not overlap.
838
+ """
839
+
840
+ start: "int" = betterproto2.field(1, betterproto2.TYPE_INT32)
841
+ """
842
+ Inclusive.
843
+ """
844
+
845
+ end: "int" = betterproto2.field(2, betterproto2.TYPE_INT32)
846
+ """
847
+ Exclusive.
848
+ """
849
+
850
+
851
+ default_message_pool.register_message("google.protobuf", "DescriptorProto.ReservedRange", DescriptorProtoReservedRange)
852
+
853
+
854
+ @dataclass(eq=False, repr=False)
855
+ class Empty(betterproto2.Message):
856
+ """
857
+ A generic empty message that you can re-use to avoid defining duplicated
858
+ empty messages in your APIs. A typical example is to use it as the request
859
+ or the response type of an API method. For instance:
860
+
861
+ service Foo {
862
+ rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
863
+ }
864
+ """
865
+
866
+ pass
867
+
868
+
869
+ default_message_pool.register_message("google.protobuf", "Empty", Empty)
870
+
871
+
872
+ @dataclass(eq=False, repr=False)
873
+ class EnumDescriptorProto(betterproto2.Message):
874
+ """
875
+ Describes an enum type.
876
+ """
877
+
878
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
879
+
880
+ value: "list[EnumValueDescriptorProto]" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, repeated=True)
881
+
882
+ options: "EnumOptions | None" = betterproto2.field(3, betterproto2.TYPE_MESSAGE, optional=True)
883
+
884
+ reserved_range: "list[EnumDescriptorProtoEnumReservedRange]" = betterproto2.field(
885
+ 4, betterproto2.TYPE_MESSAGE, repeated=True
886
+ )
887
+ """
888
+ Range of reserved numeric values. Reserved numeric values may not be used
889
+ by enum values in the same enum declaration. Reserved ranges may not
890
+ overlap.
891
+ """
892
+
893
+ reserved_name: "list[str]" = betterproto2.field(5, betterproto2.TYPE_STRING, repeated=True)
894
+ """
895
+ Reserved enum value names, which may not be reused. A given name may only
896
+ be reserved once.
897
+ """
898
+
899
+ visibility: "SymbolVisibility" = betterproto2.field(
900
+ 6, betterproto2.TYPE_ENUM, default_factory=lambda: SymbolVisibility(0)
901
+ )
902
+ """
903
+ Support for `export` and `local` keywords on enums.
904
+ """
905
+
906
+
907
+ default_message_pool.register_message("google.protobuf", "EnumDescriptorProto", EnumDescriptorProto)
908
+
909
+
910
+ @dataclass(eq=False, repr=False)
911
+ class EnumDescriptorProtoEnumReservedRange(betterproto2.Message):
912
+ """
913
+ Range of reserved numeric values. Reserved values may not be used by
914
+ entries in the same enum. Reserved ranges may not overlap.
915
+
916
+ Note that this is distinct from DescriptorProto.ReservedRange in that it
917
+ is inclusive such that it can appropriately represent the entire int32
918
+ domain.
919
+ """
920
+
921
+ start: "int" = betterproto2.field(1, betterproto2.TYPE_INT32)
922
+ """
923
+ Inclusive.
924
+ """
925
+
926
+ end: "int" = betterproto2.field(2, betterproto2.TYPE_INT32)
927
+ """
928
+ Inclusive.
929
+ """
930
+
931
+
932
+ default_message_pool.register_message(
933
+ "google.protobuf", "EnumDescriptorProto.EnumReservedRange", EnumDescriptorProtoEnumReservedRange
934
+ )
935
+
936
+
937
+ @dataclass(eq=False, repr=False)
938
+ class EnumOptions(betterproto2.Message):
939
+ allow_alias: "bool" = betterproto2.field(2, betterproto2.TYPE_BOOL)
940
+ """
941
+ Set this option to true to allow mapping different tag names to the same
942
+ value.
943
+ """
944
+
945
+ deprecated: "bool" = betterproto2.field(3, betterproto2.TYPE_BOOL)
946
+ """
947
+ Is this enum deprecated?
948
+ Depending on the target platform, this can emit Deprecated annotations
949
+ for the enum, or it will be completely ignored; in the very least, this
950
+ is a formalization for deprecating enums.
951
+ """
952
+
953
+ deprecated_legacy_json_field_conflicts: "bool" = betterproto2.field(6, betterproto2.TYPE_BOOL)
954
+ """
955
+ Enable the legacy handling of JSON field name conflicts. This lowercases
956
+ and strips underscored from the fields before comparison in proto3 only.
957
+ The new behavior takes `json_name` into account and applies to proto2 as
958
+ well.
959
+ TODO Remove this legacy behavior once downstream teams have
960
+ had time to migrate.
961
+ """
962
+
963
+ features: "FeatureSet | None" = betterproto2.field(7, betterproto2.TYPE_MESSAGE, optional=True)
964
+ """
965
+ Any features defined in the specific edition.
966
+ WARNING: This field should only be used by protobuf plugins or special
967
+ cases like the proto compiler. Other uses are discouraged and
968
+ developers should rely on the protoreflect APIs for their client language.
969
+ """
970
+
971
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
972
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
973
+ )
974
+ """
975
+ The parser stores options it doesn't recognize here. See above.
976
+ """
977
+
978
+ def __post_init__(self) -> None:
979
+ super().__post_init__()
980
+ if self.is_set("deprecated_legacy_json_field_conflicts"):
981
+ warnings.warn("EnumOptions.deprecated_legacy_json_field_conflicts is deprecated", DeprecationWarning)
982
+
983
+
984
+ default_message_pool.register_message("google.protobuf", "EnumOptions", EnumOptions)
985
+
986
+
987
+ @dataclass(eq=False, repr=False)
988
+ class EnumValueDescriptorProto(betterproto2.Message):
989
+ """
990
+ Describes a value within an enum.
991
+ """
992
+
993
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
994
+
995
+ number: "int" = betterproto2.field(2, betterproto2.TYPE_INT32)
996
+
997
+ options: "EnumValueOptions | None" = betterproto2.field(3, betterproto2.TYPE_MESSAGE, optional=True)
998
+
999
+
1000
+ default_message_pool.register_message("google.protobuf", "EnumValueDescriptorProto", EnumValueDescriptorProto)
1001
+
1002
+
1003
+ @dataclass(eq=False, repr=False)
1004
+ class EnumValueOptions(betterproto2.Message):
1005
+ deprecated: "bool" = betterproto2.field(1, betterproto2.TYPE_BOOL)
1006
+ """
1007
+ Is this enum value deprecated?
1008
+ Depending on the target platform, this can emit Deprecated annotations
1009
+ for the enum value, or it will be completely ignored; in the very least,
1010
+ this is a formalization for deprecating enum values.
1011
+ """
1012
+
1013
+ features: "FeatureSet | None" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, optional=True)
1014
+ """
1015
+ Any features defined in the specific edition.
1016
+ WARNING: This field should only be used by protobuf plugins or special
1017
+ cases like the proto compiler. Other uses are discouraged and
1018
+ developers should rely on the protoreflect APIs for their client language.
1019
+ """
1020
+
1021
+ debug_redact: "bool" = betterproto2.field(3, betterproto2.TYPE_BOOL)
1022
+ """
1023
+ Indicate that fields annotated with this enum value should not be printed
1024
+ out when using debug formats, e.g. when the field contains sensitive
1025
+ credentials.
1026
+ """
1027
+
1028
+ feature_support: "FieldOptionsFeatureSupport | None" = betterproto2.field(
1029
+ 4, betterproto2.TYPE_MESSAGE, optional=True
1030
+ )
1031
+ """
1032
+ Information about the support window of a feature value.
1033
+ """
1034
+
1035
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
1036
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
1037
+ )
1038
+ """
1039
+ The parser stores options it doesn't recognize here. See above.
1040
+ """
1041
+
1042
+
1043
+ default_message_pool.register_message("google.protobuf", "EnumValueOptions", EnumValueOptions)
1044
+
1045
+
1046
+ @dataclass(eq=False, repr=False)
1047
+ class ExtensionRangeOptions(betterproto2.Message):
1048
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
1049
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
1050
+ )
1051
+ """
1052
+ The parser stores options it doesn't recognize here. See above.
1053
+ """
1054
+
1055
+ declaration: "list[ExtensionRangeOptionsDeclaration]" = betterproto2.field(
1056
+ 2, betterproto2.TYPE_MESSAGE, repeated=True
1057
+ )
1058
+ """
1059
+ For external users: DO NOT USE. We are in the process of open sourcing
1060
+ extension declaration and executing internal cleanups before it can be
1061
+ used externally.
1062
+ """
1063
+
1064
+ features: "FeatureSet | None" = betterproto2.field(50, betterproto2.TYPE_MESSAGE, optional=True)
1065
+ """
1066
+ Any features defined in the specific edition.
1067
+ """
1068
+
1069
+ verification: "ExtensionRangeOptionsVerificationState" = betterproto2.field(
1070
+ 3, betterproto2.TYPE_ENUM, default_factory=lambda: ExtensionRangeOptionsVerificationState(0)
1071
+ )
1072
+ """
1073
+ The verification state of the range.
1074
+ TODO: flip the default to DECLARATION once all empty ranges
1075
+ are marked as UNVERIFIED.
1076
+ """
1077
+
1078
+
1079
+ default_message_pool.register_message("google.protobuf", "ExtensionRangeOptions", ExtensionRangeOptions)
1080
+
1081
+
1082
+ @dataclass(eq=False, repr=False)
1083
+ class ExtensionRangeOptionsDeclaration(betterproto2.Message):
1084
+ number: "int" = betterproto2.field(1, betterproto2.TYPE_INT32)
1085
+ """
1086
+ The extension number declared within the extension range.
1087
+ """
1088
+
1089
+ full_name: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
1090
+ """
1091
+ The fully-qualified name of the extension field. There must be a leading
1092
+ dot in front of the full name.
1093
+ """
1094
+
1095
+ type: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
1096
+ """
1097
+ The fully-qualified type name of the extension field. Unlike
1098
+ Metadata.type, Declaration.type must have a leading dot for messages
1099
+ and enums.
1100
+ """
1101
+
1102
+ reserved: "bool" = betterproto2.field(5, betterproto2.TYPE_BOOL)
1103
+ """
1104
+ If true, indicates that the number is reserved in the extension range,
1105
+ and any extension field with the number will fail to compile. Set this
1106
+ when a declared extension field is deleted.
1107
+ """
1108
+
1109
+ repeated: "bool" = betterproto2.field(6, betterproto2.TYPE_BOOL)
1110
+ """
1111
+ If true, indicates that the extension must be defined as repeated.
1112
+ Otherwise the extension must be defined as optional.
1113
+ """
1114
+
1115
+
1116
+ default_message_pool.register_message(
1117
+ "google.protobuf", "ExtensionRangeOptions.Declaration", ExtensionRangeOptionsDeclaration
1118
+ )
1119
+
1120
+
1121
+ @dataclass(eq=False, repr=False)
1122
+ class FeatureSet(betterproto2.Message):
1123
+ """
1124
+ ===================================================================
1125
+ Features
1126
+
1127
+ TODO Enums in C++ gencode (and potentially other languages) are
1128
+ not well scoped. This means that each of the feature enums below can clash
1129
+ with each other. The short names we've chosen maximize call-site
1130
+ readability, but leave us very open to this scenario. A future feature will
1131
+ be designed and implemented to handle this, hopefully before we ever hit a
1132
+ conflict here.
1133
+ """
1134
+
1135
+ field_presence: "FeatureSetFieldPresence" = betterproto2.field(
1136
+ 1, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetFieldPresence(0)
1137
+ )
1138
+
1139
+ enum_type: "FeatureSetEnumType" = betterproto2.field(
1140
+ 2, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetEnumType(0)
1141
+ )
1142
+
1143
+ repeated_field_encoding: "FeatureSetRepeatedFieldEncoding" = betterproto2.field(
1144
+ 3, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetRepeatedFieldEncoding(0)
1145
+ )
1146
+
1147
+ utf8_validation: "FeatureSetUtf8Validation" = betterproto2.field(
1148
+ 4, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetUtf8Validation(0)
1149
+ )
1150
+
1151
+ message_encoding: "FeatureSetMessageEncoding" = betterproto2.field(
1152
+ 5, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetMessageEncoding(0)
1153
+ )
1154
+
1155
+ json_format: "FeatureSetJsonFormat" = betterproto2.field(
1156
+ 6, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetJsonFormat(0)
1157
+ )
1158
+
1159
+ enforce_naming_style: "FeatureSetEnforceNamingStyle" = betterproto2.field(
1160
+ 7, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetEnforceNamingStyle(0)
1161
+ )
1162
+
1163
+ default_symbol_visibility: "FeatureSetVisibilityFeatureDefaultSymbolVisibility" = betterproto2.field(
1164
+ 8, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetVisibilityFeatureDefaultSymbolVisibility(0)
1165
+ )
1166
+
1167
+
1168
+ default_message_pool.register_message("google.protobuf", "FeatureSet", FeatureSet)
1169
+
1170
+
1171
+ @dataclass(eq=False, repr=False)
1172
+ class FeatureSetVisibilityFeature(betterproto2.Message):
1173
+ pass
1174
+
1175
+
1176
+ default_message_pool.register_message("google.protobuf", "FeatureSet.VisibilityFeature", FeatureSetVisibilityFeature)
1177
+
1178
+
1179
+ @dataclass(eq=False, repr=False)
1180
+ class FeatureSetDefaults(betterproto2.Message):
1181
+ """
1182
+ A compiled specification for the defaults of a set of features. These
1183
+ messages are generated from FeatureSet extensions and can be used to seed
1184
+ feature resolution. The resolution with this object becomes a simple search
1185
+ for the closest matching edition, followed by proto merges.
1186
+ """
1187
+
1188
+ defaults: "list[FeatureSetDefaultsFeatureSetEditionDefault]" = betterproto2.field(
1189
+ 1, betterproto2.TYPE_MESSAGE, repeated=True
1190
+ )
1191
+
1192
+ minimum_edition: "Edition" = betterproto2.field(4, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1193
+ """
1194
+ The minimum supported edition (inclusive) when this was constructed.
1195
+ Editions before this will not have defaults.
1196
+ """
1197
+
1198
+ maximum_edition: "Edition" = betterproto2.field(5, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1199
+ """
1200
+ The maximum known edition (inclusive) when this was constructed. Editions
1201
+ after this will not have reliable defaults.
1202
+ """
1203
+
1204
+
1205
+ default_message_pool.register_message("google.protobuf", "FeatureSetDefaults", FeatureSetDefaults)
1206
+
1207
+
1208
+ @dataclass(eq=False, repr=False)
1209
+ class FeatureSetDefaultsFeatureSetEditionDefault(betterproto2.Message):
1210
+ """
1211
+ A map from every known edition with a unique set of defaults to its
1212
+ defaults. Not all editions may be contained here. For a given edition,
1213
+ the defaults at the closest matching edition ordered at or before it should
1214
+ be used. This field must be in strict ascending order by edition.
1215
+ """
1216
+
1217
+ edition: "Edition" = betterproto2.field(3, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1218
+
1219
+ overridable_features: "FeatureSet | None" = betterproto2.field(4, betterproto2.TYPE_MESSAGE, optional=True)
1220
+ """
1221
+ Defaults of features that can be overridden in this edition.
1222
+ """
1223
+
1224
+ fixed_features: "FeatureSet | None" = betterproto2.field(5, betterproto2.TYPE_MESSAGE, optional=True)
1225
+ """
1226
+ Defaults of features that can't be overridden in this edition.
1227
+ """
1228
+
1229
+
1230
+ default_message_pool.register_message(
1231
+ "google.protobuf", "FeatureSetDefaults.FeatureSetEditionDefault", FeatureSetDefaultsFeatureSetEditionDefault
1232
+ )
1233
+
1234
+
1235
+ @dataclass(eq=False, repr=False)
1236
+ class FieldDescriptorProto(betterproto2.Message):
1237
+ """
1238
+ Describes a field within a message.
1239
+ """
1240
+
1241
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
1242
+
1243
+ number: "int" = betterproto2.field(3, betterproto2.TYPE_INT32)
1244
+
1245
+ label: "FieldDescriptorProtoLabel" = betterproto2.field(
1246
+ 4, betterproto2.TYPE_ENUM, default_factory=lambda: FieldDescriptorProtoLabel(0)
1247
+ )
1248
+
1249
+ type: "FieldDescriptorProtoType" = betterproto2.field(
1250
+ 5, betterproto2.TYPE_ENUM, default_factory=lambda: FieldDescriptorProtoType(0)
1251
+ )
1252
+ """
1253
+ If type_name is set, this need not be set. If both this and type_name
1254
+ are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
1255
+ """
1256
+
1257
+ type_name: "str" = betterproto2.field(6, betterproto2.TYPE_STRING)
1258
+ """
1259
+ For message and enum types, this is the name of the type. If the name
1260
+ starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
1261
+ rules are used to find the type (i.e. first the nested types within this
1262
+ message are searched, then within the parent, on up to the root
1263
+ namespace).
1264
+ """
1265
+
1266
+ extendee: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
1267
+ """
1268
+ For extensions, this is the name of the type being extended. It is
1269
+ resolved in the same manner as type_name.
1270
+ """
1271
+
1272
+ default_value: "str" = betterproto2.field(7, betterproto2.TYPE_STRING)
1273
+ """
1274
+ For numeric types, contains the original text representation of the value.
1275
+ For booleans, "true" or "false".
1276
+ For strings, contains the default text contents (not escaped in any way).
1277
+ For bytes, contains the C escaped value. All bytes >= 128 are escaped.
1278
+ """
1279
+
1280
+ oneof_index: "int" = betterproto2.field(9, betterproto2.TYPE_INT32)
1281
+ """
1282
+ If set, gives the index of a oneof in the containing type's oneof_decl
1283
+ list. This field is a member of that oneof.
1284
+ """
1285
+
1286
+ json_name: "str" = betterproto2.field(10, betterproto2.TYPE_STRING)
1287
+ """
1288
+ JSON name of this field. The value is set by protocol compiler. If the
1289
+ user has set a "json_name" option on this field, that option's value
1290
+ will be used. Otherwise, it's deduced from the field's name by converting
1291
+ it to camelCase.
1292
+ """
1293
+
1294
+ options: "FieldOptions | None" = betterproto2.field(8, betterproto2.TYPE_MESSAGE, optional=True)
1295
+
1296
+ proto3_optional: "bool" = betterproto2.field(17, betterproto2.TYPE_BOOL)
1297
+ """
1298
+ If true, this is a proto3 "optional". When a proto3 field is optional, it
1299
+ tracks presence regardless of field type.
1300
+
1301
+ When proto3_optional is true, this field must belong to a oneof to signal
1302
+ to old proto3 clients that presence is tracked for this field. This oneof
1303
+ is known as a "synthetic" oneof, and this field must be its sole member
1304
+ (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
1305
+ exist in the descriptor only, and do not generate any API. Synthetic oneofs
1306
+ must be ordered after all "real" oneofs.
1307
+
1308
+ For message fields, proto3_optional doesn't create any semantic change,
1309
+ since non-repeated message fields always track presence. However it still
1310
+ indicates the semantic detail of whether the user wrote "optional" or not.
1311
+ This can be useful for round-tripping the .proto file. For consistency we
1312
+ give message fields a synthetic oneof also, even though it is not required
1313
+ to track presence. This is especially important because the parser can't
1314
+ tell if a field is a message or an enum, so it must always create a
1315
+ synthetic oneof.
1316
+
1317
+ Proto2 optional fields do not set this flag, because they already indicate
1318
+ optional with `LABEL_OPTIONAL`.
1319
+ """
1320
+
1321
+
1322
+ default_message_pool.register_message("google.protobuf", "FieldDescriptorProto", FieldDescriptorProto)
1323
+
1324
+
1325
+ @dataclass(eq=False, repr=False)
1326
+ class FieldOptions(betterproto2.Message):
1327
+ ctype: "FieldOptionsCType" = betterproto2.field(
1328
+ 1, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsCType(0)
1329
+ )
1330
+ """
1331
+ NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
1332
+ The ctype option instructs the C++ code generator to use a different
1333
+ representation of the field than it normally would. See the specific
1334
+ options below. This option is only implemented to support use of
1335
+ [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
1336
+ type "bytes" in the open source release.
1337
+ TODO: make ctype actually deprecated.
1338
+ """
1339
+
1340
+ packed: "bool" = betterproto2.field(2, betterproto2.TYPE_BOOL)
1341
+ """
1342
+ The packed option can be enabled for repeated primitive fields to enable
1343
+ a more efficient representation on the wire. Rather than repeatedly
1344
+ writing the tag and type for each element, the entire array is encoded as
1345
+ a single length-delimited blob. In proto3, only explicit setting it to
1346
+ false will avoid using packed encoding. This option is prohibited in
1347
+ Editions, but the `repeated_field_encoding` feature can be used to control
1348
+ the behavior.
1349
+ """
1350
+
1351
+ jstype: "FieldOptionsJsType" = betterproto2.field(
1352
+ 6, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsJsType(0)
1353
+ )
1354
+ """
1355
+ The jstype option determines the JavaScript type used for values of the
1356
+ field. The option is permitted only for 64 bit integral and fixed types
1357
+ (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
1358
+ is represented as JavaScript string, which avoids loss of precision that
1359
+ can happen when a large value is converted to a floating point JavaScript.
1360
+ Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
1361
+ use the JavaScript "number" type. The behavior of the default option
1362
+ JS_NORMAL is implementation dependent.
1363
+
1364
+ This option is an enum to permit additional types to be added, e.g.
1365
+ goog.math.Integer.
1366
+ """
1367
+
1368
+ lazy: "bool" = betterproto2.field(5, betterproto2.TYPE_BOOL)
1369
+ """
1370
+ Should this field be parsed lazily? Lazy applies only to message-type
1371
+ fields. It means that when the outer message is initially parsed, the
1372
+ inner message's contents will not be parsed but instead stored in encoded
1373
+ form. The inner message will actually be parsed when it is first accessed.
1374
+
1375
+ This is only a hint. Implementations are free to choose whether to use
1376
+ eager or lazy parsing regardless of the value of this option. However,
1377
+ setting this option true suggests that the protocol author believes that
1378
+ using lazy parsing on this field is worth the additional bookkeeping
1379
+ overhead typically needed to implement it.
1380
+
1381
+ This option does not affect the public interface of any generated code;
1382
+ all method signatures remain the same. Furthermore, thread-safety of the
1383
+ interface is not affected by this option; const methods remain safe to
1384
+ call from multiple threads concurrently, while non-const methods continue
1385
+ to require exclusive access.
1386
+
1387
+ Note that lazy message fields are still eagerly verified to check
1388
+ ill-formed wireformat or missing required fields. Calling IsInitialized()
1389
+ on the outer message would fail if the inner message has missing required
1390
+ fields. Failed verification would result in parsing failure (except when
1391
+ uninitialized messages are acceptable).
1392
+ """
1393
+
1394
+ unverified_lazy: "bool" = betterproto2.field(15, betterproto2.TYPE_BOOL)
1395
+ """
1396
+ unverified_lazy does no correctness checks on the byte stream. This should
1397
+ only be used where lazy with verification is prohibitive for performance
1398
+ reasons.
1399
+ """
1400
+
1401
+ deprecated: "bool" = betterproto2.field(3, betterproto2.TYPE_BOOL)
1402
+ """
1403
+ Is this field deprecated?
1404
+ Depending on the target platform, this can emit Deprecated annotations
1405
+ for accessors, or it will be completely ignored; in the very least, this
1406
+ is a formalization for deprecating fields.
1407
+ """
1408
+
1409
+ weak: "bool" = betterproto2.field(10, betterproto2.TYPE_BOOL)
1410
+ """
1411
+ For Google-internal migration only. Do not use.
1412
+ """
1413
+
1414
+ debug_redact: "bool" = betterproto2.field(16, betterproto2.TYPE_BOOL)
1415
+ """
1416
+ Indicate that the field value should not be printed out when using debug
1417
+ formats, e.g. when the field contains sensitive credentials.
1418
+ """
1419
+
1420
+ retention: "FieldOptionsOptionRetention" = betterproto2.field(
1421
+ 17, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsOptionRetention(0)
1422
+ )
1423
+
1424
+ targets: "list[FieldOptionsOptionTargetType]" = betterproto2.field(19, betterproto2.TYPE_ENUM, repeated=True)
1425
+
1426
+ edition_defaults: "list[FieldOptionsEditionDefault]" = betterproto2.field(
1427
+ 20, betterproto2.TYPE_MESSAGE, repeated=True
1428
+ )
1429
+
1430
+ features: "FeatureSet | None" = betterproto2.field(21, betterproto2.TYPE_MESSAGE, optional=True)
1431
+ """
1432
+ Any features defined in the specific edition.
1433
+ WARNING: This field should only be used by protobuf plugins or special
1434
+ cases like the proto compiler. Other uses are discouraged and
1435
+ developers should rely on the protoreflect APIs for their client language.
1436
+ """
1437
+
1438
+ feature_support: "FieldOptionsFeatureSupport | None" = betterproto2.field(
1439
+ 22, betterproto2.TYPE_MESSAGE, optional=True
1440
+ )
1441
+
1442
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
1443
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
1444
+ )
1445
+ """
1446
+ The parser stores options it doesn't recognize here. See above.
1447
+ """
1448
+
1449
+
1450
+ default_message_pool.register_message("google.protobuf", "FieldOptions", FieldOptions)
1451
+
1452
+
1453
+ @dataclass(eq=False, repr=False)
1454
+ class FieldOptionsEditionDefault(betterproto2.Message):
1455
+ edition: "Edition" = betterproto2.field(3, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1456
+
1457
+ value: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
1458
+ """
1459
+ Textproto value.
1460
+ """
1461
+
1462
+
1463
+ default_message_pool.register_message("google.protobuf", "FieldOptions.EditionDefault", FieldOptionsEditionDefault)
1464
+
1465
+
1466
+ @dataclass(eq=False, repr=False)
1467
+ class FieldOptionsFeatureSupport(betterproto2.Message):
1468
+ """
1469
+ Information about the support window of a feature.
1470
+ """
1471
+
1472
+ edition_introduced: "Edition" = betterproto2.field(1, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1473
+ """
1474
+ The edition that this feature was first available in. In editions
1475
+ earlier than this one, the default assigned to EDITION_LEGACY will be
1476
+ used, and proto files will not be able to override it.
1477
+ """
1478
+
1479
+ edition_deprecated: "Edition" = betterproto2.field(2, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1480
+ """
1481
+ The edition this feature becomes deprecated in. Using this after this
1482
+ edition may trigger warnings.
1483
+ """
1484
+
1485
+ deprecation_warning: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
1486
+ """
1487
+ The deprecation warning text if this feature is used after the edition it
1488
+ was marked deprecated in.
1489
+ """
1490
+
1491
+ edition_removed: "Edition" = betterproto2.field(4, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1492
+ """
1493
+ The edition this feature is no longer available in. In editions after
1494
+ this one, the last default assigned will be used, and proto files will
1495
+ not be able to override it.
1496
+ """
1497
+
1498
+
1499
+ default_message_pool.register_message("google.protobuf", "FieldOptions.FeatureSupport", FieldOptionsFeatureSupport)
1500
+
1501
+
1502
+ @dataclass(eq=False, repr=False)
1503
+ class FileDescriptorProto(betterproto2.Message):
1504
+ """
1505
+ Describes a complete .proto file.
1506
+ """
1507
+
1508
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
1509
+ """
1510
+ file name, relative to root of source tree
1511
+ """
1512
+
1513
+ package: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
1514
+ """
1515
+ e.g. "foo", "foo.bar", etc.
1516
+ """
1517
+
1518
+ dependency: "list[str]" = betterproto2.field(3, betterproto2.TYPE_STRING, repeated=True)
1519
+ """
1520
+ Names of files imported by this file.
1521
+ """
1522
+
1523
+ public_dependency: "list[int]" = betterproto2.field(10, betterproto2.TYPE_INT32, repeated=True)
1524
+ """
1525
+ Indexes of the public imported files in the dependency list above.
1526
+ """
1527
+
1528
+ weak_dependency: "list[int]" = betterproto2.field(11, betterproto2.TYPE_INT32, repeated=True)
1529
+ """
1530
+ Indexes of the weak imported files in the dependency list.
1531
+ For Google-internal migration only. Do not use.
1532
+ """
1533
+
1534
+ option_dependency: "list[str]" = betterproto2.field(15, betterproto2.TYPE_STRING, repeated=True)
1535
+ """
1536
+ Names of files imported by this file purely for the purpose of providing
1537
+ option extensions. These are excluded from the dependency list above.
1538
+ """
1539
+
1540
+ message_type: "list[DescriptorProto]" = betterproto2.field(4, betterproto2.TYPE_MESSAGE, repeated=True)
1541
+ """
1542
+ All top-level definitions in this file.
1543
+ """
1544
+
1545
+ enum_type: "list[EnumDescriptorProto]" = betterproto2.field(5, betterproto2.TYPE_MESSAGE, repeated=True)
1546
+
1547
+ service: "list[ServiceDescriptorProto]" = betterproto2.field(6, betterproto2.TYPE_MESSAGE, repeated=True)
1548
+
1549
+ extension: "list[FieldDescriptorProto]" = betterproto2.field(7, betterproto2.TYPE_MESSAGE, repeated=True)
1550
+
1551
+ options: "FileOptions | None" = betterproto2.field(8, betterproto2.TYPE_MESSAGE, optional=True)
1552
+
1553
+ source_code_info: "SourceCodeInfo | None" = betterproto2.field(9, betterproto2.TYPE_MESSAGE, optional=True)
1554
+ """
1555
+ This field contains optional information about the original source code.
1556
+ You may safely remove this entire field without harming runtime
1557
+ functionality of the descriptors -- the information is needed only by
1558
+ development tools.
1559
+ """
1560
+
1561
+ syntax: "str" = betterproto2.field(12, betterproto2.TYPE_STRING)
1562
+ """
1563
+ The syntax of the proto file.
1564
+ The supported values are "proto2", "proto3", and "editions".
1565
+
1566
+ If `edition` is present, this value must be "editions".
1567
+ WARNING: This field should only be used by protobuf plugins or special
1568
+ cases like the proto compiler. Other uses are discouraged and
1569
+ developers should rely on the protoreflect APIs for their client language.
1570
+ """
1571
+
1572
+ edition: "Edition" = betterproto2.field(14, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
1573
+ """
1574
+ The edition of the proto file.
1575
+ WARNING: This field should only be used by protobuf plugins or special
1576
+ cases like the proto compiler. Other uses are discouraged and
1577
+ developers should rely on the protoreflect APIs for their client language.
1578
+ """
1579
+
1580
+
1581
+ default_message_pool.register_message("google.protobuf", "FileDescriptorProto", FileDescriptorProto)
1582
+
1583
+
1584
+ @dataclass(eq=False, repr=False)
1585
+ class FileDescriptorSet(betterproto2.Message):
1586
+ """
1587
+ The protocol compiler can output a FileDescriptorSet containing the .proto
1588
+ files it parses.
1589
+ """
1590
+
1591
+ file: "list[FileDescriptorProto]" = betterproto2.field(1, betterproto2.TYPE_MESSAGE, repeated=True)
1592
+
1593
+
1594
+ default_message_pool.register_message("google.protobuf", "FileDescriptorSet", FileDescriptorSet)
1595
+
1596
+
1597
+ @dataclass(eq=False, repr=False)
1598
+ class FileOptions(betterproto2.Message):
1599
+ """
1600
+ ===================================================================
1601
+ Options
1602
+
1603
+ Each of the definitions above may have "options" attached. These are
1604
+ just annotations which may cause code to be generated slightly differently
1605
+ or may contain hints for code that manipulates protocol messages.
1606
+
1607
+ Clients may define custom options as extensions of the *Options messages.
1608
+ These extensions may not yet be known at parsing time, so the parser cannot
1609
+ store the values in them. Instead it stores them in a field in the *Options
1610
+ message called uninterpreted_option. This field must have the same name
1611
+ across all *Options messages. We then use this field to populate the
1612
+ extensions when we build a descriptor, at which point all protos have been
1613
+ parsed and so all extensions are known.
1614
+
1615
+ Extension numbers for custom options may be chosen as follows:
1616
+ * For options which will only be used within a single application or
1617
+ organization, or for experimental options, use field numbers 50000
1618
+ through 99999. It is up to you to ensure that you do not use the
1619
+ same number for multiple options.
1620
+ * For options which will be published and used publicly by multiple
1621
+ independent entities, e-mail protobuf-global-extension-registry@google.com
1622
+ to reserve extension numbers. Simply provide your project name (e.g.
1623
+ Objective-C plugin) and your project website (if available) -- there's no
1624
+ need to explain how you intend to use them. Usually you only need one
1625
+ extension number. You can declare multiple options with only one extension
1626
+ number by putting them in a sub-message. See the Custom Options section of
1627
+ the docs for examples:
1628
+ https://developers.google.com/protocol-buffers/docs/proto#options
1629
+ If this turns out to be popular, a web service will be set up
1630
+ to automatically assign option numbers.
1631
+ """
1632
+
1633
+ java_package: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
1634
+ """
1635
+ Sets the Java package where classes generated from this .proto will be
1636
+ placed. By default, the proto package is used, but this is often
1637
+ inappropriate because proto packages do not normally start with backwards
1638
+ domain names.
1639
+ """
1640
+
1641
+ java_outer_classname: "str" = betterproto2.field(8, betterproto2.TYPE_STRING)
1642
+ """
1643
+ Controls the name of the wrapper Java class generated for the .proto file.
1644
+ That class will always contain the .proto file's getDescriptor() method as
1645
+ well as any top-level extensions defined in the .proto file.
1646
+ If java_multiple_files is disabled, then all the other classes from the
1647
+ .proto file will be nested inside the single wrapper outer class.
1648
+ """
1649
+
1650
+ java_multiple_files: "bool" = betterproto2.field(10, betterproto2.TYPE_BOOL)
1651
+ """
1652
+ If enabled, then the Java code generator will generate a separate .java
1653
+ file for each top-level message, enum, and service defined in the .proto
1654
+ file. Thus, these types will *not* be nested inside the wrapper class
1655
+ named by java_outer_classname. However, the wrapper class will still be
1656
+ generated to contain the file's getDescriptor() method as well as any
1657
+ top-level extensions defined in the file.
1658
+ """
1659
+
1660
+ java_generate_equals_and_hash: "bool" = betterproto2.field(20, betterproto2.TYPE_BOOL)
1661
+ """
1662
+ This option does nothing.
1663
+ """
1664
+
1665
+ java_string_check_utf8: "bool" = betterproto2.field(27, betterproto2.TYPE_BOOL)
1666
+ """
1667
+ A proto2 file can set this to true to opt in to UTF-8 checking for Java,
1668
+ which will throw an exception if invalid UTF-8 is parsed from the wire or
1669
+ assigned to a string field.
1670
+
1671
+ TODO: clarify exactly what kinds of field types this option
1672
+ applies to, and update these docs accordingly.
1673
+
1674
+ Proto3 files already perform these checks. Setting the option explicitly to
1675
+ false has no effect: it cannot be used to opt proto3 files out of UTF-8
1676
+ checks.
1677
+ """
1678
+
1679
+ optimize_for: "FileOptionsOptimizeMode" = betterproto2.field(
1680
+ 9, betterproto2.TYPE_ENUM, default_factory=lambda: FileOptionsOptimizeMode(0)
1681
+ )
1682
+
1683
+ go_package: "str" = betterproto2.field(11, betterproto2.TYPE_STRING)
1684
+ """
1685
+ Sets the Go package where structs generated from this .proto will be
1686
+ placed. If omitted, the Go package will be derived from the following:
1687
+ - The basename of the package import path, if provided.
1688
+ - Otherwise, the package statement in the .proto file, if present.
1689
+ - Otherwise, the basename of the .proto file, without extension.
1690
+ """
1691
+
1692
+ cc_generic_services: "bool" = betterproto2.field(16, betterproto2.TYPE_BOOL)
1693
+ """
1694
+ Should generic services be generated in each language? "Generic" services
1695
+ are not specific to any particular RPC system. They are generated by the
1696
+ main code generators in each language (without additional plugins).
1697
+ Generic services were the only kind of service generation supported by
1698
+ early versions of google.protobuf.
1699
+
1700
+ Generic services are now considered deprecated in favor of using plugins
1701
+ that generate code specific to your particular RPC system. Therefore,
1702
+ these default to false. Old code which depends on generic services should
1703
+ explicitly set them to true.
1704
+ """
1705
+
1706
+ java_generic_services: "bool" = betterproto2.field(17, betterproto2.TYPE_BOOL)
1707
+
1708
+ py_generic_services: "bool" = betterproto2.field(18, betterproto2.TYPE_BOOL)
1709
+
1710
+ deprecated: "bool" = betterproto2.field(23, betterproto2.TYPE_BOOL)
1711
+ """
1712
+ Is this file deprecated?
1713
+ Depending on the target platform, this can emit Deprecated annotations
1714
+ for everything in the file, or it will be completely ignored; in the very
1715
+ least, this is a formalization for deprecating files.
1716
+ """
1717
+
1718
+ cc_enable_arenas: "bool" = betterproto2.field(31, betterproto2.TYPE_BOOL)
1719
+ """
1720
+ Enables the use of arenas for the proto messages in this file. This applies
1721
+ only to generated classes for C++.
1722
+ """
1723
+
1724
+ objc_class_prefix: "str" = betterproto2.field(36, betterproto2.TYPE_STRING)
1725
+ """
1726
+ Sets the objective c class prefix which is prepended to all objective c
1727
+ generated classes from this .proto. There is no default.
1728
+ """
1729
+
1730
+ csharp_namespace: "str" = betterproto2.field(37, betterproto2.TYPE_STRING)
1731
+ """
1732
+ Namespace for generated classes; defaults to the package.
1733
+ """
1734
+
1735
+ swift_prefix: "str" = betterproto2.field(39, betterproto2.TYPE_STRING)
1736
+ """
1737
+ By default Swift generators will take the proto package and CamelCase it
1738
+ replacing '.' with underscore and use that to prefix the types/symbols
1739
+ defined. When this options is provided, they will use this value instead
1740
+ to prefix the types/symbols defined.
1741
+ """
1742
+
1743
+ php_class_prefix: "str" = betterproto2.field(40, betterproto2.TYPE_STRING)
1744
+ """
1745
+ Sets the php class prefix which is prepended to all php generated classes
1746
+ from this .proto. Default is empty.
1747
+ """
1748
+
1749
+ php_namespace: "str" = betterproto2.field(41, betterproto2.TYPE_STRING)
1750
+ """
1751
+ Use this option to change the namespace of php generated classes. Default
1752
+ is empty. When this option is empty, the package name will be used for
1753
+ determining the namespace.
1754
+ """
1755
+
1756
+ php_metadata_namespace: "str" = betterproto2.field(44, betterproto2.TYPE_STRING)
1757
+ """
1758
+ Use this option to change the namespace of php generated metadata classes.
1759
+ Default is empty. When this option is empty, the proto file name will be
1760
+ used for determining the namespace.
1761
+ """
1762
+
1763
+ ruby_package: "str" = betterproto2.field(45, betterproto2.TYPE_STRING)
1764
+ """
1765
+ Use this option to change the package of ruby generated classes. Default
1766
+ is empty. When this option is not set, the package name will be used for
1767
+ determining the ruby package.
1768
+ """
1769
+
1770
+ features: "FeatureSet | None" = betterproto2.field(50, betterproto2.TYPE_MESSAGE, optional=True)
1771
+ """
1772
+ Any features defined in the specific edition.
1773
+ WARNING: This field should only be used by protobuf plugins or special
1774
+ cases like the proto compiler. Other uses are discouraged and
1775
+ developers should rely on the protoreflect APIs for their client language.
1776
+ """
1777
+
1778
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
1779
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
1780
+ )
1781
+ """
1782
+ The parser stores options it doesn't recognize here.
1783
+ See the documentation for the "Options" section above.
1784
+ """
1785
+
1786
+ def __post_init__(self) -> None:
1787
+ super().__post_init__()
1788
+ if self.is_set("java_generate_equals_and_hash"):
1789
+ warnings.warn("FileOptions.java_generate_equals_and_hash is deprecated", DeprecationWarning)
1790
+
1791
+
1792
+ default_message_pool.register_message("google.protobuf", "FileOptions", FileOptions)
1793
+
1794
+
1795
+ @dataclass(eq=False, repr=False)
1796
+ class GeneratedCodeInfo(betterproto2.Message):
1797
+ """
1798
+ Describes the relationship between generated code and its original source
1799
+ file. A GeneratedCodeInfo message is associated with only one generated
1800
+ source file, but may contain references to different source .proto files.
1801
+ """
1802
+
1803
+ annotation: "list[GeneratedCodeInfoAnnotation]" = betterproto2.field(1, betterproto2.TYPE_MESSAGE, repeated=True)
1804
+ """
1805
+ An Annotation connects some span of text in generated code to an element
1806
+ of its generating .proto file.
1807
+ """
1808
+
1809
+
1810
+ default_message_pool.register_message("google.protobuf", "GeneratedCodeInfo", GeneratedCodeInfo)
1811
+
1812
+
1813
+ @dataclass(eq=False, repr=False)
1814
+ class GeneratedCodeInfoAnnotation(betterproto2.Message):
1815
+ path: "list[int]" = betterproto2.field(1, betterproto2.TYPE_INT32, repeated=True)
1816
+ """
1817
+ Identifies the element in the original source .proto file. This field
1818
+ is formatted the same as SourceCodeInfo.Location.path.
1819
+ """
1820
+
1821
+ source_file: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
1822
+ """
1823
+ Identifies the filesystem path to the original source .proto.
1824
+ """
1825
+
1826
+ begin: "int" = betterproto2.field(3, betterproto2.TYPE_INT32)
1827
+ """
1828
+ Identifies the starting offset in bytes in the generated code
1829
+ that relates to the identified object.
1830
+ """
1831
+
1832
+ end: "int" = betterproto2.field(4, betterproto2.TYPE_INT32)
1833
+ """
1834
+ Identifies the ending offset in bytes in the generated code that
1835
+ relates to the identified object. The end offset should be one past
1836
+ the last relevant byte (so the length of the text = end - begin).
1837
+ """
1838
+
1839
+ semantic: "GeneratedCodeInfoAnnotationSemantic" = betterproto2.field(
1840
+ 5, betterproto2.TYPE_ENUM, default_factory=lambda: GeneratedCodeInfoAnnotationSemantic(0)
1841
+ )
1842
+
1843
+
1844
+ default_message_pool.register_message("google.protobuf", "GeneratedCodeInfo.Annotation", GeneratedCodeInfoAnnotation)
1845
+
1846
+
1847
+ @dataclass(eq=False, repr=False)
1848
+ class MessageOptions(betterproto2.Message):
1849
+ message_set_wire_format: "bool" = betterproto2.field(1, betterproto2.TYPE_BOOL)
1850
+ """
1851
+ Set true to use the old proto1 MessageSet wire format for extensions.
1852
+ This is provided for backwards-compatibility with the MessageSet wire
1853
+ format. You should not use this for any other reason: It's less
1854
+ efficient, has fewer features, and is more complicated.
1855
+
1856
+ The message must be defined exactly as follows:
1857
+ message Foo {
1858
+ option message_set_wire_format = true;
1859
+ extensions 4 to max;
1860
+ }
1861
+ Note that the message cannot have any defined fields; MessageSets only
1862
+ have extensions.
1863
+
1864
+ All extensions of your type must be singular messages; e.g. they cannot
1865
+ be int32s, enums, or repeated messages.
1866
+
1867
+ Because this is an option, the above two restrictions are not enforced by
1868
+ the protocol compiler.
1869
+ """
1870
+
1871
+ no_standard_descriptor_accessor: "bool" = betterproto2.field(2, betterproto2.TYPE_BOOL)
1872
+ """
1873
+ Disables the generation of the standard "descriptor()" accessor, which can
1874
+ conflict with a field of the same name. This is meant to make migration
1875
+ from proto1 easier; new code should avoid fields named "descriptor".
1876
+ """
1877
+
1878
+ deprecated: "bool" = betterproto2.field(3, betterproto2.TYPE_BOOL)
1879
+ """
1880
+ Is this message deprecated?
1881
+ Depending on the target platform, this can emit Deprecated annotations
1882
+ for the message, or it will be completely ignored; in the very least,
1883
+ this is a formalization for deprecating messages.
1884
+ """
1885
+
1886
+ map_entry: "bool" = betterproto2.field(7, betterproto2.TYPE_BOOL)
1887
+ """
1888
+ Whether the message is an automatically generated map entry type for the
1889
+ maps field.
1890
+
1891
+ For maps fields:
1892
+ map<KeyType, ValueType> map_field = 1;
1893
+ The parsed descriptor looks like:
1894
+ message MapFieldEntry {
1895
+ option map_entry = true;
1896
+ optional KeyType key = 1;
1897
+ optional ValueType value = 2;
1898
+ }
1899
+ repeated MapFieldEntry map_field = 1;
1900
+
1901
+ Implementations may choose not to generate the map_entry=true message, but
1902
+ use a native map in the target language to hold the keys and values.
1903
+ The reflection APIs in such implementations still need to work as
1904
+ if the field is a repeated message field.
1905
+
1906
+ NOTE: Do not set the option in .proto files. Always use the maps syntax
1907
+ instead. The option should only be implicitly set by the proto compiler
1908
+ parser.
1909
+ """
1910
+
1911
+ deprecated_legacy_json_field_conflicts: "bool" = betterproto2.field(11, betterproto2.TYPE_BOOL)
1912
+ """
1913
+ Enable the legacy handling of JSON field name conflicts. This lowercases
1914
+ and strips underscored from the fields before comparison in proto3 only.
1915
+ The new behavior takes `json_name` into account and applies to proto2 as
1916
+ well.
1917
+
1918
+ This should only be used as a temporary measure against broken builds due
1919
+ to the change in behavior for JSON field name conflicts.
1920
+
1921
+ TODO This is legacy behavior we plan to remove once downstream
1922
+ teams have had time to migrate.
1923
+ """
1924
+
1925
+ features: "FeatureSet | None" = betterproto2.field(12, betterproto2.TYPE_MESSAGE, optional=True)
1926
+ """
1927
+ Any features defined in the specific edition.
1928
+ WARNING: This field should only be used by protobuf plugins or special
1929
+ cases like the proto compiler. Other uses are discouraged and
1930
+ developers should rely on the protoreflect APIs for their client language.
1931
+ """
1932
+
1933
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
1934
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
1935
+ )
1936
+ """
1937
+ The parser stores options it doesn't recognize here. See above.
1938
+ """
1939
+
1940
+ def __post_init__(self) -> None:
1941
+ super().__post_init__()
1942
+ if self.is_set("deprecated_legacy_json_field_conflicts"):
1943
+ warnings.warn("MessageOptions.deprecated_legacy_json_field_conflicts is deprecated", DeprecationWarning)
1944
+
1945
+
1946
+ default_message_pool.register_message("google.protobuf", "MessageOptions", MessageOptions)
1947
+
1948
+
1949
+ @dataclass(eq=False, repr=False)
1950
+ class MethodDescriptorProto(betterproto2.Message):
1951
+ """
1952
+ Describes a method of a service.
1953
+ """
1954
+
1955
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
1956
+
1957
+ input_type: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
1958
+ """
1959
+ Input and output type names. These are resolved in the same way as
1960
+ FieldDescriptorProto.type_name, but must refer to a message type.
1961
+ """
1962
+
1963
+ output_type: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
1964
+
1965
+ options: "MethodOptions | None" = betterproto2.field(4, betterproto2.TYPE_MESSAGE, optional=True)
1966
+
1967
+ client_streaming: "bool" = betterproto2.field(5, betterproto2.TYPE_BOOL)
1968
+ """
1969
+ Identifies if client streams multiple client messages
1970
+ """
1971
+
1972
+ server_streaming: "bool" = betterproto2.field(6, betterproto2.TYPE_BOOL)
1973
+ """
1974
+ Identifies if server streams multiple server messages
1975
+ """
1976
+
1977
+
1978
+ default_message_pool.register_message("google.protobuf", "MethodDescriptorProto", MethodDescriptorProto)
1979
+
1980
+
1981
+ @dataclass(eq=False, repr=False)
1982
+ class MethodOptions(betterproto2.Message):
1983
+ deprecated: "bool" = betterproto2.field(33, betterproto2.TYPE_BOOL)
1984
+ """
1985
+ Note: Field numbers 1 through 32 are reserved for Google's internal RPC
1986
+ framework. We apologize for hoarding these numbers to ourselves, but
1987
+ we were already using them long before we decided to release Protocol
1988
+ Buffers.
1989
+
1990
+ Is this method deprecated?
1991
+ Depending on the target platform, this can emit Deprecated annotations
1992
+ for the method, or it will be completely ignored; in the very least,
1993
+ this is a formalization for deprecating methods.
1994
+ """
1995
+
1996
+ idempotency_level: "MethodOptionsIdempotencyLevel" = betterproto2.field(
1997
+ 34, betterproto2.TYPE_ENUM, default_factory=lambda: MethodOptionsIdempotencyLevel(0)
1998
+ )
1999
+
2000
+ features: "FeatureSet | None" = betterproto2.field(35, betterproto2.TYPE_MESSAGE, optional=True)
2001
+ """
2002
+ Any features defined in the specific edition.
2003
+ WARNING: This field should only be used by protobuf plugins or special
2004
+ cases like the proto compiler. Other uses are discouraged and
2005
+ developers should rely on the protoreflect APIs for their client language.
2006
+ """
2007
+
2008
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
2009
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
2010
+ )
2011
+ """
2012
+ The parser stores options it doesn't recognize here. See above.
2013
+ """
2014
+
2015
+
2016
+ default_message_pool.register_message("google.protobuf", "MethodOptions", MethodOptions)
2017
+
2018
+
2019
+ @dataclass(eq=False, repr=False)
2020
+ class OneofDescriptorProto(betterproto2.Message):
2021
+ """
2022
+ Describes a oneof.
2023
+ """
2024
+
2025
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
2026
+
2027
+ options: "OneofOptions | None" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, optional=True)
2028
+
2029
+
2030
+ default_message_pool.register_message("google.protobuf", "OneofDescriptorProto", OneofDescriptorProto)
2031
+
2032
+
2033
+ @dataclass(eq=False, repr=False)
2034
+ class OneofOptions(betterproto2.Message):
2035
+ features: "FeatureSet | None" = betterproto2.field(1, betterproto2.TYPE_MESSAGE, optional=True)
2036
+ """
2037
+ Any features defined in the specific edition.
2038
+ WARNING: This field should only be used by protobuf plugins or special
2039
+ cases like the proto compiler. Other uses are discouraged and
2040
+ developers should rely on the protoreflect APIs for their client language.
2041
+ """
2042
+
2043
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
2044
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
2045
+ )
2046
+ """
2047
+ The parser stores options it doesn't recognize here. See above.
2048
+ """
2049
+
2050
+
2051
+ default_message_pool.register_message("google.protobuf", "OneofOptions", OneofOptions)
2052
+
2053
+
2054
+ @dataclass(eq=False, repr=False)
2055
+ class ServiceDescriptorProto(betterproto2.Message):
2056
+ """
2057
+ Describes a service.
2058
+ """
2059
+
2060
+ name: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
2061
+
2062
+ method: "list[MethodDescriptorProto]" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, repeated=True)
2063
+
2064
+ options: "ServiceOptions | None" = betterproto2.field(3, betterproto2.TYPE_MESSAGE, optional=True)
2065
+
2066
+
2067
+ default_message_pool.register_message("google.protobuf", "ServiceDescriptorProto", ServiceDescriptorProto)
2068
+
2069
+
2070
+ @dataclass(eq=False, repr=False)
2071
+ class ServiceOptions(betterproto2.Message):
2072
+ features: "FeatureSet | None" = betterproto2.field(34, betterproto2.TYPE_MESSAGE, optional=True)
2073
+ """
2074
+ Any features defined in the specific edition.
2075
+ WARNING: This field should only be used by protobuf plugins or special
2076
+ cases like the proto compiler. Other uses are discouraged and
2077
+ developers should rely on the protoreflect APIs for their client language.
2078
+ """
2079
+
2080
+ deprecated: "bool" = betterproto2.field(33, betterproto2.TYPE_BOOL)
2081
+ """
2082
+ Note: Field numbers 1 through 32 are reserved for Google's internal RPC
2083
+ framework. We apologize for hoarding these numbers to ourselves, but
2084
+ we were already using them long before we decided to release Protocol
2085
+ Buffers.
2086
+
2087
+ Is this service deprecated?
2088
+ Depending on the target platform, this can emit Deprecated annotations
2089
+ for the service, or it will be completely ignored; in the very least,
2090
+ this is a formalization for deprecating services.
2091
+ """
2092
+
2093
+ uninterpreted_option: "list[UninterpretedOption]" = betterproto2.field(
2094
+ 999, betterproto2.TYPE_MESSAGE, repeated=True
2095
+ )
2096
+ """
2097
+ The parser stores options it doesn't recognize here. See above.
2098
+ """
2099
+
2100
+
2101
+ default_message_pool.register_message("google.protobuf", "ServiceOptions", ServiceOptions)
2102
+
2103
+
2104
+ @dataclass(eq=False, repr=False)
2105
+ class SourceCodeInfo(betterproto2.Message):
2106
+ """
2107
+ ===================================================================
2108
+ Optional source code info
2109
+
2110
+ Encapsulates information about the original source file from which a
2111
+ FileDescriptorProto was generated.
2112
+ """
2113
+
2114
+ location: "list[SourceCodeInfoLocation]" = betterproto2.field(1, betterproto2.TYPE_MESSAGE, repeated=True)
2115
+ """
2116
+ A Location identifies a piece of source code in a .proto file which
2117
+ corresponds to a particular definition. This information is intended
2118
+ to be useful to IDEs, code indexers, documentation generators, and similar
2119
+ tools.
2120
+
2121
+ For example, say we have a file like:
2122
+ message Foo {
2123
+ optional string foo = 1;
2124
+ }
2125
+ Let's look at just the field definition:
2126
+ optional string foo = 1;
2127
+ ^ ^^ ^^ ^ ^^^
2128
+ a bc de f ghi
2129
+ We have the following locations:
2130
+ span path represents
2131
+ [a,i) [ 4, 0, 2, 0 ] The whole field definition.
2132
+ [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
2133
+ [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
2134
+ [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
2135
+ [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
2136
+
2137
+ Notes:
2138
+ - A location may refer to a repeated field itself (i.e. not to any
2139
+ particular index within it). This is used whenever a set of elements are
2140
+ logically enclosed in a single code segment. For example, an entire
2141
+ extend block (possibly containing multiple extension definitions) will
2142
+ have an outer location whose path refers to the "extensions" repeated
2143
+ field without an index.
2144
+ - Multiple locations may have the same path. This happens when a single
2145
+ logical declaration is spread out across multiple places. The most
2146
+ obvious example is the "extend" block again -- there may be multiple
2147
+ extend blocks in the same scope, each of which will have the same path.
2148
+ - A location's span is not always a subset of its parent's span. For
2149
+ example, the "extendee" of an extension declaration appears at the
2150
+ beginning of the "extend" block and is shared by all extensions within
2151
+ the block.
2152
+ - Just because a location's span is a subset of some other location's span
2153
+ does not mean that it is a descendant. For example, a "group" defines
2154
+ both a type and a field in a single declaration. Thus, the locations
2155
+ corresponding to the type and field and their components will overlap.
2156
+ - Code which tries to interpret locations should probably be designed to
2157
+ ignore those that it doesn't understand, as more types of locations could
2158
+ be recorded in the future.
2159
+ """
2160
+
2161
+
2162
+ default_message_pool.register_message("google.protobuf", "SourceCodeInfo", SourceCodeInfo)
2163
+
2164
+
2165
+ @dataclass(eq=False, repr=False)
2166
+ class SourceCodeInfoLocation(betterproto2.Message):
2167
+ path: "list[int]" = betterproto2.field(1, betterproto2.TYPE_INT32, repeated=True)
2168
+ """
2169
+ Identifies which part of the FileDescriptorProto was defined at this
2170
+ location.
2171
+
2172
+ Each element is a field number or an index. They form a path from
2173
+ the root FileDescriptorProto to the place where the definition appears.
2174
+ For example, this path:
2175
+ [ 4, 3, 2, 7, 1 ]
2176
+ refers to:
2177
+ file.message_type(3) // 4, 3
2178
+ .field(7) // 2, 7
2179
+ .name() // 1
2180
+ This is because FileDescriptorProto.message_type has field number 4:
2181
+ repeated DescriptorProto message_type = 4;
2182
+ and DescriptorProto.field has field number 2:
2183
+ repeated FieldDescriptorProto field = 2;
2184
+ and FieldDescriptorProto.name has field number 1:
2185
+ optional string name = 1;
2186
+
2187
+ Thus, the above path gives the location of a field name. If we removed
2188
+ the last element:
2189
+ [ 4, 3, 2, 7 ]
2190
+ this path refers to the whole field declaration (from the beginning
2191
+ of the label to the terminating semicolon).
2192
+ """
2193
+
2194
+ span: "list[int]" = betterproto2.field(2, betterproto2.TYPE_INT32, repeated=True)
2195
+ """
2196
+ Always has exactly three or four elements: start line, start column,
2197
+ end line (optional, otherwise assumed same as start line), end column.
2198
+ These are packed into a single field for efficiency. Note that line
2199
+ and column numbers are zero-based -- typically you will want to add
2200
+ 1 to each before displaying to a user.
2201
+ """
2202
+
2203
+ leading_comments: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
2204
+ """
2205
+ If this SourceCodeInfo represents a complete declaration, these are any
2206
+ comments appearing before and after the declaration which appear to be
2207
+ attached to the declaration.
2208
+
2209
+ A series of line comments appearing on consecutive lines, with no other
2210
+ tokens appearing on those lines, will be treated as a single comment.
2211
+
2212
+ leading_detached_comments will keep paragraphs of comments that appear
2213
+ before (but not connected to) the current element. Each paragraph,
2214
+ separated by empty lines, will be one comment element in the repeated
2215
+ field.
2216
+
2217
+ Only the comment content is provided; comment markers (e.g. //) are
2218
+ stripped out. For block comments, leading whitespace and an asterisk
2219
+ will be stripped from the beginning of each line other than the first.
2220
+ Newlines are included in the output.
2221
+
2222
+ Examples:
2223
+
2224
+ optional int32 foo = 1; // Comment attached to foo.
2225
+ // Comment attached to bar.
2226
+ optional int32 bar = 2;
2227
+
2228
+ optional string baz = 3;
2229
+ // Comment attached to baz.
2230
+ // Another line attached to baz.
2231
+
2232
+ // Comment attached to moo.
2233
+ //
2234
+ // Another line attached to moo.
2235
+ optional double moo = 4;
2236
+
2237
+ // Detached comment for corge. This is not leading or trailing comments
2238
+ // to moo or corge because there are blank lines separating it from
2239
+ // both.
2240
+
2241
+ // Detached comment for corge paragraph 2.
2242
+
2243
+ optional string corge = 5;
2244
+ /* Block comment attached
2245
+ * to corge. Leading asterisks
2246
+ * will be removed. */
2247
+ /* Block comment attached to
2248
+ * grault. */
2249
+ optional int32 grault = 6;
2250
+
2251
+ // ignored detached comments.
2252
+ """
2253
+
2254
+ trailing_comments: "str" = betterproto2.field(4, betterproto2.TYPE_STRING)
2255
+
2256
+ leading_detached_comments: "list[str]" = betterproto2.field(6, betterproto2.TYPE_STRING, repeated=True)
2257
+
2258
+
2259
+ default_message_pool.register_message("google.protobuf", "SourceCodeInfo.Location", SourceCodeInfoLocation)
2260
+
2261
+
2262
+ @dataclass(eq=False, repr=False)
2263
+ class UninterpretedOption(betterproto2.Message):
2264
+ """
2265
+ A message representing a option the parser does not recognize. This only
2266
+ appears in options protos created by the compiler::Parser class.
2267
+ DescriptorPool resolves these when building Descriptor objects. Therefore,
2268
+ options protos in descriptor objects (e.g. returned by Descriptor::options(),
2269
+ or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
2270
+ in them.
2271
+ """
2272
+
2273
+ name: "list[UninterpretedOptionNamePart]" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, repeated=True)
2274
+
2275
+ identifier_value: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
2276
+ """
2277
+ The value of the uninterpreted option, in whatever type the tokenizer
2278
+ identified it as during parsing. Exactly one of these should be set.
2279
+ """
2280
+
2281
+ positive_int_value: "int" = betterproto2.field(4, betterproto2.TYPE_UINT64)
2282
+
2283
+ negative_int_value: "int" = betterproto2.field(5, betterproto2.TYPE_INT64)
2284
+
2285
+ double_value: "float" = betterproto2.field(6, betterproto2.TYPE_DOUBLE)
2286
+
2287
+ string_value: "bytes" = betterproto2.field(7, betterproto2.TYPE_BYTES)
2288
+
2289
+ aggregate_value: "str" = betterproto2.field(8, betterproto2.TYPE_STRING)
2290
+
2291
+
2292
+ default_message_pool.register_message("google.protobuf", "UninterpretedOption", UninterpretedOption)
2293
+
2294
+
2295
+ @dataclass(eq=False, repr=False)
2296
+ class UninterpretedOptionNamePart(betterproto2.Message):
2297
+ """
2298
+ The name of the uninterpreted option. Each string represents a segment in
2299
+ a dot-separated name. is_extension is true iff a segment represents an
2300
+ extension (denoted with parentheses in options specs in .proto files).
2301
+ E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
2302
+ "foo.(bar.baz).moo".
2303
+ """
2304
+
2305
+ name_part: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
2306
+
2307
+ is_extension: "bool" = betterproto2.field(2, betterproto2.TYPE_BOOL)
2308
+
2309
+
2310
+ default_message_pool.register_message("google.protobuf", "UninterpretedOption.NamePart", UninterpretedOptionNamePart)