invirtualenv.utility module¶
General utility functionality module
-
invirtualenv.utility.
change_uid_gid
(user_uid=None, user_gid=None)¶ preexec_fn to change the uid/gid when using subprocess
Parameters:
-
invirtualenv.utility.
chown_recursive
(path, uid, gid)¶ Change the ownership of all files and directories in path
Parameters:
-
invirtualenv.utility.
csv_list
(value)¶ Convert a comma separated string into a list
Parameters: value (str) – The string object to convert to a list Returns: A list based on splitting the string on the ‘,’ character Return type: list
-
invirtualenv.utility.
display_header
(text='', width=None, separator=None, outfile=None, collapse=False)¶ Display a textual header message. :param text: The text to print/display :type text: str :param width: The width (text wrap) of the header message.
This will be the current terminal width as determined by the ‘stty size’ shell command if not specified.Parameters: - separator (str, optional) – The character or string to use as a horizontal separator. Will use ‘=’ if one is not specified.
- outfile (File, optional) – The File object to print the header text to. This will use sys.stdout if not specified.
:param : :type : return:
-
invirtualenv.utility.
get_terminal_size
()¶ Get the terminal rows and columns if we are running on an interactive terminal. :returns: * rows (int) – The number of rows on the current terminal.
- columns (int) – The number of columns on the current terminal.
-
invirtualenv.utility.
str_format_env
(value)¶ Substitute values with environment variables in a string
Parameters: value (str) – The string object to be formatted and converted into a list Returns: With env variable values substituded Return type: str
-
invirtualenv.utility.
str_to_bool
(value)¶ Convert a string too a bool object
Parameters: value (str) – The string object to convert to a bool. The following case insensitive strings evaluate to True [‘true’, 1’, ‘up’, ‘on’] Returns: Boolean based on the string Return type: bool
-
invirtualenv.utility.
str_to_dict
(value)¶ Convert a newline terminated string of key=value into a dictionary.
Parameters: value (str) – The string object to convert to a dictionary Returns: Dictionary based on the string Return type: dict
-
invirtualenv.utility.
str_to_list
(value)¶ Convert a newline terminated string into a list. Any empty lines will be removed from the result list.
Parameters: value (str) – The string object to convert to a list Returns: List based on the string Return type: list
-
invirtualenv.utility.
update_recursive
(basedict, updatedict)¶ Recursively run update on a dictionary
Parameters: Returns: basedict updated to contain the values from updatedict
Return type:
-
invirtualenv.utility.
update_recursive_generator
(basedict, updatedict)¶ Recursively run update on a dictionary
Parameters: Returns: basedict updated to contain the values from updatedict
Return type: