Converts value into array object.
        Single values are converted into arrays with a single element.

        :param value: the value to convert.

        :return: array object or None when value is None.
505756
def to_nullable_array(value):
        
        # Shortcuts
        if value == None:
            return None
        if type(value) == list:
            return value 

        if type(value) in [tuple, set]:
            return list(value)
            
        return [value]
463916
def from_value(cls, value: str) -> T:
        
        return [x for x in cls.__members__.values() if x.value[0] == value][0]
45880
def convert_to_struct(value):
    
    direct_converts = [dict, OrderedDict, UserDict]
    if type(value) in direct_converts:
        # Convert dict-like things to Struct
        value = Struct(value)
    elif isinstance(value, list):
        # Process list elements
        value = [convert_to_struct(z) for z in value]

    # Done
    return value
460844
def _decode(self, value):
        
        if isinstance(value, list):
            return [self._decode(v) for v in value]
        elif isinstance(value, dict):
            return {self._decode(k): self._decode(v)
                    for k, v in value.items()}
        elif isinstance(value, bytes):
            return value.decode('utf-8')
        return value
906246
def value_to_python(self, value):
        
        if not isinstance(value, bytes):
            raise tldap.exceptions.ValidationError("should be a bytes")

        length = len(value) - 8
        if length % 4 != 0:
            raise tldap.exceptions.ValidationError("Invalid sid")

        length = length // 4

        array = struct.unpack('<bbbbbbbb' + 'I' * length, value)

        if array[1] != length:
            raise tldap.exceptions.ValidationError("Invalid sid")

        if array[2:7] != (0, 0, 0, 0, 0):
            raise tldap.exceptions.ValidationError("Invalid sid")

        array = ("S", ) + array[0:1] + array[7:]
        return "-".join([str(i) for i in array])
732661
public static function toArray($value)
    {
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof Collection) {
            return $value->all();
        }

        return [$value];
    }
1183801
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static List<Object> arrayAsList(Object value) {
		if (value instanceof List) {
			return (List<Object>) value;
		}
		List list = null;
		if (value instanceof int[]) {
			list = new ArrayList();
			int[] array = (int[]) value;
			for (int i : array) {
				list.add(i);
			}
		} else if (value instanceof short[]) {
			list = new ArrayList();
			short[] array = (short[]) value;
			for (short i : array) {
				list.add(i);
			}
		} else if (value instanceof char[]) {
			list = new ArrayList();
			char[] array = (char[]) value;
			for (char i : array) {
				list.add(i);
			}
		} else if (value instanceof byte[]) {
			list = new ArrayList();
			byte[] array = (byte[]) value;
			for (byte i : array) {
				list.add(i);
			}
		} else if (value instanceof long[]) {
			list = new ArrayList();
			long[] array = (long[]) value;
			for (long i : array) {
				list.add(i);
			}
		} else if (value instanceof double[]) {
			list = new ArrayList();
			double[] array = (double[]) value;
			for (double i : array) {
				list.add(i);
			}
		} else if (value instanceof float[]) {
			list = new ArrayList();
			float[] array = (float[]) value;
			for (float i : array) {
				list.add(i);
			}
		} else if (value instanceof boolean[]) {
			list = new ArrayList();
			boolean[] array = (boolean[]) value;
			for (boolean i : array) {
				list.add(i);
			}
		} else if (value.getClass().isArray()) {
			Object[] array = (Object[]) value;
			list = Arrays.asList(array);
		}
		return list;
	}
721554
def _as_array(arr, dtype=None):
    
    if arr is None:
        return None
    if isinstance(arr, np.ndarray) and dtype is None:
        return arr
    if isinstance(arr, integer_types + (float,)):
        arr = [arr]
    out = np.asarray(arr)
    if dtype is not None:
        if out.dtype != dtype:
            out = out.astype(dtype)
    if out.dtype not in _ACCEPTED_ARRAY_DTYPES:
        raise ValueError("'arr' seems to have an invalid dtype: "
                         "{0:s}".format(str(out.dtype)))
    return out
332398
def to_python(self, value):
        
        if not value:
            value = []

        # If a list is set then validated its items
        if isinstance(value, list):
            py_list = self.validate_list(value)
        else:  # try to de-serialize value and expect list and then validate
            try:
                py_list = json.loads(value)

                if not isinstance(py_list, list):
                    raise TypeError

                self.validate_list(py_list)
            except (ValueError, TypeError):
                raise ValidationError(u'Must be a valid list of strings.')

        return py_list
227623
def _flatten_value(value):
    

    if type(value) == pd.DataFrame:
        value = value.values.tolist()

    if type(value) != list:
        raise ValidationError("Value %s cannot be processed."%(value))

    if len(value) == 0:
        return

    flat_list = _flatten_list(value)

    return flat_list
1172296
function array(value) {
  var parsedArray = json(value);

  // couldn't parse it
  if (typeOf(parsedArray) != 'array') {
    return throwModifierError('array', value, {message: 'Invalid Array'});
  }

  return parsedArray;
}
531162
def parse(self, value):
        
        if self.required and value is None:
            raise ValueError("%s is required!" % self.name)
        elif self.ignored and value is not None:
            warn("%s is ignored for this class!" % self.name)
        elif not self.multi and isinstance(value, (list, tuple)):
            if len(value) > 1:
                raise ValueError(
                    "%s does not accept multiple values!" % self.name
                )
            return value[0]
        elif self.multi and value is not None:
            if not isinstance(value, (list, tuple)):
                return [value]
        return value
383828
def to_python(self, value):
        
        if value == "":
            return None

        try:
            if isinstance(value, six.string_types):
                return self.deserializer(value)
            elif isinstance(value, bytes):
                return self.deserializer(value.decode('utf8'))
        except ValueError:
            pass
        return value
965949
def serialize(self, value, **kwargs):
        
        if self._serialize is not None:
            return self._serialize(value, **kwargs)
        else:
            return value
440186
def clean(self, value):
		

		# If the value is None and it's optional, return as is
		if value is None and self._optional:
			return None

		# If the value is not a list
		if not isinstance(value, list):
			raise ValueError('value')

		# Recurse and return it
		return [self._node.clean(m) for m in value]
733582
def deserialize(cls, value, *args, **kwargs):
        

        if isinstance(value, cls.TYPE):
            return value
        elif is_null(value):
            return None
        else:
            return value
57433
def _dictify(field, value):
    
    if value is None:
        return None
    elif field.type_:
        return value.to_dict()
    return field.dict_value(value)