Home | History | Annotate | Download | only in python2.7

Lines Matching defs:opt

13 GetoptError -- exception (class) raised with 'opt' attribute, which is the
39 opt = ''
41 def __init__(self, msg, opt=''):
43 self.opt = opt
44 Exception.__init__(self, msg, opt)
144 def do_longs(opts, opt, longopts, args):
146 i = opt.index('=')
150 opt, optarg = opt[:i], opt[i+1:]
152 has_arg, opt = long_has_args(opt, longopts)
156 raise GetoptError('option --%s requires argument' % opt, opt)
159 raise GetoptError('option --%s must not have an argument' % opt, opt)
160 opts.append(('--' + opt, optarg or ''))
166 def long_has_args(opt, longopts):
167 possibilities = [o for o in longopts if o.startswith(opt)]
169 raise GetoptError('option --%s not recognized' % opt, opt)
171 if opt in possibilities:
172 return False, opt
173 elif opt + '=' in possibilities:
174 return True, opt
179 raise GetoptError('option --%s not a unique prefix' % opt, opt)
189 opt, optstring = optstring[0], optstring[1:]
190 if short_has_arg(opt, shortopts):
193 raise GetoptError('option -%s requires argument' % opt,
194 opt)
199 opts.append(('-' + opt, optarg))
202 def short_has_arg(opt, shortopts):
204 if opt == shortopts[i] != ':':
206 raise GetoptError('option -%s not recognized' % opt, opt)