tunel.utils package
Submodules
tunel.utils.fileio module
- tunel.utils.fileio.copyfile(source, destination, force=True)[source]
Copy a file from a source to its destination.
- tunel.utils.fileio.get_file_hash(image_path, algorithm='sha256')[source]
Return an sha256 hash of the file based on a criteria level.
- tunel.utils.fileio.get_tmpdir(tmpdir=None, prefix='', create=True)[source]
Get a temporary directory for an operation.
- tunel.utils.fileio.get_tmpfile(tmpdir=None, prefix='')[source]
Get a temporary file with an optional prefix.
- tunel.utils.fileio.mkdir_p(path)[source]
mkdir_p attempts to get the same functionality as mkdir -p :param path: the path to create.
- tunel.utils.fileio.read_config_file(filename, sep='=')[source]
Given a config file with format KEY = VALUE, parse into dict
tunel.utils.generate module
tunel.utils.terminal module
- tunel.utils.terminal.check_install(software, quiet=True, command='--version')[source]
check_install will attempt to run the singularity command, and return True if installed. The command line utils will not run without this check.
- Parameters:
software (the software to check if installed) –
quiet (should we be quiet? (default True)) –
command (the command to use to check (defaults to --version)) –
- tunel.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) –
- tunel.utils.terminal.confirm_uninstall(filename, force=False)[source]
confirm if the user wants to uninstall a module
- Parameters:
filename (the file that will be removed) –
force (if the user wants to skip the prompt) –
- tunel.utils.terminal.get_installdir()[source]
get_installdir returns the installation directory of the application
- tunel.utils.terminal.run_command(cmd, stream=False, quiet=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,) –
failed. (if none specified, will alert that command) –