misc

misc#

Miscellaneous Tools

Functions

chdir(newdir)

Change current directory, used as a context manager, i.e.:

check_mandatory_keys(data_dict, mandatory_keys)

Check all mandatory argument in a dictionary.

compare(a, b, operation)

Compare two objects using a specific operation.

compare_version(lib, version_to_check, operator)

Compare the version of a librarie to a reference, giving the operator.

find_by_key(data, target)

Find a value by key in a dictionary.

get_function_name()

Get the name of the function where this one is launched.

in_docker()

Check if the session is running inside a docker

list_to_dict(dict_list)

Return a dictionary from a list [key, value, key_2, value_2...]

nested_set(dic, keys, value)

Set value in nested directory:

prune_dict(dict_to_prune, keys_to_prune)

Prune keys from a dictionary.

remove_empty_values(object_with_empty_values)

Remove empty values from list.

run_cli(cmd[, timeout, check_return_value, ...])

Run a command line.

select_dict(dict_to_select, keys_to_select)

Select keys from a dictionary.

unique(sequence)

Keep only unique values from a list (any Iterable should work).

Classes

ListEnum(value)

List Enum (enum with function listing names and values)