s4cmd.py
def validate(self, format, args):
    '''Validate input parameters with given format.
       This function also checks for wildcards for recursive mode.
    '''
    fmtMap = {
      'cmd': 'Command',
      's3': 's3 path',
      'local': 'local path'
    }
    fmts = format.split('|')
    if len(fmts) != len(args):
      raise InvalidArgument('Invalid number of parameters')

    for i, fmt in enumerate(fmts):
      valid = False
      for f in fmt.split(','):
        if f == 'cmd' and args[i] + '_handler' in CommandHandler.__dict__:
          valid = True
        if f == 's3' and S3URL.is_valid(args[i]):
          valid = True
        if f == 'local' and not S3URL.is_valid(args[i]):
          valid = True
      if not valid:
        raise InvalidArgument('Invalid parameter: %s, %s expected' % (args[i], fmtMap[fmt.split(',')[0]]))
def validate(self, format, args):
    '''Validate input parameters with given format.
       This function also checks for wildcards for recursive mode.
    '''
    fmtMap = {
      'cmd': 'Command',
      's3': 's3 path',
      'local': 'local path'
    }
    fmts = format.split('|')
    if len(fmts) != len(args):
      raise InvalidArgument('Invalid number of parameters')

    for i, fmt in enumerate(fmts):
      valid = False
      for f in fmt.split(','):
        if f == 'cmd' and args[i] + '_handler' in CommandHandler.__dict__:
          valid = True
        if f == 's3' and S3URL.is_valid(args[i]):
          valid = True
        if f == 'local' and not S3URL.is_valid(args[i]):
          valid = True
      if not valid:
        raise InvalidArgument('Invalid parameter: %s, %s expected' % (args[i], fmtMap[fmt.split(',')[0]]))
def validate ( self , format , args ) : fmtMap = { 'cmd' : 'Command' , 's3' : 's3 path' , 'local' : 'local path' } fmts = format . split ( '|' ) if len ( fmts ) != len ( args ) : raise InvalidArgument ( 'Invalid number of parameters' ) for i , fmt in enumerate ( fmts ) : valid = False for f in fmt . split ( ',' ) : if f == 'cmd' and args [ i ] + '_handler' in CommandHandler . __dict__ : valid = True if f == 's3' and S3URL . is_valid ( args [ i ] ) : valid = True if f == 'local' and not S3URL . is_valid ( args [ i ] ) : valid = True if not valid : raise InvalidArgument ( 'Invalid parameter: %s, %s expected' % ( args [ i ] , fmtMap [ fmt . split ( ',' ) [ 0 ] ] ) )
Validate input parameters with given format.
       This function also checks for wildcards for recursive mode.
Validate input parameters with given format . This function also checks for wildcards for recursive mode .