Skip to content

pixano.features.schemas.annotations.annotation

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

Bases: BaseSchema

Annotations are used to annotate an entity in a dataset.

It can refer to an entity, an item, and a view.

Attributes:

Name Type Description
item_ref ItemRef

Reference to the annotation's item.

view_ref ViewRef

Reference to the annotation's view.

entity_ref EntityRef

Reference to the annotation's entity.

source_ref SourceRef

Reference to the annotation's source.

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)

entity property

Get the annotation's entity.

item property

Get the annotation's item.

view property

Get the annotation's view.

is_annotation(cls, strict=False)

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

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