ai-edge-litert-nightly 2.0.4.dev20251030__cp313-cp313-manylinux_2_27_x86_64.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.

Potentially problematic release.


This version of ai-edge-litert-nightly might be problematic. Click here for more details.

Files changed (74) hide show
  1. ai_edge_litert/__init__.py +1 -0
  2. ai_edge_litert/_pywrap_analyzer_wrapper.so +0 -0
  3. ai_edge_litert/_pywrap_litert_compiled_model_wrapper.so +0 -0
  4. ai_edge_litert/_pywrap_litert_tensor_buffer_wrapper.so +0 -0
  5. ai_edge_litert/_pywrap_modify_model_interface.so +0 -0
  6. ai_edge_litert/_pywrap_string_util.so +0 -0
  7. ai_edge_litert/_pywrap_tensorflow_interpreter_wrapper.so +0 -0
  8. ai_edge_litert/_pywrap_tensorflow_lite_calibration_wrapper.so +0 -0
  9. ai_edge_litert/_pywrap_tensorflow_lite_metrics_wrapper.so +0 -0
  10. ai_edge_litert/any_pb2.py +37 -0
  11. ai_edge_litert/aot/__init__.py +0 -0
  12. ai_edge_litert/aot/ai_pack/__init__.py +0 -0
  13. ai_edge_litert/aot/ai_pack/export_lib.py +300 -0
  14. ai_edge_litert/aot/aot_compile.py +153 -0
  15. ai_edge_litert/aot/core/__init__.py +0 -0
  16. ai_edge_litert/aot/core/apply_plugin.py +148 -0
  17. ai_edge_litert/aot/core/common.py +97 -0
  18. ai_edge_litert/aot/core/components.py +93 -0
  19. ai_edge_litert/aot/core/mlir_transforms.py +36 -0
  20. ai_edge_litert/aot/core/tflxx_util.py +30 -0
  21. ai_edge_litert/aot/core/types.py +374 -0
  22. ai_edge_litert/aot/prepare_for_npu.py +152 -0
  23. ai_edge_litert/aot/vendors/__init__.py +22 -0
  24. ai_edge_litert/aot/vendors/example/__init__.py +0 -0
  25. ai_edge_litert/aot/vendors/example/example_backend.py +157 -0
  26. ai_edge_litert/aot/vendors/fallback_backend.py +128 -0
  27. ai_edge_litert/aot/vendors/google_tensor/__init__.py +0 -0
  28. ai_edge_litert/aot/vendors/google_tensor/google_tensor_backend.py +168 -0
  29. ai_edge_litert/aot/vendors/google_tensor/target.py +83 -0
  30. ai_edge_litert/aot/vendors/import_vendor.py +132 -0
  31. ai_edge_litert/aot/vendors/mediatek/__init__.py +0 -0
  32. ai_edge_litert/aot/vendors/mediatek/mediatek_backend.py +196 -0
  33. ai_edge_litert/aot/vendors/mediatek/target.py +94 -0
  34. ai_edge_litert/aot/vendors/qualcomm/__init__.py +0 -0
  35. ai_edge_litert/aot/vendors/qualcomm/qualcomm_backend.py +161 -0
  36. ai_edge_litert/aot/vendors/qualcomm/target.py +74 -0
  37. ai_edge_litert/api_pb2.py +43 -0
  38. ai_edge_litert/compiled_model.py +250 -0
  39. ai_edge_litert/descriptor_pb2.py +3361 -0
  40. ai_edge_litert/duration_pb2.py +37 -0
  41. ai_edge_litert/empty_pb2.py +37 -0
  42. ai_edge_litert/field_mask_pb2.py +37 -0
  43. ai_edge_litert/format_converter_wrapper_pybind11.so +0 -0
  44. ai_edge_litert/hardware_accelerator.py +22 -0
  45. ai_edge_litert/internal/__init__.py +0 -0
  46. ai_edge_litert/internal/litertlm_builder.py +573 -0
  47. ai_edge_litert/internal/litertlm_core.py +58 -0
  48. ai_edge_litert/internal/litertlm_header_schema_py_generated.py +1595 -0
  49. ai_edge_litert/internal/llm_metadata_pb2.py +45 -0
  50. ai_edge_litert/internal/sampler_params_pb2.py +39 -0
  51. ai_edge_litert/interpreter.py +1039 -0
  52. ai_edge_litert/libLiteRtRuntimeCApi.so +0 -0
  53. ai_edge_litert/libpywrap_litert_common.so +0 -0
  54. ai_edge_litert/metrics_interface.py +48 -0
  55. ai_edge_litert/metrics_portable.py +70 -0
  56. ai_edge_litert/model_runtime_info_pb2.py +66 -0
  57. ai_edge_litert/plugin_pb2.py +46 -0
  58. ai_edge_litert/profiling_info_pb2.py +47 -0
  59. ai_edge_litert/pywrap_genai_ops.so +0 -0
  60. ai_edge_litert/schema_py_generated.py +19304 -0
  61. ai_edge_litert/source_context_pb2.py +37 -0
  62. ai_edge_litert/struct_pb2.py +47 -0
  63. ai_edge_litert/tensor_buffer.py +167 -0
  64. ai_edge_litert/timestamp_pb2.py +37 -0
  65. ai_edge_litert/tools/apply_plugin_main +0 -0
  66. ai_edge_litert/type_pb2.py +53 -0
  67. ai_edge_litert/vendors/google_tensor/compiler/libLiteRtCompilerPlugin_google_tensor.so +0 -0
  68. ai_edge_litert/vendors/mediatek/compiler/libLiteRtCompilerPlugin_MediaTek.so +0 -0
  69. ai_edge_litert/vendors/qualcomm/compiler/libLiteRtCompilerPlugin_Qualcomm.so +0 -0
  70. ai_edge_litert/wrappers_pb2.py +53 -0
  71. ai_edge_litert_nightly-2.0.4.dev20251030.dist-info/METADATA +48 -0
  72. ai_edge_litert_nightly-2.0.4.dev20251030.dist-info/RECORD +74 -0
  73. ai_edge_litert_nightly-2.0.4.dev20251030.dist-info/WHEEL +5 -0
  74. ai_edge_litert_nightly-2.0.4.dev20251030.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1595 @@
1
+ import flatbuffers
2
+
3
+ # automatically generated by the FlatBuffers compiler, do not modify
4
+
5
+ # namespace: schema
6
+
7
+ from flatbuffers.compat import import_numpy
8
+ np = import_numpy()
9
+
10
+ class VData(object):
11
+ NONE = 0
12
+ UInt8 = 1
13
+ Int8 = 2
14
+ UInt16 = 3
15
+ Int16 = 4
16
+ UInt32 = 5
17
+ Int32 = 6
18
+ Float32 = 7
19
+ Bool = 8
20
+ StringValue = 9
21
+ UInt64 = 10
22
+ Int64 = 11
23
+ Double = 12
24
+
25
+ def VdataCreator(unionType, table):
26
+ from flatbuffers.table import Table
27
+ if not isinstance(table, Table):
28
+ return None
29
+ if unionType == VData.UInt8:
30
+ return UInt8T.InitFromBuf(table.Bytes, table.Pos)
31
+ if unionType == VData.Int8:
32
+ return Int8T.InitFromBuf(table.Bytes, table.Pos)
33
+ if unionType == VData.UInt16:
34
+ return UInt16T.InitFromBuf(table.Bytes, table.Pos)
35
+ if unionType == VData.Int16:
36
+ return Int16T.InitFromBuf(table.Bytes, table.Pos)
37
+ if unionType == VData.UInt32:
38
+ return UInt32T.InitFromBuf(table.Bytes, table.Pos)
39
+ if unionType == VData.Int32:
40
+ return Int32T.InitFromBuf(table.Bytes, table.Pos)
41
+ if unionType == VData.Float32:
42
+ return Float32T.InitFromBuf(table.Bytes, table.Pos)
43
+ if unionType == VData.Bool:
44
+ return BoolT.InitFromBuf(table.Bytes, table.Pos)
45
+ if unionType == VData.StringValue:
46
+ return StringValueT.InitFromBuf(table.Bytes, table.Pos)
47
+ if unionType == VData.UInt64:
48
+ return UInt64T.InitFromBuf(table.Bytes, table.Pos)
49
+ if unionType == VData.Int64:
50
+ return Int64T.InitFromBuf(table.Bytes, table.Pos)
51
+ if unionType == VData.Double:
52
+ return DoubleT.InitFromBuf(table.Bytes, table.Pos)
53
+ return None
54
+
55
+
56
+ class AnySectionDataType(object):
57
+ NONE = 0
58
+ GenericBinaryData = 1
59
+ Deprecated = 2
60
+ TFLiteModel = 3
61
+ SP_Tokenizer = 4
62
+ LlmMetadataProto = 5
63
+ HF_Tokenizer_Zlib = 6
64
+
65
+
66
+ class UInt8(object):
67
+ __slots__ = ['_tab']
68
+
69
+ @classmethod
70
+ def GetRootAs(cls, buf, offset=0):
71
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
72
+ x = UInt8()
73
+ x.Init(buf, n + offset)
74
+ return x
75
+
76
+ @classmethod
77
+ def GetRootAsUInt8(cls, buf, offset=0):
78
+ """This method is deprecated. Please switch to GetRootAs."""
79
+ return cls.GetRootAs(buf, offset)
80
+ # UInt8
81
+ def Init(self, buf, pos):
82
+ self._tab = flatbuffers.table.Table(buf, pos)
83
+
84
+ # UInt8
85
+ def Value(self):
86
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
87
+ if o != 0:
88
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
89
+ return 0
90
+
91
+ def UInt8Start(builder):
92
+ builder.StartObject(1)
93
+
94
+ def UInt8AddValue(builder, value):
95
+ builder.PrependUint8Slot(0, value, 0)
96
+
97
+ def UInt8End(builder):
98
+ return builder.EndObject()
99
+
100
+
101
+
102
+ class UInt8T(object):
103
+
104
+ # UInt8T
105
+ def __init__(
106
+ self,
107
+ value = 0,
108
+ ):
109
+ self.value = value # type: int
110
+
111
+ @classmethod
112
+ def InitFromBuf(cls, buf, pos):
113
+ uint8 = UInt8()
114
+ uint8.Init(buf, pos)
115
+ return cls.InitFromObj(uint8)
116
+
117
+ @classmethod
118
+ def InitFromPackedBuf(cls, buf, pos=0):
119
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
120
+ return cls.InitFromBuf(buf, pos+n)
121
+
122
+ @classmethod
123
+ def InitFromObj(cls, uint8):
124
+ x = UInt8T()
125
+ x._UnPack(uint8)
126
+ return x
127
+
128
+ # UInt8T
129
+ def _UnPack(self, uint8):
130
+ if uint8 is None:
131
+ return
132
+ self.value = uint8.Value()
133
+
134
+ # UInt8T
135
+ def Pack(self, builder):
136
+ UInt8Start(builder)
137
+ UInt8AddValue(builder, self.value)
138
+ uint8 = UInt8End(builder)
139
+ return uint8
140
+
141
+
142
+ class Int8(object):
143
+ __slots__ = ['_tab']
144
+
145
+ @classmethod
146
+ def GetRootAs(cls, buf, offset=0):
147
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
148
+ x = Int8()
149
+ x.Init(buf, n + offset)
150
+ return x
151
+
152
+ @classmethod
153
+ def GetRootAsInt8(cls, buf, offset=0):
154
+ """This method is deprecated. Please switch to GetRootAs."""
155
+ return cls.GetRootAs(buf, offset)
156
+ # Int8
157
+ def Init(self, buf, pos):
158
+ self._tab = flatbuffers.table.Table(buf, pos)
159
+
160
+ # Int8
161
+ def Value(self):
162
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
163
+ if o != 0:
164
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
165
+ return 0
166
+
167
+ def Int8Start(builder):
168
+ builder.StartObject(1)
169
+
170
+ def Int8AddValue(builder, value):
171
+ builder.PrependInt8Slot(0, value, 0)
172
+
173
+ def Int8End(builder):
174
+ return builder.EndObject()
175
+
176
+
177
+
178
+ class Int8T(object):
179
+
180
+ # Int8T
181
+ def __init__(
182
+ self,
183
+ value = 0,
184
+ ):
185
+ self.value = value # type: int
186
+
187
+ @classmethod
188
+ def InitFromBuf(cls, buf, pos):
189
+ int8 = Int8()
190
+ int8.Init(buf, pos)
191
+ return cls.InitFromObj(int8)
192
+
193
+ @classmethod
194
+ def InitFromPackedBuf(cls, buf, pos=0):
195
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
196
+ return cls.InitFromBuf(buf, pos+n)
197
+
198
+ @classmethod
199
+ def InitFromObj(cls, int8):
200
+ x = Int8T()
201
+ x._UnPack(int8)
202
+ return x
203
+
204
+ # Int8T
205
+ def _UnPack(self, int8):
206
+ if int8 is None:
207
+ return
208
+ self.value = int8.Value()
209
+
210
+ # Int8T
211
+ def Pack(self, builder):
212
+ Int8Start(builder)
213
+ Int8AddValue(builder, self.value)
214
+ int8 = Int8End(builder)
215
+ return int8
216
+
217
+
218
+ class UInt16(object):
219
+ __slots__ = ['_tab']
220
+
221
+ @classmethod
222
+ def GetRootAs(cls, buf, offset=0):
223
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
224
+ x = UInt16()
225
+ x.Init(buf, n + offset)
226
+ return x
227
+
228
+ @classmethod
229
+ def GetRootAsUInt16(cls, buf, offset=0):
230
+ """This method is deprecated. Please switch to GetRootAs."""
231
+ return cls.GetRootAs(buf, offset)
232
+ # UInt16
233
+ def Init(self, buf, pos):
234
+ self._tab = flatbuffers.table.Table(buf, pos)
235
+
236
+ # UInt16
237
+ def Value(self):
238
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
239
+ if o != 0:
240
+ return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
241
+ return 0
242
+
243
+ def UInt16Start(builder):
244
+ builder.StartObject(1)
245
+
246
+ def UInt16AddValue(builder, value):
247
+ builder.PrependUint16Slot(0, value, 0)
248
+
249
+ def UInt16End(builder):
250
+ return builder.EndObject()
251
+
252
+
253
+
254
+ class UInt16T(object):
255
+
256
+ # UInt16T
257
+ def __init__(
258
+ self,
259
+ value = 0,
260
+ ):
261
+ self.value = value # type: int
262
+
263
+ @classmethod
264
+ def InitFromBuf(cls, buf, pos):
265
+ uint16 = UInt16()
266
+ uint16.Init(buf, pos)
267
+ return cls.InitFromObj(uint16)
268
+
269
+ @classmethod
270
+ def InitFromPackedBuf(cls, buf, pos=0):
271
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
272
+ return cls.InitFromBuf(buf, pos+n)
273
+
274
+ @classmethod
275
+ def InitFromObj(cls, uint16):
276
+ x = UInt16T()
277
+ x._UnPack(uint16)
278
+ return x
279
+
280
+ # UInt16T
281
+ def _UnPack(self, uint16):
282
+ if uint16 is None:
283
+ return
284
+ self.value = uint16.Value()
285
+
286
+ # UInt16T
287
+ def Pack(self, builder):
288
+ UInt16Start(builder)
289
+ UInt16AddValue(builder, self.value)
290
+ uint16 = UInt16End(builder)
291
+ return uint16
292
+
293
+
294
+ class Int16(object):
295
+ __slots__ = ['_tab']
296
+
297
+ @classmethod
298
+ def GetRootAs(cls, buf, offset=0):
299
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
300
+ x = Int16()
301
+ x.Init(buf, n + offset)
302
+ return x
303
+
304
+ @classmethod
305
+ def GetRootAsInt16(cls, buf, offset=0):
306
+ """This method is deprecated. Please switch to GetRootAs."""
307
+ return cls.GetRootAs(buf, offset)
308
+ # Int16
309
+ def Init(self, buf, pos):
310
+ self._tab = flatbuffers.table.Table(buf, pos)
311
+
312
+ # Int16
313
+ def Value(self):
314
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
315
+ if o != 0:
316
+ return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
317
+ return 0
318
+
319
+ def Int16Start(builder):
320
+ builder.StartObject(1)
321
+
322
+ def Int16AddValue(builder, value):
323
+ builder.PrependInt16Slot(0, value, 0)
324
+
325
+ def Int16End(builder):
326
+ return builder.EndObject()
327
+
328
+
329
+
330
+ class Int16T(object):
331
+
332
+ # Int16T
333
+ def __init__(
334
+ self,
335
+ value = 0,
336
+ ):
337
+ self.value = value # type: int
338
+
339
+ @classmethod
340
+ def InitFromBuf(cls, buf, pos):
341
+ int16 = Int16()
342
+ int16.Init(buf, pos)
343
+ return cls.InitFromObj(int16)
344
+
345
+ @classmethod
346
+ def InitFromPackedBuf(cls, buf, pos=0):
347
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
348
+ return cls.InitFromBuf(buf, pos+n)
349
+
350
+ @classmethod
351
+ def InitFromObj(cls, int16):
352
+ x = Int16T()
353
+ x._UnPack(int16)
354
+ return x
355
+
356
+ # Int16T
357
+ def _UnPack(self, int16):
358
+ if int16 is None:
359
+ return
360
+ self.value = int16.Value()
361
+
362
+ # Int16T
363
+ def Pack(self, builder):
364
+ Int16Start(builder)
365
+ Int16AddValue(builder, self.value)
366
+ int16 = Int16End(builder)
367
+ return int16
368
+
369
+
370
+ class UInt32(object):
371
+ __slots__ = ['_tab']
372
+
373
+ @classmethod
374
+ def GetRootAs(cls, buf, offset=0):
375
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
376
+ x = UInt32()
377
+ x.Init(buf, n + offset)
378
+ return x
379
+
380
+ @classmethod
381
+ def GetRootAsUInt32(cls, buf, offset=0):
382
+ """This method is deprecated. Please switch to GetRootAs."""
383
+ return cls.GetRootAs(buf, offset)
384
+ # UInt32
385
+ def Init(self, buf, pos):
386
+ self._tab = flatbuffers.table.Table(buf, pos)
387
+
388
+ # UInt32
389
+ def Value(self):
390
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
391
+ if o != 0:
392
+ return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
393
+ return 0
394
+
395
+ def UInt32Start(builder):
396
+ builder.StartObject(1)
397
+
398
+ def UInt32AddValue(builder, value):
399
+ builder.PrependUint32Slot(0, value, 0)
400
+
401
+ def UInt32End(builder):
402
+ return builder.EndObject()
403
+
404
+
405
+
406
+ class UInt32T(object):
407
+
408
+ # UInt32T
409
+ def __init__(
410
+ self,
411
+ value = 0,
412
+ ):
413
+ self.value = value # type: int
414
+
415
+ @classmethod
416
+ def InitFromBuf(cls, buf, pos):
417
+ uint32 = UInt32()
418
+ uint32.Init(buf, pos)
419
+ return cls.InitFromObj(uint32)
420
+
421
+ @classmethod
422
+ def InitFromPackedBuf(cls, buf, pos=0):
423
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
424
+ return cls.InitFromBuf(buf, pos+n)
425
+
426
+ @classmethod
427
+ def InitFromObj(cls, uint32):
428
+ x = UInt32T()
429
+ x._UnPack(uint32)
430
+ return x
431
+
432
+ # UInt32T
433
+ def _UnPack(self, uint32):
434
+ if uint32 is None:
435
+ return
436
+ self.value = uint32.Value()
437
+
438
+ # UInt32T
439
+ def Pack(self, builder):
440
+ UInt32Start(builder)
441
+ UInt32AddValue(builder, self.value)
442
+ uint32 = UInt32End(builder)
443
+ return uint32
444
+
445
+
446
+ class Int32(object):
447
+ __slots__ = ['_tab']
448
+
449
+ @classmethod
450
+ def GetRootAs(cls, buf, offset=0):
451
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
452
+ x = Int32()
453
+ x.Init(buf, n + offset)
454
+ return x
455
+
456
+ @classmethod
457
+ def GetRootAsInt32(cls, buf, offset=0):
458
+ """This method is deprecated. Please switch to GetRootAs."""
459
+ return cls.GetRootAs(buf, offset)
460
+ # Int32
461
+ def Init(self, buf, pos):
462
+ self._tab = flatbuffers.table.Table(buf, pos)
463
+
464
+ # Int32
465
+ def Value(self):
466
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
467
+ if o != 0:
468
+ return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
469
+ return 0
470
+
471
+ def Int32Start(builder):
472
+ builder.StartObject(1)
473
+
474
+ def Int32AddValue(builder, value):
475
+ builder.PrependInt32Slot(0, value, 0)
476
+
477
+ def Int32End(builder):
478
+ return builder.EndObject()
479
+
480
+
481
+
482
+ class Int32T(object):
483
+
484
+ # Int32T
485
+ def __init__(
486
+ self,
487
+ value = 0,
488
+ ):
489
+ self.value = value # type: int
490
+
491
+ @classmethod
492
+ def InitFromBuf(cls, buf, pos):
493
+ int32 = Int32()
494
+ int32.Init(buf, pos)
495
+ return cls.InitFromObj(int32)
496
+
497
+ @classmethod
498
+ def InitFromPackedBuf(cls, buf, pos=0):
499
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
500
+ return cls.InitFromBuf(buf, pos+n)
501
+
502
+ @classmethod
503
+ def InitFromObj(cls, int32):
504
+ x = Int32T()
505
+ x._UnPack(int32)
506
+ return x
507
+
508
+ # Int32T
509
+ def _UnPack(self, int32):
510
+ if int32 is None:
511
+ return
512
+ self.value = int32.Value()
513
+
514
+ # Int32T
515
+ def Pack(self, builder):
516
+ Int32Start(builder)
517
+ Int32AddValue(builder, self.value)
518
+ int32 = Int32End(builder)
519
+ return int32
520
+
521
+
522
+ class Float32(object):
523
+ __slots__ = ['_tab']
524
+
525
+ @classmethod
526
+ def GetRootAs(cls, buf, offset=0):
527
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
528
+ x = Float32()
529
+ x.Init(buf, n + offset)
530
+ return x
531
+
532
+ @classmethod
533
+ def GetRootAsFloat32(cls, buf, offset=0):
534
+ """This method is deprecated. Please switch to GetRootAs."""
535
+ return cls.GetRootAs(buf, offset)
536
+ # Float32
537
+ def Init(self, buf, pos):
538
+ self._tab = flatbuffers.table.Table(buf, pos)
539
+
540
+ # Float32
541
+ def Value(self):
542
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
543
+ if o != 0:
544
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
545
+ return 0.0
546
+
547
+ def Float32Start(builder):
548
+ builder.StartObject(1)
549
+
550
+ def Float32AddValue(builder, value):
551
+ builder.PrependFloat32Slot(0, value, 0.0)
552
+
553
+ def Float32End(builder):
554
+ return builder.EndObject()
555
+
556
+
557
+
558
+ class Float32T(object):
559
+
560
+ # Float32T
561
+ def __init__(
562
+ self,
563
+ value = 0.0,
564
+ ):
565
+ self.value = value # type: float
566
+
567
+ @classmethod
568
+ def InitFromBuf(cls, buf, pos):
569
+ float32 = Float32()
570
+ float32.Init(buf, pos)
571
+ return cls.InitFromObj(float32)
572
+
573
+ @classmethod
574
+ def InitFromPackedBuf(cls, buf, pos=0):
575
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
576
+ return cls.InitFromBuf(buf, pos+n)
577
+
578
+ @classmethod
579
+ def InitFromObj(cls, float32):
580
+ x = Float32T()
581
+ x._UnPack(float32)
582
+ return x
583
+
584
+ # Float32T
585
+ def _UnPack(self, float32):
586
+ if float32 is None:
587
+ return
588
+ self.value = float32.Value()
589
+
590
+ # Float32T
591
+ def Pack(self, builder):
592
+ Float32Start(builder)
593
+ Float32AddValue(builder, self.value)
594
+ float32 = Float32End(builder)
595
+ return float32
596
+
597
+
598
+ class Bool(object):
599
+ __slots__ = ['_tab']
600
+
601
+ @classmethod
602
+ def GetRootAs(cls, buf, offset=0):
603
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
604
+ x = Bool()
605
+ x.Init(buf, n + offset)
606
+ return x
607
+
608
+ @classmethod
609
+ def GetRootAsBool(cls, buf, offset=0):
610
+ """This method is deprecated. Please switch to GetRootAs."""
611
+ return cls.GetRootAs(buf, offset)
612
+ # Bool
613
+ def Init(self, buf, pos):
614
+ self._tab = flatbuffers.table.Table(buf, pos)
615
+
616
+ # Bool
617
+ def Value(self):
618
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
619
+ if o != 0:
620
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
621
+ return False
622
+
623
+ def BoolStart(builder):
624
+ builder.StartObject(1)
625
+
626
+ def BoolAddValue(builder, value):
627
+ builder.PrependBoolSlot(0, value, 0)
628
+
629
+ def BoolEnd(builder):
630
+ return builder.EndObject()
631
+
632
+
633
+
634
+ class BoolT(object):
635
+
636
+ # BoolT
637
+ def __init__(
638
+ self,
639
+ value = False,
640
+ ):
641
+ self.value = value # type: bool
642
+
643
+ @classmethod
644
+ def InitFromBuf(cls, buf, pos):
645
+ bool = Bool()
646
+ bool.Init(buf, pos)
647
+ return cls.InitFromObj(bool)
648
+
649
+ @classmethod
650
+ def InitFromPackedBuf(cls, buf, pos=0):
651
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
652
+ return cls.InitFromBuf(buf, pos+n)
653
+
654
+ @classmethod
655
+ def InitFromObj(cls, bool):
656
+ x = BoolT()
657
+ x._UnPack(bool)
658
+ return x
659
+
660
+ # BoolT
661
+ def _UnPack(self, bool):
662
+ if bool is None:
663
+ return
664
+ self.value = bool.Value()
665
+
666
+ # BoolT
667
+ def Pack(self, builder):
668
+ BoolStart(builder)
669
+ BoolAddValue(builder, self.value)
670
+ bool = BoolEnd(builder)
671
+ return bool
672
+
673
+
674
+ class UInt64(object):
675
+ __slots__ = ['_tab']
676
+
677
+ @classmethod
678
+ def GetRootAs(cls, buf, offset=0):
679
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
680
+ x = UInt64()
681
+ x.Init(buf, n + offset)
682
+ return x
683
+
684
+ @classmethod
685
+ def GetRootAsUInt64(cls, buf, offset=0):
686
+ """This method is deprecated. Please switch to GetRootAs."""
687
+ return cls.GetRootAs(buf, offset)
688
+ # UInt64
689
+ def Init(self, buf, pos):
690
+ self._tab = flatbuffers.table.Table(buf, pos)
691
+
692
+ # UInt64
693
+ def Value(self):
694
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
695
+ if o != 0:
696
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
697
+ return 0
698
+
699
+ def UInt64Start(builder):
700
+ builder.StartObject(1)
701
+
702
+ def UInt64AddValue(builder, value):
703
+ builder.PrependUint64Slot(0, value, 0)
704
+
705
+ def UInt64End(builder):
706
+ return builder.EndObject()
707
+
708
+
709
+
710
+ class UInt64T(object):
711
+
712
+ # UInt64T
713
+ def __init__(
714
+ self,
715
+ value = 0,
716
+ ):
717
+ self.value = value # type: int
718
+
719
+ @classmethod
720
+ def InitFromBuf(cls, buf, pos):
721
+ uint64 = UInt64()
722
+ uint64.Init(buf, pos)
723
+ return cls.InitFromObj(uint64)
724
+
725
+ @classmethod
726
+ def InitFromPackedBuf(cls, buf, pos=0):
727
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
728
+ return cls.InitFromBuf(buf, pos+n)
729
+
730
+ @classmethod
731
+ def InitFromObj(cls, uint64):
732
+ x = UInt64T()
733
+ x._UnPack(uint64)
734
+ return x
735
+
736
+ # UInt64T
737
+ def _UnPack(self, uint64):
738
+ if uint64 is None:
739
+ return
740
+ self.value = uint64.Value()
741
+
742
+ # UInt64T
743
+ def Pack(self, builder):
744
+ UInt64Start(builder)
745
+ UInt64AddValue(builder, self.value)
746
+ uint64 = UInt64End(builder)
747
+ return uint64
748
+
749
+
750
+ class Int64(object):
751
+ __slots__ = ['_tab']
752
+
753
+ @classmethod
754
+ def GetRootAs(cls, buf, offset=0):
755
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
756
+ x = Int64()
757
+ x.Init(buf, n + offset)
758
+ return x
759
+
760
+ @classmethod
761
+ def GetRootAsInt64(cls, buf, offset=0):
762
+ """This method is deprecated. Please switch to GetRootAs."""
763
+ return cls.GetRootAs(buf, offset)
764
+ # Int64
765
+ def Init(self, buf, pos):
766
+ self._tab = flatbuffers.table.Table(buf, pos)
767
+
768
+ # Int64
769
+ def Value(self):
770
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
771
+ if o != 0:
772
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
773
+ return 0
774
+
775
+ def Int64Start(builder):
776
+ builder.StartObject(1)
777
+
778
+ def Int64AddValue(builder, value):
779
+ builder.PrependInt64Slot(0, value, 0)
780
+
781
+ def Int64End(builder):
782
+ return builder.EndObject()
783
+
784
+
785
+
786
+ class Int64T(object):
787
+
788
+ # Int64T
789
+ def __init__(
790
+ self,
791
+ value = 0,
792
+ ):
793
+ self.value = value # type: int
794
+
795
+ @classmethod
796
+ def InitFromBuf(cls, buf, pos):
797
+ int64 = Int64()
798
+ int64.Init(buf, pos)
799
+ return cls.InitFromObj(int64)
800
+
801
+ @classmethod
802
+ def InitFromPackedBuf(cls, buf, pos=0):
803
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
804
+ return cls.InitFromBuf(buf, pos+n)
805
+
806
+ @classmethod
807
+ def InitFromObj(cls, int64):
808
+ x = Int64T()
809
+ x._UnPack(int64)
810
+ return x
811
+
812
+ # Int64T
813
+ def _UnPack(self, int64):
814
+ if int64 is None:
815
+ return
816
+ self.value = int64.Value()
817
+
818
+ # Int64T
819
+ def Pack(self, builder):
820
+ Int64Start(builder)
821
+ Int64AddValue(builder, self.value)
822
+ int64 = Int64End(builder)
823
+ return int64
824
+
825
+
826
+ class Double(object):
827
+ __slots__ = ['_tab']
828
+
829
+ @classmethod
830
+ def GetRootAs(cls, buf, offset=0):
831
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
832
+ x = Double()
833
+ x.Init(buf, n + offset)
834
+ return x
835
+
836
+ @classmethod
837
+ def GetRootAsDouble(cls, buf, offset=0):
838
+ """This method is deprecated. Please switch to GetRootAs."""
839
+ return cls.GetRootAs(buf, offset)
840
+ # Double
841
+ def Init(self, buf, pos):
842
+ self._tab = flatbuffers.table.Table(buf, pos)
843
+
844
+ # Double
845
+ def Value(self):
846
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
847
+ if o != 0:
848
+ return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
849
+ return 0.0
850
+
851
+ def DoubleStart(builder):
852
+ builder.StartObject(1)
853
+
854
+ def DoubleAddValue(builder, value):
855
+ builder.PrependFloat64Slot(0, value, 0.0)
856
+
857
+ def DoubleEnd(builder):
858
+ return builder.EndObject()
859
+
860
+
861
+
862
+ class DoubleT(object):
863
+
864
+ # DoubleT
865
+ def __init__(
866
+ self,
867
+ value = 0.0,
868
+ ):
869
+ self.value = value # type: float
870
+
871
+ @classmethod
872
+ def InitFromBuf(cls, buf, pos):
873
+ double = Double()
874
+ double.Init(buf, pos)
875
+ return cls.InitFromObj(double)
876
+
877
+ @classmethod
878
+ def InitFromPackedBuf(cls, buf, pos=0):
879
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
880
+ return cls.InitFromBuf(buf, pos+n)
881
+
882
+ @classmethod
883
+ def InitFromObj(cls, double):
884
+ x = DoubleT()
885
+ x._UnPack(double)
886
+ return x
887
+
888
+ # DoubleT
889
+ def _UnPack(self, double):
890
+ if double is None:
891
+ return
892
+ self.value = double.Value()
893
+
894
+ # DoubleT
895
+ def Pack(self, builder):
896
+ DoubleStart(builder)
897
+ DoubleAddValue(builder, self.value)
898
+ double = DoubleEnd(builder)
899
+ return double
900
+
901
+
902
+ class StringValue(object):
903
+ __slots__ = ['_tab']
904
+
905
+ @classmethod
906
+ def GetRootAs(cls, buf, offset=0):
907
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
908
+ x = StringValue()
909
+ x.Init(buf, n + offset)
910
+ return x
911
+
912
+ @classmethod
913
+ def GetRootAsStringValue(cls, buf, offset=0):
914
+ """This method is deprecated. Please switch to GetRootAs."""
915
+ return cls.GetRootAs(buf, offset)
916
+ # StringValue
917
+ def Init(self, buf, pos):
918
+ self._tab = flatbuffers.table.Table(buf, pos)
919
+
920
+ # StringValue
921
+ def Value(self):
922
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
923
+ if o != 0:
924
+ return self._tab.String(o + self._tab.Pos)
925
+ return None
926
+
927
+ def StringValueStart(builder):
928
+ builder.StartObject(1)
929
+
930
+ def StringValueAddValue(builder, value):
931
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)
932
+
933
+ def StringValueEnd(builder):
934
+ return builder.EndObject()
935
+
936
+
937
+
938
+ class StringValueT(object):
939
+
940
+ # StringValueT
941
+ def __init__(
942
+ self,
943
+ value = None,
944
+ ):
945
+ self.value = value # type: Optional[str]
946
+
947
+ @classmethod
948
+ def InitFromBuf(cls, buf, pos):
949
+ stringValue = StringValue()
950
+ stringValue.Init(buf, pos)
951
+ return cls.InitFromObj(stringValue)
952
+
953
+ @classmethod
954
+ def InitFromPackedBuf(cls, buf, pos=0):
955
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
956
+ return cls.InitFromBuf(buf, pos+n)
957
+
958
+ @classmethod
959
+ def InitFromObj(cls, stringValue):
960
+ x = StringValueT()
961
+ x._UnPack(stringValue)
962
+ return x
963
+
964
+ # StringValueT
965
+ def _UnPack(self, stringValue):
966
+ if stringValue is None:
967
+ return
968
+ self.value = stringValue.Value()
969
+
970
+ # StringValueT
971
+ def Pack(self, builder):
972
+ if self.value is not None:
973
+ value = builder.CreateString(self.value)
974
+ StringValueStart(builder)
975
+ if self.value is not None:
976
+ StringValueAddValue(builder, value)
977
+ stringValue = StringValueEnd(builder)
978
+ return stringValue
979
+
980
+
981
+ class KeyValuePair(object):
982
+ __slots__ = ['_tab']
983
+
984
+ @classmethod
985
+ def GetRootAs(cls, buf, offset=0):
986
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
987
+ x = KeyValuePair()
988
+ x.Init(buf, n + offset)
989
+ return x
990
+
991
+ @classmethod
992
+ def GetRootAsKeyValuePair(cls, buf, offset=0):
993
+ """This method is deprecated. Please switch to GetRootAs."""
994
+ return cls.GetRootAs(buf, offset)
995
+ # KeyValuePair
996
+ def Init(self, buf, pos):
997
+ self._tab = flatbuffers.table.Table(buf, pos)
998
+
999
+ # KeyValuePair
1000
+ def Key(self):
1001
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1002
+ if o != 0:
1003
+ return self._tab.String(o + self._tab.Pos)
1004
+ return None
1005
+
1006
+ # KeyValuePair
1007
+ def ValueType(self):
1008
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
1009
+ if o != 0:
1010
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
1011
+ return 0
1012
+
1013
+ # KeyValuePair
1014
+ def Value(self):
1015
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
1016
+ if o != 0:
1017
+ from flatbuffers.table import Table
1018
+ obj = Table(bytearray(), 0)
1019
+ self._tab.Union(obj, o)
1020
+ return obj
1021
+ return None
1022
+
1023
+ def KeyValuePairStart(builder):
1024
+ builder.StartObject(3)
1025
+
1026
+ def KeyValuePairAddKey(builder, key):
1027
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)
1028
+
1029
+ def KeyValuePairAddValueType(builder, valueType):
1030
+ builder.PrependUint8Slot(1, valueType, 0)
1031
+
1032
+ def KeyValuePairAddValue(builder, value):
1033
+ builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)
1034
+
1035
+ def KeyValuePairEnd(builder):
1036
+ return builder.EndObject()
1037
+
1038
+
1039
+ try:
1040
+ from typing import Union
1041
+ except:
1042
+ pass
1043
+
1044
+ class KeyValuePairT(object):
1045
+
1046
+ # KeyValuePairT
1047
+ def __init__(
1048
+ self,
1049
+ key = None,
1050
+ valueType = 0,
1051
+ value = None,
1052
+ ):
1053
+ self.key = key # type: Optional[str]
1054
+ self.valueType = valueType # type: int
1055
+ self.value = value # type: Union[None, 'UInt8T', 'Int8T', 'UInt16T', 'Int16T', 'UInt32T', 'Int32T', 'Float32T', 'BoolT', 'StringValueT', 'UInt64T', 'Int64T', 'DoubleT']
1056
+
1057
+ @classmethod
1058
+ def InitFromBuf(cls, buf, pos):
1059
+ keyValuePair = KeyValuePair()
1060
+ keyValuePair.Init(buf, pos)
1061
+ return cls.InitFromObj(keyValuePair)
1062
+
1063
+ @classmethod
1064
+ def InitFromPackedBuf(cls, buf, pos=0):
1065
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
1066
+ return cls.InitFromBuf(buf, pos+n)
1067
+
1068
+ @classmethod
1069
+ def InitFromObj(cls, keyValuePair):
1070
+ x = KeyValuePairT()
1071
+ x._UnPack(keyValuePair)
1072
+ return x
1073
+
1074
+ # KeyValuePairT
1075
+ def _UnPack(self, keyValuePair):
1076
+ if keyValuePair is None:
1077
+ return
1078
+ self.key = keyValuePair.Key()
1079
+ self.valueType = keyValuePair.ValueType()
1080
+ self.value = VDataCreator(self.valueType, keyValuePair.Value())
1081
+
1082
+ # KeyValuePairT
1083
+ def Pack(self, builder):
1084
+ if self.key is not None:
1085
+ key = builder.CreateString(self.key)
1086
+ if self.value is not None:
1087
+ value = self.value.Pack(builder)
1088
+ KeyValuePairStart(builder)
1089
+ if self.key is not None:
1090
+ KeyValuePairAddKey(builder, key)
1091
+ KeyValuePairAddValueType(builder, self.valueType)
1092
+ if self.value is not None:
1093
+ KeyValuePairAddValue(builder, value)
1094
+ keyValuePair = KeyValuePairEnd(builder)
1095
+ return keyValuePair
1096
+
1097
+
1098
+ class SystemMetadata(object):
1099
+ __slots__ = ['_tab']
1100
+
1101
+ @classmethod
1102
+ def GetRootAs(cls, buf, offset=0):
1103
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
1104
+ x = SystemMetadata()
1105
+ x.Init(buf, n + offset)
1106
+ return x
1107
+
1108
+ @classmethod
1109
+ def GetRootAsSystemMetadata(cls, buf, offset=0):
1110
+ """This method is deprecated. Please switch to GetRootAs."""
1111
+ return cls.GetRootAs(buf, offset)
1112
+ # SystemMetadata
1113
+ def Init(self, buf, pos):
1114
+ self._tab = flatbuffers.table.Table(buf, pos)
1115
+
1116
+ # SystemMetadata
1117
+ def Entries(self, j):
1118
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1119
+ if o != 0:
1120
+ x = self._tab.Vector(o)
1121
+ x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
1122
+ x = self._tab.Indirect(x)
1123
+ obj = KeyValuePair()
1124
+ obj.Init(self._tab.Bytes, x)
1125
+ return obj
1126
+ return None
1127
+
1128
+ # SystemMetadata
1129
+ def EntriesLength(self):
1130
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1131
+ if o != 0:
1132
+ return self._tab.VectorLen(o)
1133
+ return 0
1134
+
1135
+ # SystemMetadata
1136
+ def EntriesIsNone(self):
1137
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1138
+ return o == 0
1139
+
1140
+ def SystemMetadataStart(builder):
1141
+ builder.StartObject(1)
1142
+
1143
+ def SystemMetadataAddEntries(builder, entries):
1144
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(entries), 0)
1145
+
1146
+ def SystemMetadataStartEntriesVector(builder, numElems):
1147
+ return builder.StartVector(4, numElems, 4)
1148
+
1149
+ def SystemMetadataEnd(builder):
1150
+ return builder.EndObject()
1151
+
1152
+
1153
+ try:
1154
+ from typing import List
1155
+ except:
1156
+ pass
1157
+
1158
+ class SystemMetadataT(object):
1159
+
1160
+ # SystemMetadataT
1161
+ def __init__(
1162
+ self,
1163
+ entries = None,
1164
+ ):
1165
+ self.entries = entries # type: Optional[List[KeyValuePairT]]
1166
+
1167
+ @classmethod
1168
+ def InitFromBuf(cls, buf, pos):
1169
+ systemMetadata = SystemMetadata()
1170
+ systemMetadata.Init(buf, pos)
1171
+ return cls.InitFromObj(systemMetadata)
1172
+
1173
+ @classmethod
1174
+ def InitFromPackedBuf(cls, buf, pos=0):
1175
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
1176
+ return cls.InitFromBuf(buf, pos+n)
1177
+
1178
+ @classmethod
1179
+ def InitFromObj(cls, systemMetadata):
1180
+ x = SystemMetadataT()
1181
+ x._UnPack(systemMetadata)
1182
+ return x
1183
+
1184
+ # SystemMetadataT
1185
+ def _UnPack(self, systemMetadata):
1186
+ if systemMetadata is None:
1187
+ return
1188
+ if not systemMetadata.EntriesIsNone():
1189
+ self.entries = []
1190
+ for i in range(systemMetadata.EntriesLength()):
1191
+ if systemMetadata.Entries(i) is None:
1192
+ self.entries.append(None)
1193
+ else:
1194
+ keyValuePair_ = KeyValuePairT.InitFromObj(systemMetadata.Entries(i))
1195
+ self.entries.append(keyValuePair_)
1196
+
1197
+ # SystemMetadataT
1198
+ def Pack(self, builder):
1199
+ if self.entries is not None:
1200
+ entrieslist = []
1201
+ for i in range(len(self.entries)):
1202
+ entrieslist.append(self.entries[i].Pack(builder))
1203
+ SystemMetadataStartEntriesVector(builder, len(self.entries))
1204
+ for i in reversed(range(len(self.entries))):
1205
+ builder.PrependUOffsetTRelative(entrieslist[i])
1206
+ entries = builder.EndVector()
1207
+ SystemMetadataStart(builder)
1208
+ if self.entries is not None:
1209
+ SystemMetadataAddEntries(builder, entries)
1210
+ systemMetadata = SystemMetadataEnd(builder)
1211
+ return systemMetadata
1212
+
1213
+
1214
+ class SectionObject(object):
1215
+ __slots__ = ['_tab']
1216
+
1217
+ @classmethod
1218
+ def GetRootAs(cls, buf, offset=0):
1219
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
1220
+ x = SectionObject()
1221
+ x.Init(buf, n + offset)
1222
+ return x
1223
+
1224
+ @classmethod
1225
+ def GetRootAsSectionObject(cls, buf, offset=0):
1226
+ """This method is deprecated. Please switch to GetRootAs."""
1227
+ return cls.GetRootAs(buf, offset)
1228
+ # SectionObject
1229
+ def Init(self, buf, pos):
1230
+ self._tab = flatbuffers.table.Table(buf, pos)
1231
+
1232
+ # SectionObject
1233
+ def Items(self, j):
1234
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1235
+ if o != 0:
1236
+ x = self._tab.Vector(o)
1237
+ x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
1238
+ x = self._tab.Indirect(x)
1239
+ obj = KeyValuePair()
1240
+ obj.Init(self._tab.Bytes, x)
1241
+ return obj
1242
+ return None
1243
+
1244
+ # SectionObject
1245
+ def ItemsLength(self):
1246
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1247
+ if o != 0:
1248
+ return self._tab.VectorLen(o)
1249
+ return 0
1250
+
1251
+ # SectionObject
1252
+ def ItemsIsNone(self):
1253
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1254
+ return o == 0
1255
+
1256
+ # SectionObject
1257
+ def BeginOffset(self):
1258
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
1259
+ if o != 0:
1260
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
1261
+ return 0
1262
+
1263
+ # SectionObject
1264
+ def EndOffset(self):
1265
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
1266
+ if o != 0:
1267
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
1268
+ return 0
1269
+
1270
+ # SectionObject
1271
+ def DataType(self):
1272
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
1273
+ if o != 0:
1274
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
1275
+ return 0
1276
+
1277
+ def SectionObjectStart(builder):
1278
+ builder.StartObject(4)
1279
+
1280
+ def SectionObjectAddItems(builder, items):
1281
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(items), 0)
1282
+
1283
+ def SectionObjectStartItemsVector(builder, numElems):
1284
+ return builder.StartVector(4, numElems, 4)
1285
+
1286
+ def SectionObjectAddBeginOffset(builder, beginOffset):
1287
+ builder.PrependUint64Slot(1, beginOffset, 0)
1288
+
1289
+ def SectionObjectAddEndOffset(builder, endOffset):
1290
+ builder.PrependUint64Slot(2, endOffset, 0)
1291
+
1292
+ def SectionObjectAddDataType(builder, dataType):
1293
+ builder.PrependUint8Slot(3, dataType, 0)
1294
+
1295
+ def SectionObjectEnd(builder):
1296
+ return builder.EndObject()
1297
+
1298
+
1299
+ try:
1300
+ from typing import List
1301
+ except:
1302
+ pass
1303
+
1304
+ class SectionObjectT(object):
1305
+
1306
+ # SectionObjectT
1307
+ def __init__(
1308
+ self,
1309
+ items = None,
1310
+ beginOffset = 0,
1311
+ endOffset = 0,
1312
+ dataType = 0,
1313
+ ):
1314
+ self.items = items # type: Optional[List[KeyValuePairT]]
1315
+ self.beginOffset = beginOffset # type: int
1316
+ self.endOffset = endOffset # type: int
1317
+ self.dataType = dataType # type: int
1318
+
1319
+ @classmethod
1320
+ def InitFromBuf(cls, buf, pos):
1321
+ sectionObject = SectionObject()
1322
+ sectionObject.Init(buf, pos)
1323
+ return cls.InitFromObj(sectionObject)
1324
+
1325
+ @classmethod
1326
+ def InitFromPackedBuf(cls, buf, pos=0):
1327
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
1328
+ return cls.InitFromBuf(buf, pos+n)
1329
+
1330
+ @classmethod
1331
+ def InitFromObj(cls, sectionObject):
1332
+ x = SectionObjectT()
1333
+ x._UnPack(sectionObject)
1334
+ return x
1335
+
1336
+ # SectionObjectT
1337
+ def _UnPack(self, sectionObject):
1338
+ if sectionObject is None:
1339
+ return
1340
+ if not sectionObject.ItemsIsNone():
1341
+ self.items = []
1342
+ for i in range(sectionObject.ItemsLength()):
1343
+ if sectionObject.Items(i) is None:
1344
+ self.items.append(None)
1345
+ else:
1346
+ keyValuePair_ = KeyValuePairT.InitFromObj(sectionObject.Items(i))
1347
+ self.items.append(keyValuePair_)
1348
+ self.beginOffset = sectionObject.BeginOffset()
1349
+ self.endOffset = sectionObject.EndOffset()
1350
+ self.dataType = sectionObject.DataType()
1351
+
1352
+ # SectionObjectT
1353
+ def Pack(self, builder):
1354
+ if self.items is not None:
1355
+ itemslist = []
1356
+ for i in range(len(self.items)):
1357
+ itemslist.append(self.items[i].Pack(builder))
1358
+ SectionObjectStartItemsVector(builder, len(self.items))
1359
+ for i in reversed(range(len(self.items))):
1360
+ builder.PrependUOffsetTRelative(itemslist[i])
1361
+ items = builder.EndVector()
1362
+ SectionObjectStart(builder)
1363
+ if self.items is not None:
1364
+ SectionObjectAddItems(builder, items)
1365
+ SectionObjectAddBeginOffset(builder, self.beginOffset)
1366
+ SectionObjectAddEndOffset(builder, self.endOffset)
1367
+ SectionObjectAddDataType(builder, self.dataType)
1368
+ sectionObject = SectionObjectEnd(builder)
1369
+ return sectionObject
1370
+
1371
+
1372
+ class SectionMetadata(object):
1373
+ __slots__ = ['_tab']
1374
+
1375
+ @classmethod
1376
+ def GetRootAs(cls, buf, offset=0):
1377
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
1378
+ x = SectionMetadata()
1379
+ x.Init(buf, n + offset)
1380
+ return x
1381
+
1382
+ @classmethod
1383
+ def GetRootAsSectionMetadata(cls, buf, offset=0):
1384
+ """This method is deprecated. Please switch to GetRootAs."""
1385
+ return cls.GetRootAs(buf, offset)
1386
+ # SectionMetadata
1387
+ def Init(self, buf, pos):
1388
+ self._tab = flatbuffers.table.Table(buf, pos)
1389
+
1390
+ # SectionMetadata
1391
+ def Objects(self, j):
1392
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1393
+ if o != 0:
1394
+ x = self._tab.Vector(o)
1395
+ x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
1396
+ x = self._tab.Indirect(x)
1397
+ obj = SectionObject()
1398
+ obj.Init(self._tab.Bytes, x)
1399
+ return obj
1400
+ return None
1401
+
1402
+ # SectionMetadata
1403
+ def ObjectsLength(self):
1404
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1405
+ if o != 0:
1406
+ return self._tab.VectorLen(o)
1407
+ return 0
1408
+
1409
+ # SectionMetadata
1410
+ def ObjectsIsNone(self):
1411
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1412
+ return o == 0
1413
+
1414
+ def SectionMetadataStart(builder):
1415
+ builder.StartObject(1)
1416
+
1417
+ def SectionMetadataAddObjects(builder, objects):
1418
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(objects), 0)
1419
+
1420
+ def SectionMetadataStartObjectsVector(builder, numElems):
1421
+ return builder.StartVector(4, numElems, 4)
1422
+
1423
+ def SectionMetadataEnd(builder):
1424
+ return builder.EndObject()
1425
+
1426
+
1427
+ try:
1428
+ from typing import List
1429
+ except:
1430
+ pass
1431
+
1432
+ class SectionMetadataT(object):
1433
+
1434
+ # SectionMetadataT
1435
+ def __init__(
1436
+ self,
1437
+ objects = None,
1438
+ ):
1439
+ self.objects = objects # type: Optional[List[SectionObjectT]]
1440
+
1441
+ @classmethod
1442
+ def InitFromBuf(cls, buf, pos):
1443
+ sectionMetadata = SectionMetadata()
1444
+ sectionMetadata.Init(buf, pos)
1445
+ return cls.InitFromObj(sectionMetadata)
1446
+
1447
+ @classmethod
1448
+ def InitFromPackedBuf(cls, buf, pos=0):
1449
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
1450
+ return cls.InitFromBuf(buf, pos+n)
1451
+
1452
+ @classmethod
1453
+ def InitFromObj(cls, sectionMetadata):
1454
+ x = SectionMetadataT()
1455
+ x._UnPack(sectionMetadata)
1456
+ return x
1457
+
1458
+ # SectionMetadataT
1459
+ def _UnPack(self, sectionMetadata):
1460
+ if sectionMetadata is None:
1461
+ return
1462
+ if not sectionMetadata.ObjectsIsNone():
1463
+ self.objects = []
1464
+ for i in range(sectionMetadata.ObjectsLength()):
1465
+ if sectionMetadata.Objects(i) is None:
1466
+ self.objects.append(None)
1467
+ else:
1468
+ sectionObject_ = SectionObjectT.InitFromObj(sectionMetadata.Objects(i))
1469
+ self.objects.append(sectionObject_)
1470
+
1471
+ # SectionMetadataT
1472
+ def Pack(self, builder):
1473
+ if self.objects is not None:
1474
+ objectslist = []
1475
+ for i in range(len(self.objects)):
1476
+ objectslist.append(self.objects[i].Pack(builder))
1477
+ SectionMetadataStartObjectsVector(builder, len(self.objects))
1478
+ for i in reversed(range(len(self.objects))):
1479
+ builder.PrependUOffsetTRelative(objectslist[i])
1480
+ objects = builder.EndVector()
1481
+ SectionMetadataStart(builder)
1482
+ if self.objects is not None:
1483
+ SectionMetadataAddObjects(builder, objects)
1484
+ sectionMetadata = SectionMetadataEnd(builder)
1485
+ return sectionMetadata
1486
+
1487
+
1488
+ class LiteRTLMMetaData(object):
1489
+ __slots__ = ['_tab']
1490
+
1491
+ @classmethod
1492
+ def GetRootAs(cls, buf, offset=0):
1493
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
1494
+ x = LiteRTLMMetaData()
1495
+ x.Init(buf, n + offset)
1496
+ return x
1497
+
1498
+ @classmethod
1499
+ def GetRootAsLiteRTLMMetaData(cls, buf, offset=0):
1500
+ """This method is deprecated. Please switch to GetRootAs."""
1501
+ return cls.GetRootAs(buf, offset)
1502
+ # LiteRTLMMetaData
1503
+ def Init(self, buf, pos):
1504
+ self._tab = flatbuffers.table.Table(buf, pos)
1505
+
1506
+ # LiteRTLMMetaData
1507
+ def SystemMetadata(self):
1508
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1509
+ if o != 0:
1510
+ x = self._tab.Indirect(o + self._tab.Pos)
1511
+ obj = SystemMetadata()
1512
+ obj.Init(self._tab.Bytes, x)
1513
+ return obj
1514
+ return None
1515
+
1516
+ # LiteRTLMMetaData
1517
+ def SectionMetadata(self):
1518
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
1519
+ if o != 0:
1520
+ x = self._tab.Indirect(o + self._tab.Pos)
1521
+ obj = SectionMetadata()
1522
+ obj.Init(self._tab.Bytes, x)
1523
+ return obj
1524
+ return None
1525
+
1526
+ def LiteRTLMMetaDataStart(builder):
1527
+ builder.StartObject(2)
1528
+
1529
+ def LiteRTLMMetaDataAddSystemMetadata(builder, systemMetadata):
1530
+ builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(systemMetadata), 0)
1531
+
1532
+ def LiteRTLMMetaDataAddSectionMetadata(builder, sectionMetadata):
1533
+ builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(sectionMetadata), 0)
1534
+
1535
+ def LiteRTLMMetaDataEnd(builder):
1536
+ return builder.EndObject()
1537
+
1538
+
1539
+ try:
1540
+ from typing import Optional
1541
+ except:
1542
+ pass
1543
+
1544
+ class LiteRTLMMetaDataT(object):
1545
+
1546
+ # LiteRTLMMetaDataT
1547
+ def __init__(
1548
+ self,
1549
+ systemMetadata = None,
1550
+ sectionMetadata = None,
1551
+ ):
1552
+ self.systemMetadata = systemMetadata # type: Optional[SystemMetadataT]
1553
+ self.sectionMetadata = sectionMetadata # type: Optional[SectionMetadataT]
1554
+
1555
+ @classmethod
1556
+ def InitFromBuf(cls, buf, pos):
1557
+ liteRtlmmetaData = LiteRTLMMetaData()
1558
+ liteRtlmmetaData.Init(buf, pos)
1559
+ return cls.InitFromObj(liteRtlmmetaData)
1560
+
1561
+ @classmethod
1562
+ def InitFromPackedBuf(cls, buf, pos=0):
1563
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
1564
+ return cls.InitFromBuf(buf, pos+n)
1565
+
1566
+ @classmethod
1567
+ def InitFromObj(cls, liteRtlmmetaData):
1568
+ x = LiteRTLMMetaDataT()
1569
+ x._UnPack(liteRtlmmetaData)
1570
+ return x
1571
+
1572
+ # LiteRTLMMetaDataT
1573
+ def _UnPack(self, liteRtlmmetaData):
1574
+ if liteRtlmmetaData is None:
1575
+ return
1576
+ if liteRtlmmetaData.SystemMetadata() is not None:
1577
+ self.systemMetadata = SystemMetadataT.InitFromObj(liteRtlmmetaData.SystemMetadata())
1578
+ if liteRtlmmetaData.SectionMetadata() is not None:
1579
+ self.sectionMetadata = SectionMetadataT.InitFromObj(liteRtlmmetaData.SectionMetadata())
1580
+
1581
+ # LiteRTLMMetaDataT
1582
+ def Pack(self, builder):
1583
+ if self.systemMetadata is not None:
1584
+ systemMetadata = self.systemMetadata.Pack(builder)
1585
+ if self.sectionMetadata is not None:
1586
+ sectionMetadata = self.sectionMetadata.Pack(builder)
1587
+ LiteRTLMMetaDataStart(builder)
1588
+ if self.systemMetadata is not None:
1589
+ LiteRTLMMetaDataAddSystemMetadata(builder, systemMetadata)
1590
+ if self.sectionMetadata is not None:
1591
+ LiteRTLMMetaDataAddSectionMetadata(builder, sectionMetadata)
1592
+ liteRtlmmetaData = LiteRTLMMetaDataEnd(builder)
1593
+ return liteRtlmmetaData
1594
+
1595
+