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

Method __init__

Lib/optparse.py:554–571  ·  view source on GitHub ↗
(self, *opts, **attrs)

Source from the content-addressed store, hash-verified

552 # -- Constructor/initialization methods ----------------------------
553
554 def __init__(self, *opts, **attrs):
555 # Set _short_opts, _long_opts attrs from 'opts' tuple.
556 # Have to be set now, in case no option strings are supplied.
557 self._short_opts = []
558 self._long_opts = []
559 opts = self._check_opt_strings(opts)
560 self._set_opt_strings(opts)
561
562 # Set all other attrs (action, type, etc.) from 'attrs' dict
563 self._set_attrs(attrs)
564
565 # Check all the attributes we just set. There are lots of
566 # complicated interdependencies, but luckily they can be farmed
567 # out to the _check_*() methods listed in CHECK_METHODS -- which
568 # could be handy for subclasses! The one thing these all share
569 # is that they raise OptionError if they discover a problem.
570 for checker in self.CHECK_METHODS:
571 checker(self)
572
573 def _check_opt_strings(self, opts):
574 # Filter out None because early versions of Optik had exactly

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

_check_opt_stringsMethod · 0.95
_set_opt_stringsMethod · 0.95
_set_attrsMethod · 0.95

Tested by

no test coverage detected