def reapVarArgsCallback(option, optStr, value, parser):
 newValues = []
 gotDot = False
 for arg in parser.rargs:
  if (arg.startswith('--') and (len(arg) > 2)):
   break
  if (arg.startswith('-') and (len(arg) > 1)):
   break
  if (arg == '.'):
   gotDot = True
   break
  newValues.append(arg)
 if (not newValues):
  raise optparse.OptionValueError(('Empty arg list for option %r expecting one or more args (remaining tokens: %r)' % (optStr, parser.rargs)))
 del parser.rargs[:(len(newValues) + int(gotDot))]
 value = getattr(parser.values, option.dest, [])
 if (value is None):
  value = []
 value.extend(newValues)
 setattr(parser.values, option.dest, value)

def reapVarArgsCallback ( option , optStr , value , parser ) : newValues = [ ] gotDot = False for arg in parser . rargs : if ( arg . startswith ( '--' ) and ( len ( arg ) > 2 ) ) : break if ( arg . startswith ( '-' ) and ( len ( arg ) > 1 ) ) : break if ( arg == '.' ) : gotDot = True break newValues . append ( arg ) if ( not newValues ) : raise optparse . OptionValueError ( ( 'Empty arg list for option %r expecting one or more args (remaining tokens: %r)' % ( optStr , parser . rargs ) ) ) del parser . rargs [ : ( len ( newValues ) + int ( gotDot ) ) ] value = getattr ( parser . values , option . dest , [ ] ) if ( value is None ) : value = [ ] value . extend ( newValues ) setattr ( parser . values , option . dest , value )
used as optparse callback for reaping a variable number of option args .