Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
robotics
embodied-ai
human-demonstration
egocentric-video
bimanual-manipulation
tactile-sensing
License:
File size: 2,072 Bytes
9ff4bea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # 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/blob.def.rs".
# You can extend this class by creating a "BlobExt" class in "blob_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_uint8,
)
from .._numpy_compatibility import asarray
from .blob_ext import BlobExt
__all__ = ["Blob", "BlobArrayLike", "BlobBatch", "BlobLike"]
@define(init=False)
class Blob(BlobExt):
"""**Encoding**: A binary blob of data."""
def __init__(self: Any, data: BlobLike) -> None:
"""Create a new instance of the Blob encoding."""
# You can define your own __init__ function as a member of BlobExt in blob_ext.py
self.__attrs_init__(data=data)
data: npt.NDArray[np.uint8] = field(converter=to_np_uint8)
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 BlobExt in blob_ext.py
return asarray(self.data, dtype=dtype, copy=copy)
def __len__(self) -> int:
# You can define your own __len__ function as a member of BlobExt in blob_ext.py
return len(self.data)
if TYPE_CHECKING:
BlobLike = Blob | bytes | npt.NDArray[np.uint8]
"""A type alias for any Blob-like object."""
else:
BlobLike = Any
BlobArrayLike = Blob | Sequence[BlobLike] | bytes | npt.NDArray[np.uint8]
"""A type alias for any Blob-like array object."""
class BlobBatch(BaseBatch[BlobArrayLike]):
_ARROW_DATATYPE = pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={}))
@staticmethod
def _native_to_pa_array(data: BlobArrayLike, data_type: pa.DataType) -> pa.Array:
return BlobExt.native_to_pa_array_override(data, data_type)
|