# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs # Based on "crates/build/re_type_definitions/rerun/encodings/ivec3d.def.rs". # You can extend this class by creating a "IVec3DExt" class in "ivec3d_ext.py". from __future__ import annotations from collections.abc import Sequence from typing import TYPE_CHECKING, Any import numpy as np import numpy.typing as npt import pyarrow as pa from attrs import define, field from .._baseclasses import ( BaseBatch, ) from .._converters import ( to_np_int32, ) from .._numpy_compatibility import asarray from .ivec3d_ext import IVec3DExt __all__ = ["IVec3D", "IVec3DArrayLike", "IVec3DBatch", "IVec3DLike"] @define(init=False) class IVec3D(IVec3DExt): """**Encoding**: An int32 vector in 3D space.""" def __init__(self: Any, xyz: IVec3DLike) -> None: """Create a new instance of the IVec3D encoding.""" # You can define your own __init__ function as a member of IVec3DExt in ivec3d_ext.py self.__attrs_init__(xyz=xyz) xyz: npt.NDArray[np.int32] = field(converter=to_np_int32) def __array__(self, dtype: npt.DTypeLike = None, copy: bool | None = None) -> npt.NDArray[Any]: # You can define your own __array__ function as a member of IVec3DExt in ivec3d_ext.py return asarray(self.xyz, dtype=dtype, copy=copy) def __len__(self) -> int: # You can define your own __len__ function as a member of IVec3DExt in ivec3d_ext.py return len(self.xyz) if TYPE_CHECKING: IVec3DLike = IVec3D | npt.NDArray[Any] | npt.ArrayLike | Sequence[int] """A type alias for any IVec3D-like object.""" else: IVec3DLike = Any IVec3DArrayLike = ( IVec3D | Sequence[IVec3DLike] | npt.NDArray[Any] | npt.ArrayLike | Sequence[Sequence[int]] | Sequence[int] ) """A type alias for any IVec3D-like array object.""" class IVec3DBatch(BaseBatch[IVec3DArrayLike]): _ARROW_DATATYPE = pa.list_(pa.field("item", pa.int32(), nullable=False, metadata={}), 3) @staticmethod def _native_to_pa_array(data: IVec3DArrayLike, data_type: pa.DataType) -> pa.Array: return IVec3DExt.native_to_pa_array_override(data, data_type)