utilities#

Various utilities that do not have a specific category

class CancelableProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=())[source]#

Bases: ProcessPoolExecutor

immediate_shutdown()[source]#
class FilePath(base, prefix=None, postfix=None, extension=None)[source]#

Bases: object

backup_file(file_path)[source]#
check_enough_temp_space(min_temp_space=200)[source]#
colorize(msg, color)[source]#
get_free_temp_space()[source]#
get_free_v_ram()[source]#
get_item_recursive(container, keys)[source]#
get_percent_v_ram_use()[source]#
gpu_params(dest_file_path)[source]#
gpu_util()[source]#
handle_deprecated_args(deprecated_args_map)[source]#

Decorator to handle deprecated arguments by renaming them. It takes a dictionary and renames old arguments to new ones.

Parameters:

deprecated_args_map (dict) – Dictionary mapping old argument names to new ones.

Returns

is_in_range(src_array, value_range)[source]#
is_iterable(obj)[source]#
make_abs(directory, file_name)[source]#

Make file_name absolute if it is not

requires_files(file_paths)[source]#
runs_on_pycharm()[source]#
runs_on_spyder()[source]#
runs_on_ui()[source]#
set_item_recursive(dictionary, keys_list, val, fix_missing_keys=True)[source]#
smi_query(var_name, units=False)[source]#
substitute_deprecated_arg(old_arg, new_arg, old_arg_name, new_arg_name)[source]#
title_to_snake(string)[source]#
validate_arg(arg_name, value, valid_values)[source]#

Check if the value is in the list of valid values and raise a ValueError if not.

Parameters:
  • arg_name

  • value

  • valid_values

Returns

value if it is in the list of valid values, otherwise raises a ValueError