MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/argparse.py:1862–1925  ·  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=False,
                 color=True,
                 )

Source from the content-addressed store, hash-verified

1860 """
1861
1862 def __init__(self,
1863 prog=None,
1864 usage=None,
1865 description=None,
1866 epilog=None,
1867 parents=[],
1868 formatter_class=HelpFormatter,
1869 prefix_chars='-',
1870 fromfile_prefix_chars=None,
1871 argument_default=None,
1872 conflict_handler='error',
1873 add_help=True,
1874 allow_abbrev=True,
1875 exit_on_error=True,
1876 *,
1877 suggest_on_error=False,
1878 color=True,
1879 ):
1880 superinit = super(ArgumentParser, self).__init__
1881 superinit(description=description,
1882 prefix_chars=prefix_chars,
1883 argument_default=argument_default,
1884 conflict_handler=conflict_handler)
1885
1886 self.prog = _prog_name(prog)
1887 self.usage = usage
1888 self.epilog = epilog
1889 self.formatter_class = formatter_class
1890 self.fromfile_prefix_chars = fromfile_prefix_chars
1891 self.add_help = add_help
1892 self.allow_abbrev = allow_abbrev
1893 self.exit_on_error = exit_on_error
1894 self.suggest_on_error = suggest_on_error
1895 self.color = color
1896
1897 # Cached formatter for validation (avoids repeated _set_color calls)
1898 self._cached_formatter = None
1899
1900 add_group = self.add_argument_group
1901 self._positionals = add_group(_('positional arguments'))
1902 self._optionals = add_group(_('options'))
1903 self._subparsers = None
1904
1905 # register types
1906 def identity(string):
1907 return string
1908 self.register('type', None, identity)
1909
1910 # add help argument if necessary
1911 # (using explicit default to override global argument_default)
1912 default_prefix = '-' if '-' in prefix_chars else prefix_chars[0]
1913 if self.add_help:
1914 self.add_argument(
1915 default_prefix+'h', default_prefix*2+'help',
1916 action='help', default=SUPPRESS,
1917 help=_('show this help message and exit'))
1918
1919 # add parent arguments and defaults

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected