MCPcopy Create free account
hub / github.com/apache/madlib / ArgumentParser

Class ArgumentParser

src/madpack/argparse.py:1545–2370  ·  view source on GitHub ↗

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 -

Source from the content-addressed store, hash-verified

1543
1544
1545class ArgumentParser(_AttributeHolder, _ActionsContainer):
1546 """Object for parsing command line strings into Python objects.
1547
1548 Keyword Arguments:
1549 - prog -- The name of the program (default: sys.argv[0])
1550 - usage -- A usage message (default: auto-generated from arguments)
1551 - description -- A description of what the program does
1552 - epilog -- Text following the argument descriptions
1553 - parents -- Parsers whose arguments should be copied into this one
1554 - formatter_class -- HelpFormatter class for printing help messages
1555 - prefix_chars -- Characters that prefix optional arguments
1556 - fromfile_prefix_chars -- Characters that prefix files containing
1557 additional arguments
1558 - argument_default -- The default value for all arguments
1559 - conflict_handler -- String indicating how to handle conflicts
1560 - add_help -- Add a -h/-help option
1561 """
1562
1563 def __init__(self,
1564 prog=None,
1565 usage=None,
1566 description=None,
1567 epilog=None,
1568 version=None,
1569 parents=[],
1570 formatter_class=HelpFormatter,
1571 prefix_chars='-',
1572 fromfile_prefix_chars=None,
1573 argument_default=None,
1574 conflict_handler='error',
1575 add_help=True):
1576
1577 if version is not None:
1578 import warnings
1579 warnings.warn(
1580 """The "version" argument to ArgumentParser is deprecated. """
1581 """Please use """
1582 """"add_argument(..., action='version', version="N", ...)" """
1583 """instead""", DeprecationWarning)
1584
1585 superinit = super(ArgumentParser, self).__init__
1586 superinit(description=description,
1587 prefix_chars=prefix_chars,
1588 argument_default=argument_default,
1589 conflict_handler=conflict_handler)
1590
1591 # default setting for prog
1592 if prog is None:
1593 prog = _os.path.basename(_sys.argv[0])
1594
1595 self.prog = prog
1596 self.usage = usage
1597 self.epilog = epilog
1598 self.version = version
1599 self.formatter_class = formatter_class
1600 self.fromfile_prefix_chars = fromfile_prefix_chars
1601 self.add_help = add_help
1602

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected