Skip to content

pixano.features.schemas.entities.track

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

Bases: Entity

A Track entity.

A track represents an entity that is shared among multiple view across time.

Attributes:

Name Type Description
name str

The name of the track.

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_track(name, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), parent_ref=EntityRef.none())

Create a Track instance.

Parameters:

Name Type Description Default
name str

The name of the track.

required
id str

Track ID.

''
item_ref ItemRef

Item reference.

none()
view_ref ViewRef

View reference.

none()
parent_ref EntityRef

Entity reference.

none()

Returns:

Type Description
Track

The created Track instance.

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

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

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

is_track(cls, strict=False)

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

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