Only strings and numbers are valid redis arguments, other type of data
will be treated as error.
779790
function adjustCommandArgument(argObj) {
  if (typeof argObj === "number") {
    return argObj.toString()
  } else if (typeof argObj === "string") {
    return argObj
  } else if (!argObj) {
    return ""
  } else {
    throw new RedisCommandError(`Argument: ${inspect(argObj)}`)
  }
}
781542
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var offset = parseInt('' + args[1]);
  if(isNaN(offset) || offset < 0 || offset > Constants.MAX_BIT_LEN) {
    throw IntegerRange;
  }
  args[1] = offset;
}
796653
def _parse_output_for_errors(data, command, **kwargs):
    '''
    
    '''
    if re.search('% Invalid', data):
        raise CommandExecutionError({
            'rejected_input': command,
            'message': 'CLI excution error',
            'code': '400',
            'cli_error': data.lstrip(),
        })
    if kwargs.get('error_pattern') is not None:
        for re_line in kwargs.get('error_pattern'):
            if re.search(re_line, data):
                raise CommandExecutionError({
                    'rejected_input': command,
                    'message': 'CLI excution error',
                    'code': '400',
                    'cli_error': data.lstrip(),
                })
1189943
def _eval_script(redis, script_id, *keys, **kwargs):
    
    args = kwargs.pop('args', ())
    if kwargs:
        raise TypeError("Unexpected keyword arguments %s" % kwargs.keys())
    try:
        return redis.evalsha(SCRIPTS[script_id], len(keys), *keys + args)
    except NoScriptError:
        logger.info("%s not cached.", SCRIPTS[script_id + 2])
        return redis.eval(SCRIPTS[script_id + 1], len(keys), *keys + args)
9139
def validate_json(data: str):
    
    result = None
    try:
        result = json.loads(data)
    except ValueError as error:
        log(ERROR, "invalid json: %s", error)

    return result
164516
def value(args = {})
      r = self.raw_value

      case datatype
      when RubyXL::DataType::SHARED_STRING then workbook.shared_strings_container[r.to_i].to_s
      when RubyXL::DataType::INLINE_STRING then is.to_s
      when RubyXL::DataType::RAW_STRING    then raw_value
      else
        if is_date? then workbook.num_to_date(r.to_f)
        elsif r.is_a?(String) && (r =~ NUMBER_REGEXP) then # Numeric
          if $1 != '' then r.to_f
          else r.to_i
          end
        else r
        end
      end
    end
1276990
def numberify_data(self, source, start=1):
        '''
        '''
        if type(source) is str:
            try:
                fd = open(source, 'r+')
                data = fd.readlines()
                for index, item in enumerate(data):
                    data[index] = item.strip('\n')
                fd.close()
            except IOError as e:
                print 'I/O error({0}): {1}'.format(e.errno, e.strerror)
                return False
        elif type(source) is list:
            data = source
        else:
            print 'Data error. Pass a filename or a list'
            return False
        return dict(list(enumerate(data, start)))
1142854
def validate(self, value, messages=None):
        
        valid     = True
        primitive = value

        def log(msg):
            if messages is not None:
                messages.append(msg)

        if self.enum:
            if value not in self.enum.values():
                valid = False
                flds = (self.name, str(value))
                log("%s value '%s' not in allowed enumerated values." % flds)
            else:
                primitive = int(self.enum.keys()[self.enum.values().index(value)])

        if self.type:
            if self.type.validate(primitive, messages, self.name) is False:
                valid = False

        return valid
1093510
def _match_error_to_data_set(x, ex):
    
    # Simplest case, ex is None or a number
    if not _fun.is_iterable(ex):
        
        # Just make a matched list of Nones
        if ex is None: ex = [ex]*len(x)
        
        # Make arrays of numbers
        if _fun.is_a_number(ex): 
            value = ex # temporary storage
            ex    = []
            for n in range(len(x)): 
                ex.append([value]*len(x[n]))
    
    # Otherwise, ex is iterable
    
    # Default behavior: If the elements are all numbers and the length matches
    # that of the first x-array, assume this is meant to match all the x
    # data sets
    if _fun.elements_are_numbers(ex) and len(ex) == len(x[0]): ex = [ex]*len(x)

    # The user may specify a list of some iterable and some not. Assume
    # in this case that at least the lists are the same length    
    for n in range(len(x)):
        # do nothing to the None's
        # Inflate single numbers to match
        if _fun.is_a_number(ex[n]): ex[n] = [ex[n]]*len(x[n])
        
    return ex
6694
def raw= (args)
      @original = args
      case args
      when String
        parse_from_string(args)
      when Hash
        args = { :area_code => PhoneNumber.default_area_code }.merge(args)
        NUMBER_PARTS.each do |key|
          send("#{key}=", args[key]) if args[key]
        end
      when Array
        self.pack!(args)
      else
        raise ArgumentError.new("Sorry, can't handle arguments of type #{args.class}")
      end
    end
327867
def _init_redis(redis_spec):
        
        if not redis_spec:
            return
        if isinstance(redis_spec, six.string_types):
            return redis.StrictRedis.from_url(redis_spec)
        # assume any other value is a valid instance
        return redis_spec
372643
function validate( opts, options ) {
	if ( !isObject( options ) ) {
		return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
	}
	if ( options.hasOwnProperty( 'radix' ) ) {
		opts.radix = options.radix;
		if ( !isInteger( opts.radix ) ) {
			return new TypeError( 'invalid option. Radix must be an integer. Option: `' + opts.radix + '`.' );
		}
		if ( opts.radix < 2 || opts.radix > 36 ) {
			return new RangeError( 'invalid option. Radix must be an integer on the interval [2,36]. Option: `' + opts.radix + '`.' );
		}
	}
	return null;
}
301652
function ( sData )
		{
			/* Allow zero length strings as a number */
			if ( typeof sData === 'number' )
			{
				return 'numeric';
			}
			else if ( typeof sData !== 'string' )
			{
				return null;
			}
			
			var sValidFirstChars = "0123456789-";
			var sValidChars = "0123456789.";
			var Char;
			var bDecimal = false;
			
			/* Check for a valid first char (no period and allow negatives) */
			Char = sData.charAt(0); 
			if (sValidFirstChars.indexOf(Char) == -1) 
			{
				return null;
			}
			
			/* Check all the other characters are valid */
			for ( var i=1 ; i<sData.length ; i++ ) 
			{
				Char = sData.charAt(i); 
				if (sValidChars.indexOf(Char) == -1) 
				{
					return null;
				}
				
				/* Only allowed one decimal place... */
				if ( Char == "." )
				{
					if ( bDecimal )
					{
						return null;
					}
					bDecimal = true;
				}
			}
			
			return 'numeric';
		}
489199
def _floatify(str, increment = true)
      if (( inf = str.to_s.match(/^([+-])?inf/i) ))
        (inf[1] == "-" ? -1.0 : 1.0) / 0.0
      elsif (( number = str.to_s.match(/^\((\d+)/i) ))
        number[1].to_i + (increment ? 1 : -1)
      else
        Float str.to_s
      end
    rescue ArgumentError
      raise Redis::CommandError, "ERR value is not a valid float"
    end
581500
def _validate_output_data(
        self, original_res, serialized_res, formatted_res, request):
        

        validator = self.representation

        # when not to validate...
        if not validator:
            return

        try:
            if isinstance(serialized_res, (list, tuple)):
                map(validator.validate, serialized_res)
            else:
                validator.validate(serialized_res)
        except ValidationError, exc:
            self._output_validation_failed(exc, serialized_res, request)
1128763
function validateParams(fs, param2) {
  var err;

  if(!fs) {
    err = new Errors.EINVAL('No filesystem provided');
  } else if(!param2) {
    err = new Errors.EINVAL('Second argument must be specified');
  }

  return err;
}
1231645
function strlen(key, req) {
  var val = this.getKey(key, req);
  if(!val) return 0;
  if(val instanceof Buffer) return val.length;
  // redis compatible, return byte length
  return Buffer.byteLength(val);
}