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

Method _set_opt_strings

Lib/optparse.py:582–601  ·  view source on GitHub ↗
(self, opts)

Source from the content-addressed store, hash-verified

580 return opts
581
582 def _set_opt_strings(self, opts):
583 for opt in opts:
584 if len(opt) < 2:
585 raise OptionError(
586 "invalid option string %r: "
587 "must be at least two characters long" % opt, self)
588 elif len(opt) == 2:
589 if not (opt[0] == "-" and opt[1] != "-"):
590 raise OptionError(
591 "invalid short option string %r: "
592 "must be of the form -x, (x any non-dash char)" % opt,
593 self)
594 self._short_opts.append(opt)
595 else:
596 if not (opt[0:2] == "--" and opt[2] != "-"):
597 raise OptionError(
598 "invalid long option string %r: "
599 "must start with --, followed by non-dash" % opt,
600 self)
601 self._long_opts.append(opt)
602
603 def _set_attrs(self, attrs):
604 for attr in self.ATTRS:

Callers 1

__init__Method · 0.95

Calls 2

OptionErrorClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected