project module

datumaro.cli.util.project.load_project(project_dir, readonly=False)[source]
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: Optional[datumaro.components.environment.Environment] = None) datumaro.components.dataset.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: Optional[datumaro.components.project.Project] = None) Tuple[datumaro.components.dataset.Dataset, datumaro.components.project.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: Optional[datumaro.components.project.Project] = None) Tuple[datumaro.components.dataset.Dataset, Optional[datumaro.components.project.Project]][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)