Raise error if the value is not a list
961912
def _cast_to_type(self, value):
        
        if not isinstance(value, list):
            self.fail('invalid', value=value)
        return value
264924
def unlist(list_thing, complain=True):
    """"""
    if complain and len(list_thing) > 1:
        raise ValueError("More than one element in {}".format(list_thing))
    elif len(list_thing) == 1:
        return list_thing[0]

    if complain:
        raise ValueError("Nothing in {}".format(list_thing))
    return None
385108
def as_tuple(self, value):
        """"""
        if isinstance(value, list):
            value = tuple(value)
        return value
1254969
def _validate_iterable(iterable_type, value):
    
    if isinstance(value, six.string_types):
        msg = "Invalid iterable of type(%s): %s"
        raise ValidationError(msg % (type(value), value))

    try:
        return iterable_type(value)
    except TypeError:
        raise ValidationError("Invalid iterable: %s" % (value))
992552
def is_iterable(value):
    """"""
    return isinstance(value, np.ndarray) or isinstance(value, list) or isinstance(value, tuple), value
591870
def extend_is_dir(value, minimum=None, maximum=None):
    
    """

    if isinstance(value, list):
        return [is_dir(member)
                for member in validate.is_list(value, minimum, maximum)]

    else:
        return is_dir(value)
282952
def return_an_error(*args):
    '''
    '''
    list_errors = []
    list_errors.extend(list(args))

    errors = { 'errors': list_errors }
    return errors
1079327
def raise_invalid_type_exception(self):
        """"""
        message = 'Expecting element type of %s' % (
            self._parameter.element_type.__name__)
        err = ValueError(message)
        return err
1128622
def _raise_error_if_not_sarray(dataset, variable_name="SArray"):
    
    err_msg = "Input %s is not an SArray."
    if not isinstance(dataset, _SArray):
      raise ToolkitError(err_msg % variable_name)
292559
def validate_is_callable_or_none(option, value):
    """"""
    if value is None:
        return value
    if not callable(value):
        raise ValueError("%s must be a callable" % (option,))
    return value
662444
def validate(cls, value):
        
        if value not in cls._valid_settings:
            raise ValueError(
                "%s not a member of %s enumeration" % (value, cls.__name__)
            )
1066643
def raise_(tp, value=None, tb=None):
    
    if value is not None and isinstance(tp, Exception):
        raise TypeError("instance exception may not have a separate value")
    if value is not None:
        exc = tp(value)
    else:
        exc = tp
    if exc.__traceback__ is not tb:
        raise exc.with_traceback(tb)
    raise exc
307003
def value_validate(self, value):
        
        if not isinstance(value, str):
            raise tldap.exceptions.ValidationError("Invalid sid")

        array = value.split("-")
        length = len(array) - 3

        if length < 1:
            raise tldap.exceptions.ValidationError("Invalid sid")

        if array.pop(0) != "S":
            raise tldap.exceptions.ValidationError("Invalid sid")

        try:
            [int(i) for i in array]
        except TypeError:
            raise tldap.exceptions.ValidationError("Invalid sid")
936103
def clean(self, value):
        """"""

        if isinstance(value, numpy.ndarray):
            return value
        elif isinstance(value, (list, tuple)):
            return numpy.array(value)

        raise ParameterNotValidError
1104256
def ensure_list(value: Union[T, Sequence[T]]) -> Sequence[T]:
    """"""
    if value is None:
        return []
    return value if isinstance(value, list) else [value]
45454
def _validate_iterable(self, is_iterable, key, value):
        """"""
        if is_iterable:
            try:
                iter(value)
            except TypeError:
                self._error(key, "Must be iterable (e.g. a list or array)")
803732
def _optional_list(value):
    ''''''
    if isinstance(value, str):
        return (value, )
    elif isinstance(value, list):
        return tuple(value)

    return None