actio_python_utils.argparse_functions

Code for argparse-related functionality.

Functions

dir_exists(dirn)

Returns the real path to directory dirn if it exists

file_exists(fn)

Returns the real path to file fn if it exists

key_value_pair(arg[, sep])

Splits a string once on sep and returns the result

str_from_file(fn)

Returns the text from a file name

Classes

CustomFormatter(prog[, indent_increment, ...])

argparse.HelpFormatter that displays argument defaults and doesn't change formatting of the description

EnhancedArgumentParser(*args[, description, ...])

Customized argparse.ArgumentParser that sets description automatically, uses both argparse.ArgumentDefaultsHelpFormatter and argparse.RawTextHelpFormatter formatters, optionally sets up logging, database, and PySpark connections.

ZFileType([mode, bufsize, encoding, errors])

argparse.FileType that opens specified argument using zopen()