MCPcopy Index your code
hub / github.com/python/cpython / ArgumentParser

Class ArgumentParser

Lib/argparse.py:1919–2899  ·  view source on GitHub ↗

Object for parsing command line strings into Python objects. Keyword Arguments: - prog -- The name of the program (default: ``os.path.basename(sys.argv[0])``) - usage -- A usage message (default: auto-generated from arguments) - description -- A description o

Source from the content-addressed store, hash-verified

1917
1918
1919class ArgumentParser(_AttributeHolder, _ActionsContainer):
1920 """Object for parsing command line strings into Python objects.
1921
1922 Keyword Arguments:
1923 - prog -- The name of the program (default:
1924 ``os.path.basename(sys.argv[0])``)
1925 - usage -- A usage message (default: auto-generated from arguments)
1926 - description -- A description of what the program does
1927 - epilog -- Text following the argument descriptions
1928 - parents -- Parsers whose arguments should be copied into this one
1929 - formatter_class -- HelpFormatter class for printing help messages
1930 - prefix_chars -- Characters that prefix optional arguments
1931 - fromfile_prefix_chars -- Characters that prefix files containing
1932 additional arguments
1933 - argument_default -- The default value for all arguments
1934 - conflict_handler -- String indicating how to handle conflicts
1935 - add_help -- Add a -h/-help option
1936 - allow_abbrev -- Allow long options to be abbreviated unambiguously
1937 - exit_on_error -- Determines whether or not ArgumentParser exits with
1938 error info when an error occurs
1939 - suggest_on_error - Enables suggestions for mistyped argument choices
1940 and subparser names (default: ``True``)
1941 - color - Allow color output in help messages (default: ``False``)
1942 """
1943
1944 def __init__(self,
1945 prog=None,
1946 usage=None,
1947 description=None,
1948 epilog=None,
1949 parents=[],
1950 formatter_class=HelpFormatter,
1951 prefix_chars='-',
1952 fromfile_prefix_chars=None,
1953 argument_default=None,
1954 conflict_handler='error',
1955 add_help=True,
1956 allow_abbrev=True,
1957 exit_on_error=True,
1958 *,
1959 suggest_on_error=True,
1960 color=True,
1961 ):
1962 superinit = super(ArgumentParser, self).__init__
1963 superinit(description=description,
1964 prefix_chars=prefix_chars,
1965 argument_default=argument_default,
1966 conflict_handler=conflict_handler)
1967
1968 self.prog = _prog_name(prog)
1969 self.usage = usage
1970 self.epilog = epilog
1971 self.formatter_class = formatter_class
1972 self.fromfile_prefix_chars = fromfile_prefix_chars
1973 self.add_help = add_help
1974 self.allow_abbrev = allow_abbrev
1975 self.exit_on_error = exit_on_error
1976 self.suggest_on_error = suggest_on_error

Callers 7

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
_parse_argsFunction · 0.90
mainFunction · 0.90
asdl_c.pyFile · 0.90
_cli_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…