action_updater.utils package

Submodules

action_updater.utils.fileio module

action_updater.utils.fileio.copyfile(source, destination, force=True)[source]

Copy a file from a source to its destination.

action_updater.utils.fileio.get_tmpdir(tmpdir=None, prefix='', create=True)[source]

Get a temporary directory for an operation.

action_updater.utils.fileio.get_tmpfile(tmpdir=None, prefix='')[source]

Get a temporary file with an optional prefix.

action_updater.utils.fileio.get_yaml_string(obj)[source]

Get yaml output as string

action_updater.utils.fileio.mkdir_p(path)[source]

Make a directory path if it does not exist, akin to mkdir -p

action_updater.utils.fileio.mkdirp(dirnames)[source]

Create one or more directories

action_updater.utils.fileio.print_json(json_obj)[source]

Print json pretty

action_updater.utils.fileio.read_file(filename, mode='r')[source]

Read a file.

action_updater.utils.fileio.read_json(filename, mode='r')[source]

Read a json file to a dictionary.

action_updater.utils.fileio.read_yaml(filename)[source]

Load a yaml from file, roundtrip to preserve comments

action_updater.utils.fileio.recursive_find(base, pattern=None)[source]

Find filenames that match a particular pattern, and yield them.

action_updater.utils.fileio.write_file(filename, content, mode='w', exec=False)[source]

Write content to a filename

action_updater.utils.fileio.write_json(json_obj, filename, mode='w')[source]

Write json to a filename

action_updater.utils.fileio.write_yaml(obj, filename, line_length=None)[source]

Save yaml to file, also preserving comments.

action_updater.utils.terminal module

action_updater.utils.terminal.confirm_action(question, force=False)[source]

confirm if the user wants to perform a certain action

Parameters

question: the question that will be asked force: if the user wants to skip the prompt

action_updater.utils.terminal.get_installdir()[source]

get the installation directory of the application

action_updater.utils.terminal.run_command(cmd, sudo=False, stream=False)[source]

run_command uses subprocess to send a command to the terminal.

Parameters

cmd: the command to send, should be a list for subprocess error_message: the error message to give to user if fails, if none specified, will alert that command failed.

Module contents