Lines Matching refs:opt
291 # * the opt strings and metavars
299 # But if the opt string list is too long, we put the help
327 for opt in parser.option_list:
328 strings = self.format_option_strings(opt)
329 self.option_strings[opt] = strings
333 for opt in group.option_list:
334 strings = self.format_option_strings(opt)
335 self.option_strings[opt] = strings
423 def check_builtin(option, opt, value):
429 _("option %s: invalid %s value: %r") % (opt, what, value))
431 def check_choice(option, opt, value):
438 % (opt, value, choices))
527 # check(option : Option, opt : string, value : string) -> any
530 # opt is the actual option seen on the command-line
589 for opt in opts:
590 if len(opt) < 2:
593 "must be at least two characters long" % opt, self)
594 elif len(opt) == 2:
595 if not (opt[0] == "-" and opt[1] != "-"):
598 "must be of the form -x, (x any non-dash char)" % opt,
600 self._short_opts.append(opt)
602 if not (opt[0:2] == "--" and opt[2] != "-"):
605 "must start with --, followed by non-dash" % opt,
607 self._long_opts.append(opt)
764 def check_value(self, opt, value):
769 return checker(self, opt, value)
771 def convert_value(self, opt, value):
774 return self.check_value(opt, value)
776 return tuple([self.check_value(opt, v) for v in value])
778 def process(self, opt, value, values, parser):
782 value = self.convert_value(opt, value)
788 self.action, self.dest, opt, value, values, parser)
790 def take_action(self, action, dest, opt, value, values, parser):
808 self.callback(self, opt, value, parser, *args, **kwargs)
982 for opt in option._short_opts:
983 if opt in self._short_opt:
984 conflict_opts.append((opt, self._short_opt[opt]))
985 for opt in option._long_opts:
986 if opt in self._long_opt:
987 conflict_opts.append((opt, self._long_opt[opt]))
997 for (opt, c_option) in conflict_opts:
998 if opt.startswith("--"):
999 c_option._long_opts.remove(opt)
1000 del self._long_opt[opt]
1002 c_option._short_opts.remove(opt)
1003 del self._short_opt[opt]
1024 for opt in option._short_opts:
1025 self._short_opt[opt] = option
1026 for opt in option._long_opts:
1027 self._long_opt[opt] = option
1058 for opt in option._short_opts:
1059 del self._short_opt[opt]
1060 for opt in option._long_opts:
1061 del self._long_opt[opt]
1433 # len of the opt string is greater than 1.
1470 def _match_long_opt(self, opt):
1471 """_match_long_opt(opt : string) -> string
1473 Determine which long option string 'opt' matches, ie. which one
1475 'opt' doesn't unambiguously match any long option string.
1477 return _match_abbrev(opt, self._long_opt)
1485 (opt, next_arg) = arg.split("=", 1)
1489 opt = arg
1492 opt = self._match_long_opt(opt)
1493 option = self._long_opt[opt]
1498 self.error(_("%s option requires an argument") % opt)
1501 % (opt, nargs))
1509 self.error(_("%s option does not take a value") % opt)
1514 option.process(opt, value, values, self)
1521 opt = "-" + ch
1522 option = self._short_opt.get(opt)
1526 raise BadOptionError(opt)
1537 self.error(_("%s option requires an argument") % opt)
1540 % (opt, nargs))
1550 option.process(opt, value, values, self)