Shortcuts

mmengine.utils

Manager

ManagerMeta

The metaclass for global accessible class.

ManagerMixin

ManagerMixin is the base class for classes that have global access requirements.

Path

check_file_exist

fopen

is_abs

Check if path is an absolute path in different backends.

is_filepath

mkdir_or_exist

scandir

Scan a directory to find the interested files.

symlink

Package

call_command

install_package

get_installed_path

Get installed path of package.

is_installed

Check package whether installed.

Version

digit_version

Convert a version string into a tuple of integers.

get_git_hash

Get the git hash of the current repo.

Progress Bar

ProgressBar

A progress bar which can print the progress.

track_iter_progress

Track the progress of tasks iteration or enumeration with a progress bar.

track_parallel_progress

Track the progress of parallel task execution with a progress bar.

track_progress

Track the progress of tasks execution with a progress bar.

Miscellaneous

Timer

A flexible Timer class.

TimerError

is_list_of

Check whether it is a list of some type.

is_tuple_of

Check whether it is a tuple of some type.

is_seq_of

Check whether it is a sequence of some type.

is_str

Whether the input is an string instance.

iter_cast

Cast elements of an iterable object into some type.

list_cast

Cast elements of an iterable object into a list of some type.

tuple_cast

Cast elements of an iterable object into a tuple of some type.

concat_list

Concatenate a list of list into a single list.

slice_list

Slice a list into several sub lists by a list of given length.

to_1tuple

to_2tuple

to_3tuple

to_4tuple

to_ntuple

check_prerequisites

A decorator factory to check if prerequisites are satisfied.

deprecated_api_warning

A decorator to check if some arguments are deprecate and try to replace deprecate src_arg_name to dst_arg_name.

deprecated_function

Marks functions as deprecated.

has_method

Check whether the object has a method.

is_method_overridden

Check if a method of base class is overridden in derived class.

import_modules_from_strings

Import modules from the given list of strings.

requires_executable

A decorator to check if some executable files are installed.

requires_package

A decorator to check if some python packages are installed.

check_time

Add check points in a single line.

apply_to

Apply function to each element in dict, list or tuple that matches with the expression.