lib5c.util.system module

Module containing utility functions to assist in system-specific compatibility.

lib5c.util.system.check_outdir(outfile)[source]

Makes sure the directories needed to write an output file exist.

Parameters

outfile (str) – Path to a hypothetical output file to be written to the disk.

lib5c.util.system.shell_quote(string)[source]

Quote a string with the correct quotes (double quotes on Windows and single quotes otherwise) to prevent the shell from eating the quotes.

Useful for when assembling command line strings with arguments that must be quoted.

Parameters

string (str) – The string to quote.

Returns

The appropriately-quoted version of the input string.

Return type

str

lib5c.util.system.splitall(path)[source]

Recursively splits a path into a list of all its parts.

https://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ ch04s16.html

Parameters

path (str) – A path to split.

Returns

The parts of the path.

Return type

List[str]