selinon.helpers module¶
Selinon library helpers.
-
selinon.helpers.
check_conf_keys
(dict_, known_conf_opts)[source]¶ Check supplied configuration options against known configuration options.
Parameters: - dict – dict with configuration options
- known_conf_opts – known configuration options
Returns: configuration options that are now known with their values
-
selinon.helpers.
dict2json
(dict_, pretty=True, safe=True)[source]¶ Convert dict to json (string).
Parameters: Returns: formatted dict in json
Return type:
-
selinon.helpers.
dict2strkwargs
(dict_)[source]¶ Convert a dictionary into arguments to a string representation that can be used as arguments to a function.
-
selinon.helpers.
get_function_arguments
(func)[source]¶ Get arguments of function.
Parameters: func – function to parse arguments Returns: list of arguments that predicate function expects
-
selinon.helpers.
git_previous_version
(file_path)[source]¶ Get hash of previous version of a file in Git CVS.
Parameters: file_path – a path to file to get previous version from Returns: git hash of previous version and it’s depth from master Return type: tuple
-
selinon.helpers.
git_previous_version_file
(git_hash, file_path, tmp_dir=None)[source]¶ Get previous version of a file in Git CVS.
Parameters: - git_hash – git hash for the given file
- file_path – a path to file to get previous version from
- tmp_dir – a directory to store the content of previous file version
Returns: a path to a temporary file with content from previous version