mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
* fix(flatbuffers): use manual impl Default for struct object types * fix: handle bool and float zero literals in struct object Default impl * fix: regenerate all test bindings with generate_code.py * fix: data type check on swift build * fix: test large array on struct and enum
61 lines
2.3 KiB
Python
61 lines
2.3 KiB
Python
from __future__ import annotations
|
|
|
|
import flatbuffers
|
|
import numpy as np
|
|
|
|
import typing
|
|
from MyGame.Example.NestedStruct import NestedStruct, NestedStructT
|
|
from MyGame.Example.TestEnum import TestEnum
|
|
|
|
uoffset: typing.TypeAlias = flatbuffers.number_types.UOffsetTFlags.py_type
|
|
|
|
class LargeArrayStruct(object):
|
|
@classmethod
|
|
def SizeOf(cls) -> int: ...
|
|
|
|
def Init(self, buf: bytes, pos: int) -> None: ...
|
|
def D(self, i: int) -> typing.List[int]: ...
|
|
def DAsNumpy(self) -> np.ndarray: ...
|
|
def DLength(self) -> int: ...
|
|
def DIsNone(self) -> bool: ...
|
|
def E(self, i: int) -> typing.List[float]: ...
|
|
def EAsNumpy(self) -> np.ndarray: ...
|
|
def ELength(self) -> int: ...
|
|
def EIsNone(self) -> bool: ...
|
|
def F(self, i: int) -> typing.List[bool]: ...
|
|
def FAsNumpy(self) -> np.ndarray: ...
|
|
def FLength(self) -> int: ...
|
|
def FIsNone(self) -> bool: ...
|
|
def G(self, i: int) -> NestedStruct | None: ...
|
|
def GLength(self) -> int: ...
|
|
def GIsNone(self) -> bool: ...
|
|
def H(self, i: int) -> typing.Literal[TestEnum.A, TestEnum.B, TestEnum.C]: ...
|
|
def HAsNumpy(self) -> np.ndarray: ...
|
|
def HLength(self) -> int: ...
|
|
def HIsNone(self) -> bool: ...
|
|
class LargeArrayStructT(object):
|
|
d: typing.List[int]
|
|
e: typing.List[float]
|
|
f: typing.List[bool]
|
|
g: typing.List[NestedStructT]
|
|
h: typing.List[typing.Literal[TestEnum.A, TestEnum.B, TestEnum.C]]
|
|
def __init__(
|
|
self,
|
|
d: typing.List[int] | None = ...,
|
|
e: typing.List[float] | None = ...,
|
|
f: typing.List[bool] | None = ...,
|
|
g: typing.List['NestedStructT'] | None = ...,
|
|
h: typing.List[typing.Literal[TestEnum.A, TestEnum.B, TestEnum.C]] | None = ...,
|
|
) -> None: ...
|
|
@classmethod
|
|
def InitFromBuf(cls, buf: bytes, pos: int) -> LargeArrayStructT: ...
|
|
@classmethod
|
|
def InitFromPackedBuf(cls, buf: bytes, pos: int = 0) -> LargeArrayStructT: ...
|
|
@classmethod
|
|
def InitFromObj(cls, largeArrayStruct: LargeArrayStruct) -> LargeArrayStructT: ...
|
|
def _UnPack(self, largeArrayStruct: LargeArrayStruct) -> None: ...
|
|
def Pack(self, builder: flatbuffers.Builder) -> None: ...
|
|
|
|
def CreateLargeArrayStruct(builder: flatbuffers.Builder, d: int, e: float, f: bool, g_a: int, g_b: typing.Literal[TestEnum.A, TestEnum.B, TestEnum.C], g_c: typing.Literal[TestEnum.A, TestEnum.B, TestEnum.C], g_d: int, h: typing.Literal[TestEnum.A, TestEnum.B, TestEnum.C]) -> uoffset: ...
|
|
|