Top

geodata.ArgumentParserNoExit module

Command argument parser that throws exception rather than exitting

Classes

class ArgumentParserError

Common base class for all non-exit exceptions.

Ancestors (in MRO)

Class variables

var args

class ArgumentParserNoExit

Object for parsing command line strings into Python objects.

Keyword Arguments: - prog -- The name of the program (default: sys.argv[0]) - usage -- A usage message (default: auto-generated from arguments) - description -- A description of what the program does - epilog -- Text following the argument descriptions - parents -- Parsers whose arguments should be copied into this one - formatter_class -- HelpFormatter class for printing help messages - prefix_chars -- Characters that prefix optional arguments - fromfile_prefix_chars -- Characters that prefix files containing additional arguments - argument_default -- The default value for all arguments - conflict_handler -- String indicating how to handle conflicts - add_help -- Add a -h/-help option - allow_abbrev -- Allow long options to be abbreviated unambiguously

Ancestors (in MRO)

  • ArgumentParserNoExit
  • argparse.ArgumentParser
  • argparse._AttributeHolder
  • argparse._ActionsContainer
  • builtins.object

Static methods

def __init__(

self, prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True)

Initialize self. See help(type(self)) for accurate signature.

def add_argument(

self, *args, **kwargs)

add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...)

def add_argument_group(

self, *args, **kwargs)

def add_mutually_exclusive_group(

self, **kwargs)

def add_subparsers(

self, **kwargs)

def convert_arg_line_to_args(

self, arg_line)

def error(

self, message)

error(message: string)

Prints a usage message incorporating the message to stderr and exits.

If you override this in a subclass, it should not return -- it should either exit or raise an exception.

def exit(

self, status=0, message=None)

def format_help(

self)

def format_usage(

self)

def get_default(

self, dest)

def parse_args(

self, args=None, namespace=None)

def parse_known_args(

self, args=None, namespace=None)

def print_help(

self, file=None)

def print_usage(

self, file=None)

def register(

self, registry_name, value, object)

def set_defaults(

self, **kwargs)