datumaro.cli.util.project#

Functions

generate_next_file_name(basename[, basedir, ...])

If basedir does not contain basename, returns basename, otherwise generates a name by appending sep to the basename and the number, next to the last used number in the basedir for files with basename prefix.

load_project(project_dir[, readonly])

load a Project.

parse_dataset_pathspec(s[, env])

Parses Dataset paths. The syntax is:

parse_full_revpath(s[, ctx_project])

revpath - either a Dataset path or a Revision path.

parse_revspec(s[, ctx_project])

Parses Revision paths. The syntax is:

split_local_revpath(revpath)

Splits the given string into revpath components.

Classes

FilterModes(value)

An enumeration.

datumaro.cli.util.project.load_project(project_dir, readonly=False)[source]#

load a Project.

datumaro.cli.util.project.generate_next_file_name(basename, basedir='.', sep='.', ext='')[source]#

If basedir does not contain basename, returns basename, otherwise generates a name by appending sep to the basename and the number, next to the last used number in the basedir for files with basename prefix. Optionally, appends ext.

datumaro.cli.util.project.parse_dataset_pathspec(s: str, env: Environment | None = None) Dataset[source]#
Parses Dataset paths. The syntax is:
  • <dataset path>[ :<format> ]

Returns: a dataset from the parsed path

datumaro.cli.util.project.parse_revspec(s: str, ctx_project: Project | None = None) Tuple[Dataset, Project][source]#
Parses Revision paths. The syntax is:
  • <project path> [ @<rev> ] [ :<target> ]

  • <rev> [ :<target> ]

  • <target>

The second and the third forms assume an existing “current” project.

Returns: the dataset and the project from the parsed path.

The project is only returned when specified in the revpath.

datumaro.cli.util.project.parse_full_revpath(s: str, ctx_project: Project | None = None) Tuple[Dataset, Project | None][source]#

revpath - either a Dataset path or a Revision path.

Returns: the dataset and the project from the parsed path

The project is only returned when specified in the revpath.

datumaro.cli.util.project.split_local_revpath(revpath: str) Tuple[Revision, str][source]#

Splits the given string into revpath components.

A local revpath is a path to a revision withing the current project. The syntax is:

  • [ <revision> : ] [ <target> ]

At least one part must be present.

Returns: (revision, build target)

class datumaro.cli.util.project.FilterModes(value)[source]#

Bases: Enum

An enumeration.

items = 1#
annotations = 2#
items_annotations = 3#
i = 1#
a = 2#
i_a = 3#
a_i = 3#
annotations_items = 3#
static parse(s)[source]#
classmethod make_filter_args(mode)[source]#
classmethod list_options()[source]#