# 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/components/entry_kind.def.rs". # You can extend this class by creating a "EntryKindExt" class in "entry_kind_ext.py". from __future__ import annotations from collections.abc import Sequence from typing import Literal import pyarrow as pa from .._baseclasses import ( BaseBatch, ComponentBatchMixin, ) __all__ = ["EntryKind", "EntryKindArrayLike", "EntryKindBatch", "EntryKindLike"] from enum import Enum class EntryKind(Enum): """ **Component**: The kind of a catalog entry. The values match those of `rerun.cloud.v1alpha1.EntryKind`. ⚠️ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.** """ Dataset = 1 """A dataset.""" DatasetView = 2 """A view over a dataset.""" Table = 3 """A table.""" TableView = 4 """A view over a table.""" BlueprintDataset = 5 """A dataset holding the blueprints of another entry.""" AssetDataset = 6 """A dataset holding the static assets shared by the segments of another dataset.""" @classmethod def auto(cls, val: str | int | EntryKind) -> EntryKind: """Best-effort converter, including a case-insensitive string matcher.""" if isinstance(val, EntryKind): return val if isinstance(val, int): return cls(val) try: return cls[val] except KeyError: val_lower = val.lower() for variant in cls: if variant.name.lower() == val_lower: return variant raise ValueError(f"Cannot convert {val} to {cls.__name__}") def __str__(self) -> str: """Returns the variant name.""" return self.name EntryKindLike = ( EntryKind | Literal[ "AssetDataset", "BlueprintDataset", "Dataset", "DatasetView", "Table", "TableView", "assetdataset", "blueprintdataset", "dataset", "datasetview", "table", "tableview", ] | int ) """A type alias for any EntryKind-like object.""" EntryKindArrayLike = ( EntryKind | Literal[ "AssetDataset", "BlueprintDataset", "Dataset", "DatasetView", "Table", "TableView", "assetdataset", "blueprintdataset", "dataset", "datasetview", "table", "tableview", ] | int | Sequence[EntryKindLike] ) """A type alias for any EntryKind-like array object.""" class EntryKindBatch(BaseBatch[EntryKindArrayLike], ComponentBatchMixin): _ARROW_DATATYPE = pa.uint8() _COMPONENT_TYPE: str = "rerun.components.EntryKind" @staticmethod def _native_to_pa_array(data: EntryKindArrayLike, data_type: pa.DataType) -> pa.Array: items: Sequence[EntryKindLike | str] = [data] if isinstance(data, (EntryKind, int, str)) else data pa_data = [EntryKind.auto(v).value if v is not None else None for v in items] # type: ignore[redundant-expr] return pa.array(pa_data, type=data_type)