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

Method _check_choice

Lib/optparse.py:652–663  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

650 "must not supply a type for action %r" % self.action, self)
651
652 def _check_choice(self):
653 if self.type == "choice":
654 if self.choices is None:
655 raise OptionError(
656 "must supply a list of choices for type 'choice'", self)
657 elif not isinstance(self.choices, (tuple, list)):
658 raise OptionError(
659 "choices must be a list of strings ('%s' supplied)"
660 % str(type(self.choices)).split("'")[1], self)
661 elif self.choices is not None:
662 raise OptionError(
663 "must not supply choices for type %r" % self.type, self)
664
665 def _check_dest(self):
666 # No destination given, and we need one for this action. The

Callers

nothing calls this directly

Calls 3

OptionErrorClass · 0.85
strFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected