Skip to content

pixano.features.schemas.entities.entity

Entity(created_at=None, updated_at=None, **data)

Bases: BaseSchema

Entity base class.

Entities are used to define an entity in a dataset such as an object, a track. It can refer to an item, a view, and a parent entity.

Attributes:

Name Type Description
item_ref ItemRef

Reference to the entity's item.

view_ref ViewRef

Reference to the entity's view.

parent_ref EntityRef

Reference to the entity's parent entity.

Source code in pixano/features/schemas/base_schema.py
def __init__(self, /, created_at: datetime | None = None, updated_at: datetime | None = None, **data: Any):
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.

    Args:
        created_at: The creation date of the object.
        updated_at: The last modification date of the object.
        data: The data of the object validated by Pydantic.
    """
    created_at, updated_at = validate_and_init_create_at_and_update_at(created_at, updated_at)
    data.update({"created_at": created_at, "updated_at": updated_at})
    super().__init__(**data)

item property

Get the entity's item.

parent property

Get the entity's parent entity.

view property

Get the entity's view.

is_entity(cls, strict=False)

Check if a class is an Entity or subclass of Entity.

Source code in pixano/features/schemas/entities/entity.py
def is_entity(cls: type, strict: bool = False) -> bool:
    """Check if a class is an Entity or subclass of Entity."""
    return issubclass_strict(cls, Entity, strict)