Checks if any of the elements of the input list is in sys.argv array.
497323
def in_argv(arg_list):
    
    for arg in sys.argv:
        for parg in arg_list:
            if parg == arg or arg.startswith(parg):
                return True
    return False
435922
def check_array_struct(array):
    

    #If a list is transformed into a numpy array and the sub elements
    #of this array are still lists, then numpy failed to fully convert
    #the list, meaning it is not symmetrical.
    try:
        arr = np.array(array)
    except:
        raise HydraError("Array %s is not valid."%(array,))
    if type(arr[0]) is list:
        raise HydraError("Array %s is not valid."%(array,))
1361592
def _ls2ar(inp, strinp):
    """

    # Check if input is 1 or 3 elements (float, list, tuple, array)
    if np.size(inp) == 1:
        start = np.squeeze(inp)
        stop = start+1
        num = 1
    elif np.size(inp) == 3:
        start = inp[0]
        stop = inp[1]
        num = inp[2]
    else:
        print("* ERROR   :: <"+strinp+"> must be a float or a tuple of 3 " +
              "elements (start, stop, num); <"+strinp+" provided: " + str(inp))
        raise ValueError(strinp)

    # Re-arrange it to be compatible with np.arange/slice for brute
    if num < 2 or start == stop:
        stop = start
        step = 1
    else:
        step = (stop-start)/(num-1)
    return (start, stop+step/2, step)
606882
def check(self, val):
        
        # If there is no `type` requirement, everything is allowed
        if self.type is None:
            return True

        is_list = isinstance(val, list)
        # If lists are not allowed, and this is a list --> false
        if not self.listable and is_list:
            return False

        # `is_number` already checks for either list or single value
        if self.type == KEY_TYPES.NUMERIC and not is_number(val):
            return False
        elif (self.type == KEY_TYPES.TIME and
              not is_number(val) and '-' not in val and '/' not in val):
            return False
        elif self.type == KEY_TYPES.STRING:
            # If its a list, check first element
            if is_list:
                if not isinstance(val[0], basestring):
                    return False
            # Otherwise, check it
            elif not isinstance(val, basestring):
                return False
        elif self.type == KEY_TYPES.BOOL:
            if is_list and not isinstance(val[0], bool):
                return False
            elif not isinstance(val, bool):
                return False

        return True
80263
def _check_elements_equal(lst):
    
    assert isinstance(lst, list), "Input value must be a list."
    return not lst or lst.count(lst[0]) == len(lst)
157929
def isin(value, values):
    
    for i, v in enumerate(value):
        if v not in np.array(values)[:, i]:
            return False
    return True
1012461
def confirm_input(user_input):
    """"""
    if isinstance(user_input, list):
        user_input = ''.join(user_input)

    try:
        u_inp = user_input.lower().strip()
    except AttributeError:
        u_inp = user_input

    # Check for exit signal
    if u_inp in ('q', 'quit', 'exit'):
        sys.exit()
    if u_inp in ('y', 'yes'):
        return True
    return False
567314
def check_type_of_param_list_elements(param_list):
    
    try:
        assert isinstance(param_list[0], np.ndarray)
        assert all([(x is None or isinstance(x, np.ndarray))
                    for x in param_list])
    except AssertionError:
        msg = "param_list[0] must be a numpy array."
        msg_2 = "All other elements must be numpy arrays or None."
        total_msg = msg + "\n" + msg_2
        raise TypeError(total_msg)

    return None
75497
function(argv) {
  if (!_.isArray(argv)) {
    return false;
  }
  var nonStringsFound = _.find(argv, function(arg) {
    return !_.isString(arg);
  });
  return !nonStringsFound;
}
678807
private void check_args(final String argv[]) {

	if (argv[0].charAt(0) == '-') {
	    if (argv[0].equals("-?")) {
		print_usage();
		printInstanceNames();
		System.exit(0);
	    } else {
		print_usage();
		System.exit(-1);
	    }
	}
	ds_instance_name = argv[0];

	if (argv.length > 1) {
	    int ind = 1;
	    String dlist;
	    while (ind < argv.length) {
		if (argv[ind].charAt(0) == '-') {
		    switch (argv[ind].charAt(1)) {

		    //
		    // The verbose option
		    //

		    case 'v':
			if (argv[ind].length() == 2) {
			    if (argv.length - 1 > ind) {
				if (argv[ind + 1].charAt(0) == '-') {
				    set_trace_level(4);
				} else {
				    print_usage();
				    System.exit(-1);
				}
			    } else {
				set_trace_level(4);
			    }
			    ind++;
			} else {
			    final String level_str = argv[ind].substring(2);
			    int level = 0;
			    try {
				level = Integer.parseInt(level_str);
			    } catch (final NumberFormatException ex) {
				print_usage();
				System.exit(-1);
			    }

			    set_trace_level(level);
			    ind++;
			}
			break;

		    //
		    // Device server without database
		    //

		    case 'n':
			if (argv[ind].equals("-nodb") == false) {
			    print_usage();
			    System.exit(-1);
			} else {
			    _UseDb = false;
			    ind++;
			}
			break;

		    //
		    // Device list (for device server without database)
		    //

		    case 'd':
			if (argv[ind].equals("-dlist") == false) {
			    print_usage();
			    System.exit(-1);
			} else {
			    if (_UseDb == true) {
				print_usage();
				System.exit(-1);
			    }

			    ind++;
			    if (ind == argv.length) {
				print_usage();
				System.exit(-1);
			    } else {
				dlist = argv[ind].toLowerCase();

				//
				// Extract each device name
                    //
				String str;
				int start = 0;
				int pos;

				while ((pos = dlist.indexOf(',', start)) != -1) {
				    str = dlist.substring(start, pos);
				    start = pos + 1;
				    cmd_line_name_list.addElement(str);
				}
				if (start != dlist.length()) {
				    str = dlist.substring(start);
				    cmd_line_name_list.addElement(str);
				}

				//
				// Check that the same device name is not used
				// twice
				//

				int i, j;
				for (i = 0; i < cmd_line_name_list.size(); i++) {
				    for (j = 0; j < cmd_line_name_list.size(); j++) {
					if (i != j) {
					    if (cmd_line_name_list.elementAt(i).equals(
						    cmd_line_name_list.elementAt(j))) {
						System.err
							.println("Each device name must have different name");
						System.exit(-1);
					    }
					}
				    }
				}

			    }
			}
			break;

		    default:
			ind++;
			break;
		    }
		} else {
		    if (argv[ind - 1].substring(0, 2).equals("-v")) {
			print_usage();
			System.exit(-1);
		    }
		    ind++;
		}
	    }
	}

	//
	// Build server name in lower-case letters
	//

	real_server_name = ds_exec_name + "/" + ds_instance_name;
	ds_exec_name = ds_exec_name.toLowerCase();
	ds_instance_name = ds_instance_name.toLowerCase();

	ds_name = new StringBuffer(ds_exec_name);
	ds_name.append("/");
	ds_name.append(ds_instance_name);

	//
	// Check that the server name is not too long
	//

	if (ds_name.length() > Tango_MaxServerNameLength) {
	    System.err.println("The device server name is too long! Max length is "
		    + Tango_MaxServerNameLength + " characters.");
	    System.exit(-1);
	}
    }
992552
def is_iterable(value):
    """"""
    return isinstance(value, np.ndarray) or isinstance(value, list) or isinstance(value, tuple), value
662313
def _string_check(self, value, allow_list=False):
        '''
        
        '''
        if self._optcre is self.OPTCRE or value:
            is_list = isinstance(value, list)
            if is_list and not allow_list:
                raise TypeError('option value cannot be a list unless allow_list is True')
            elif not is_list:
                value = [value]
            if not all(isinstance(x, six.string_types) for x in value):
                raise TypeError('option values must be strings')
623347
def is_list_of_states(self, arg):
        
        return isinstance(arg, list) and all(isinstance(i, tuple) for i in arg)
325743
def is_pseq(arg):
    '''
    
    '''
    if is_nparray(arg): return arg.flags['WRITEABLE'] == False
    return isinstance(arg, (tuple_type, pyr.PVector, pyr.PList))
406471
def _check_args(self, source):
        '''
        '''
        path = [source]
        args = self.parsed_yaml.get('args', {})
        self._assert_struct_type(args, 'args', (dict, list), path)
        path.append('args')
        if isinstance(args, dict):
            for argn, argattrs in args.items():
                self._check_one_arg(path, argn, argattrs)
        else: # must be list - already asserted struct type
            for argdict in args:
                self._assert_command_dict(argdict, '[list-item]', path)
                argn, argattrs = list(argdict.items())[0] # safe - length asserted on previous line
                self._check_one_arg(path, argn, argattrs)
732468
def _check_array_parms(is_array, array_size, value, element_kind,
                       element_name):
    # pylint: disable=unused-argument
    # The array_size argument is unused.
    

    # The following case has been disabled because it cannot happen given
    # how this check function is used:
    # if array_size and is_array is False:
    #     raise ValueError(
    #         _format("The array_size parameter of {0} {1!A} is {2!A} but the "
    #                 "is_array parameter is False.",
    #                 element_kind, element_name, array_size))

    if value is not None:
        value_is_array = isinstance(value, (list, tuple))
        if not is_array and value_is_array:
            raise ValueError(
                _format("The is_array parameter of {0} {1!A} is False but "
                        "value {2!A} is an array.",
                        element_kind, element_name, value))
        if is_array and not value_is_array:
            raise ValueError(
                _format("The is_array parameter of {0} {1!A} is True but "
                        "value {2!A} is not an array.",
                        element_kind, element_name, value))
703932
def is_iterable_of_int(l):
     """
    if not is_iterable(l):
        return False

    return all(is_int(value) for value in l)