Home | History | Annotate | Download | only in Lib

Lines Matching defs:opt

13 GetoptError -- exception (class) raised with 'opt' attribute, which is the
44 opt = ''
46 def __init__(self, msg, opt=''):
48 self.opt = opt
49 Exception.__init__(self, msg, opt)
149 def do_longs(opts, opt, longopts, args):
151 i = opt.index('=')
155 opt, optarg = opt[:i], opt[i+1:]
157 has_arg, opt = long_has_args(opt, longopts)
161 raise GetoptError(_('option --%s requires argument') % opt, opt)
164 raise GetoptError(_('option --%s must not have an argument') % opt, opt)
165 opts.append(('--' + opt, optarg or ''))
171 def long_has_args(opt, longopts):
172 possibilities = [o for o in longopts if o.startswith(opt)]
174 raise GetoptError(_('option --%s not recognized') % opt, opt)
176 if opt in possibilities:
177 return False, opt
178 elif opt + '=' in possibilities:
179 return True, opt
184 raise GetoptError(_('option --%s not a unique prefix') % opt, opt)
194 opt, optstring = optstring[0], optstring[1:]
195 if short_has_arg(opt, shortopts):
198 raise GetoptError(_('option -%s requires argument') % opt,
199 opt)
204 opts.append(('-' + opt, optarg))
207 def short_has_arg(opt, shortopts):
209 if opt == shortopts[i] != ':':
211 raise GetoptError(_('option -%s not recognized') % opt, opt)