Skip to content

pixano.features.schemas.entities.multi_modal_entity

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

Bases: NamedEntity

A multimedia entity.

A MultiModalEntity represents an entity that is shared among multiple view of different type : image + text.

Attributes:

Name Type Description
name str

The name of the 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)

create_multi_modal_entity(name, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), parent_ref=EntityRef.none())

Create a MultiModalEntity instance.

Parameters:

Name Type Description Default
name str

The name of the multimedia_entity.

required
id str

MultiModalEntity ID.

''
item_ref ItemRef

Item reference.

none()
view_ref ViewRef

View reference.

none()
parent_ref EntityRef

Entity reference.

none()

Returns:

Type Description
MultiModalEntity

The created MultiModalEntity instance.

Source code in pixano/features/schemas/entities/multi_modal_entity.py
def create_multi_modal_entity(
    name: str,
    id: str = "",
    item_ref: ItemRef = ItemRef.none(),
    view_ref: ViewRef = ViewRef.none(),
    parent_ref: EntityRef = EntityRef.none(),
) -> MultiModalEntity:
    """Create a `MultiModalEntity` instance.

    Args:
        name: The name of the multimedia_entity.
        id: MultiModalEntity ID.
        item_ref: Item reference.
        view_ref: View reference.
        parent_ref: Entity reference.

    Returns:
        The created `MultiModalEntity` instance.
    """
    return MultiModalEntity(
        id=id,
        item_ref=item_ref,
        view_ref=view_ref,
        parent_ref=parent_ref,
        name=name,
    )

is_multi_modal_entity(cls, strict=False)

Check if the given class is a MultiModalEntity or a subclass of MultiModalEntity.

Source code in pixano/features/schemas/entities/multi_modal_entity.py
def is_multi_modal_entity(cls: type, strict: bool = False) -> bool:
    """Check if the given class is a `MultiModalEntity` or a subclass of `MultiModalEntity`."""
    return issubclass_strict(cls, MultiModalEntity, strict)