Layout, File, and Tag¶
Model classes to represent layouts, files, and tags.
- class Layout[source]¶
Bases:
Component
Represents a structured layout of files in a directory.
- id: Mapped[int]¶
- url: Mapped[str]¶
- specification: Mapped[Specification]¶
- root: Mapped[str]¶
- specification_name: Mapped[str]¶
- add(*files: List[File])[source]¶
Adds files to the layout, ensuring they fall within the layout’s directory scope.
- Parameters:
files (File) – One or more File objects to be added to the layout.
- Raises:
ValueError – If any file is outside the layout’s root directory.
- index(root=None, metadata=False, valid_only=True, skip=None, reset=False, **funcs)[source]¶
Perform indexing to add files in root to index.
- classmethod get(**filters) Base | None ¶
Return an instance from index if found, else None.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
An instance of cls or None if not found.
- classmethod get_identifiers(**kwargs) Dict[str, Any] ¶
Return dictionary of class identifier attributes and their values.
- Parameters:
kwargs (key, value pairs) – Key-value pairs of identifier attributes and their values.
- Return type:
A dictionary of the identifiers with their respective values.
- classmethod options(**filters) List[Base] ¶
Return all existing instances from index.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
A list of instances of cls that match the filters.
- type: Mapped[str]¶
- class File[source]¶
Bases:
Base
Generic file representation.
- id: Mapped[int]¶
- root: Mapped[str]¶
- tags: AssociationProxy[Dict[str, str]] = ColumnAssociationProxyInstance(AssociationProxy('_tags', 'value'))¶
- path: Mapped[str]¶
- property attached¶
- property rel_path¶
- index(metadata=False, reset=False, **funcs)[source]¶
Perform indexing to add tags marking the file to index.
- classmethod get(**filters) Base | None ¶
Return an instance from index if found, else None.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
An instance of cls or None if not found.
- classmethod get_identifiers(**kwargs) Dict[str, Any] ¶
Return dictionary of class identifier attributes and their values.
- Parameters:
kwargs (key, value pairs) – Key-value pairs of identifier attributes and their values.
- Return type:
A dictionary of the identifiers with their respective values.
- classmethod options(**filters) List[Base] ¶
Return all existing instances from index.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
A list of instances of cls that match the filters.
- class Tag[source]¶
Bases:
Base
Generic tag representation.
- id: Mapped[int]¶
- name: Mapped[str]¶
- value: Mapped[str]¶
- classmethod get(**filters) Base | None ¶
Return an instance from index if found, else None.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
An instance of cls or None if not found.
- classmethod get_identifiers(**kwargs) Dict[str, Any] ¶
Return dictionary of class identifier attributes and their values.
- Parameters:
kwargs (key, value pairs) – Key-value pairs of identifier attributes and their values.
- Return type:
A dictionary of the identifiers with their respective values.
- classmethod options(**filters) List[Base] ¶
Return all existing instances from index.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
A list of instances of cls that match the filters.
- class Marking[source]¶
Bases:
Base
Representation of an association between a file and a tag.
- file_id: Mapped[int]¶
- classmethod get(**filters) Base | None ¶
Return an instance from index if found, else None.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
An instance of cls or None if not found.
- classmethod get_identifiers(**kwargs) Dict[str, Any] ¶
Return dictionary of class identifier attributes and their values.
- Parameters:
kwargs (key, value pairs) – Key-value pairs of identifier attributes and their values.
- Return type:
A dictionary of the identifiers with their respective values.
- classmethod options(**filters) List[Base] ¶
Return all existing instances from index.
- Parameters:
filters (dict) – Dictionary of filter conditions used for querying.
- Return type:
A list of instances of cls that match the filters.
- tag_id: Mapped[int]¶
- name: Mapped[str]¶