datumaro.cli.commands.stats#

Functions

build_parser([parser_ctor])

get_sensitive_args()

stats_command(args)

datumaro.cli.commands.stats.build_parser(parser_ctor=<class 'argparse.ArgumentParser'>)[source]#
datumaro.cli.commands.stats.get_sensitive_args()[source]#
exception datumaro.cli.commands.stats.CliException[source]#

Bases: DatumaroError

exception datumaro.cli.commands.stats.ConflictingCategoriesError(msg=None, *, sources=None)[source]#

Bases: DatasetMergeError

sources#
class datumaro.cli.commands.stats.MultilineFormatter(keep_natural=False, **kwargs)[source]#

Bases: HelpFormatter

Keeps line breaks introduced with ‘|n’ separator and spaces introduced with ‘|s’, also removes the ‘code-block’ directives.

exception datumaro.cli.commands.stats.ProjectNotFoundError(path)[source]#

Bases: DatumaroError

Method generated by attrs for class ProjectNotFoundError.

path#
exception datumaro.cli.commands.stats.WrongRevpathError(problems)[source]#

Bases: CliException

Method generated by attrs for class WrongRevpathError.

datumaro.cli.commands.stats.compute_ann_statistics(dataset: IDataset)[source]#
datumaro.cli.commands.stats.compute_image_statistics(dataset: IDataset)[source]#
datumaro.cli.commands.stats.dump_json_file(path: str, data: Any, *, sort_keys: bool = False, allow_numpy: bool = True, indent: bool = False, append_newline: bool = False) None[source]#
datumaro.cli.commands.stats.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.commands.stats.load_project(project_dir, readonly=False)[source]#

load a Project.

datumaro.cli.commands.stats.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.commands.stats.scope_add(cm: ContextManager[T]) T[source]#
datumaro.cli.commands.stats.scoped(func, arg_name=None)[source]#

A function decorator, which allows to do actions with the current scope, such as registering error and exit callbacks and context managers.

datumaro.cli.commands.stats.stats_command(args)[source]#
datumaro.cli.commands.stats.str_to_bool(val)#

Convert “boolean” strings (e.g., from env. vars.) to real booleans.

Values mapping to True:

  • True

  • "true" / "t"

  • "yes" / "y"

  • "on"

  • "1"

  • 1

Values mapping to False:

  • False

  • "false" / "f"

  • "no" / "n"

  • "off"

  • "0"

  • 0

Raises:

ValueError – for any other value.

New in version 21.3.0.