Skip to content

StackedAttrArray

StackedAttrArray

Bases: Generic[T]

[De]serialize a list[T] of fixed length N using the syntax StackedAttrArray[N][T], where T can only be one of:

  • BaseStruct: each sub property of the struct is [de]serialized as its own list in order. For example, a StackedAttrArray[Point2D] will read a length followed by that many X values, followed by the same number of Y values (assuming Point2D has only two properties X and Y)
  • OptionX[S]: all the uXs are [de]serialized as their own list followed by as many objects of type S as non-zero uXs. All the indices with a zero uX are set to None

__class_getitem__ classmethod

__class_getitem__(item: Type[BaseStruct] | Type[Option]) -> type

from_bytes classmethod

from_bytes(bytes_: bytes, ver: Version = Version(0)) -> list[T]

from_file classmethod

from_file(filepath: str) -> list[T]

from_stream classmethod

from_stream(value: ByteStream, ver: Version = Version(0)) -> list[T]

to_bytes classmethod

to_bytes(value: list[T]) -> bytes

to_file classmethod

to_file(filepath: str, value: list[T])

StackedAttrArray8

Bases: StackedAttrArray[T], Generic[T]

[De]serialize a list[T] whose length is indicated by a leading u8 using the syntax StackedAttrArray8[T], where T can only be one of:

  • BaseStruct: each sub property of the struct is [de]serialized as its own list in order. For example, a StackedAttrArray8[Point2D] will read a length followed by that many X values, followed by the same number of Y values (assuming Point2D has only two properties X and Y)
  • OptionX[S]: all the uXs are [de]serialized as their own list followed by as many objects of type S as non-zero uXs. All the indices with a zero uX are set to None

StackedAttrArray16

Bases: StackedAttrArray[T], Generic[T]

[De]serialize a list[T] whose length is indicated by a leading u16 using the syntax StackedAttrArray16[T], where T can only be one of:

  • BaseStruct: each sub property of the struct is [de]serialized as its own list in order. For example, a StackedAttrArray16[Point2D] will read a length followed by that many X values, followed by the same number of Y values (assuming Point2D has only two properties X and Y)
  • OptionX[S]: all the uXs are [de]serialized as their own list followed by as many objects of type S as non-zero uXs. All the indices with a zero uX are set to None

StackedAttrArray32

Bases: StackedAttrArray[T], Generic[T]

[De]serialize a list[T] whose length is indicated by a leading u32 using the syntax StackedAttrArray32[T], where T can only be one of:

  • BaseStruct: each sub property of the struct is [de]serialized as its own list in order. For example, a StackedAttrArray32[Point2D] will read a length followed by that many X values, followed by the same number of Y values (assuming Point2D has only two properties X and Y)
  • OptionX[S]: all the uXs are [de]serialized as their own list followed by as many objects of type S as non-zero uXs. All the indices with a zero uX are set to None

StackedAttrArray64

Bases: StackedAttrArray[T], Generic[T]

[De]serialize a list[T] whose length is indicated by a leading u64 using the syntax StackedAttrArray64[T], where T can only be one of:

  • BaseStruct: each sub property of the struct is [de]serialized as its own list in order. For example, a StackedAttrArray64[Point2D] will read a length followed by that many X values, followed by the same number of Y values (assuming Point2D has only two properties X and Y)
  • OptionX[S]: all the uXs are [de]serialized as their own list followed by as many objects of type S as non-zero uXs. All the indices with a zero uX are set to None

StackedAttrArray128

Bases: StackedAttrArray[T], Generic[T]

[De]serialize a list[T] whose length is indicated by a leading u128 using the syntax StackedAttrArray128[T], where T can only be one of:

  • BaseStruct: each sub property of the struct is [de]serialized as its own list in order. For example, a StackedAttrArray128[Point2D] will read a length followed by that many X values, followed by the same number of Y values (assuming Point2D has only two properties X and Y)
  • OptionX[S]: all the uXs are [de]serialized as their own list followed by as many objects of type S as non-zero uXs. All the indices with a zero uX are set to None