KeyValue.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # automatically generated by the FlatBuffers compiler, do not modify
  2. # namespace: CalTableFlatBuffers
  3. import flatbuffers
  4. from flatbuffers.compat import import_numpy
  5. np = import_numpy()
  6. class KeyValue:
  7. __slots__ = ["_tab"]
  8. @classmethod
  9. def GetRootAs(cls, buf, offset=0): # noqa: N802
  10. n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
  11. x = KeyValue()
  12. x.Init(buf, n + offset)
  13. return x
  14. @classmethod
  15. def GetRootAsKeyValue(cls, buf, offset=0): # noqa: N802
  16. """This method is deprecated. Please switch to GetRootAs."""
  17. return cls.GetRootAs(buf, offset)
  18. # KeyValue
  19. def Init(self, buf, pos): # noqa: N802
  20. self._tab = flatbuffers.table.Table(buf, pos)
  21. # KeyValue
  22. def Key(self): # noqa: N802
  23. o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
  24. if o != 0:
  25. return self._tab.String(o + self._tab.Pos)
  26. return None
  27. # KeyValue
  28. def Value(self): # noqa: N802
  29. o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
  30. if o != 0:
  31. return self._tab.String(o + self._tab.Pos)
  32. return None
  33. def Start(builder): # noqa: N802
  34. builder.StartObject(2)
  35. def KeyValueStart(builder): # noqa: N802
  36. """This method is deprecated. Please switch to Start."""
  37. return Start(builder)
  38. def AddKey(builder, key): # noqa: N802
  39. builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)
  40. def KeyValueAddKey(builder, key): # noqa: N802
  41. """This method is deprecated. Please switch to AddKey."""
  42. return AddKey(builder, key)
  43. def AddValue(builder, value): # noqa: N802
  44. builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)
  45. def KeyValueAddValue(builder, value): # noqa: N802
  46. """This method is deprecated. Please switch to AddValue."""
  47. return AddValue(builder, value)
  48. def End(builder): # noqa: N802
  49. return builder.EndObject()
  50. def KeyValueEnd(builder): # noqa: N802
  51. """This method is deprecated. Please switch to End."""
  52. return End(builder)