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

Method __init__

Lib/argparse.py:1944–2005  ·  view source on GitHub ↗
(self,
                 prog=None,
                 usage=None,
                 description=None,
                 epilog=None,
                 parents=[],
                 formatter_class=HelpFormatter,
                 prefix_chars='-',
                 fromfile_prefix_chars=None,
                 argument_default=None,
                 conflict_handler='error',
                 add_help=True,
                 allow_abbrev=True,
                 exit_on_error=True,
                 *,
                 suggest_on_error=True,
                 color=True,
                 )

Source from the content-addressed store, hash-verified

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
1977 self.color = color
1978
1979 # Cached formatter for validation (avoids repeated _set_color calls)
1980 self._cached_formatter = None
1981
1982 add_group = self.add_argument_group
1983 self._positionals = add_group(_('positional arguments'))
1984 self._optionals = add_group(_('options'))
1985 self._subparsers = None
1986
1987 # register types
1988 self.register('type', None, _identity)
1989
1990 # add help argument if necessary
1991 # (using explicit default to override global argument_default)
1992 default_prefix = '-' if '-' in prefix_chars else prefix_chars[0]
1993 if self.add_help:
1994 self.add_argument(
1995 default_prefix+'h', default_prefix*2+'help',
1996 action='help', default=SUPPRESS,
1997 help=_('show this help message and exit'))
1998
1999 # add parent arguments and defaults
2000 for parent in parents:
2001 if not isinstance(parent, ArgumentParser):

Callers

nothing calls this directly

Calls 7

superClass · 0.85
_prog_nameFunction · 0.85
_Function · 0.50
registerMethod · 0.45
add_argumentMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected