This Page

The quantum.common.utils Module

Utilities and helper functions.

quantum.common.utils.compare_elements(a, b)

compare elements if a and b have same elements

This method doesn’t consider ordering

quantum.common.utils.dict2str(dic)
quantum.common.utils.diff_list_of_dict(old_list, new_list)
quantum.common.utils.find_config_file(options, config_file)

Return the first config file found.

We search for the paste config file in the following order: * If –config-file option is used, use that * Search for the configuration files via common cfg directories :retval Full path to config file, or None if no config file found

quantum.common.utils.get_hostname()
quantum.common.utils.is_extension_supported(plugin, ext_alias)
quantum.common.utils.log_opt_values(log)
quantum.common.utils.parse_mappings(mapping_list, unique_values=True)

Parse a list of of mapping strings into a dictionary.

Parameters:
  • mapping_list – a list of strings of the form ‘<key>:<value>’
  • unique_values – values must be unique if True
Returns:

a dict mapping keys to values

quantum.common.utils.read_cached_file(filename, cache_info, reload_func=None)

Read from a file if it has been modified.

Parameters:
  • cache_info – dictionary to hold opaque cache.
  • reload_func – optional function to be called with data when file is reloaded due to a modification.
Returns:

data from file

quantum.common.utils.str2dict(string)
quantum.common.utils.subprocess_popen(args, stdin=None, stdout=None, stderr=None, shell=False, env=None)