Make sure that the incoming data complies with the class type we
        are expecting it to be. In this case, classes that inherit from this
        base class expect data to be of type ``list``.
167351
def safe_type(self, data, tree):
        
        if not isinstance(data, list):
            name = self.__class__.__name__
            msg = "did not pass validation against callable: %s" % name
            reason = 'expected a list but got %s' % safe_repr(data)
            raise Invalid(self.schema, tree, reason=reason, pair='value', msg=msg)
332970
def _generate_legacy_type_checks(types=()):
    
    types = dict(types)

    def gen_type_check(pytypes):
        pytypes = _utils.flatten(pytypes)

        def type_check(checker, instance):
            if isinstance(instance, bool):
                if bool not in pytypes:
                    return False
            return isinstance(instance, pytypes)

        return type_check

    definitions = {}
    for typename, pytypes in iteritems(types):
        definitions[typename] = gen_type_check(pytypes)

    return definitions
396650
def is_class(data):
    

    try:
        with unpack(data) as up:
            magic = up.unpack_struct(_BBBB)

        return magic == JAVA_CLASS_MAGIC

    except UnpackException:
        return False
207470
def from_list(cls, database, key, data, clear=False):
        
        lst = cls(database, key)
        if clear:
            lst.clear()
        lst.extend(data)
        return lst
1069577
public void computeType(XListLiteral literal, ITypeComputationState state) {
		JvmGenericType listType = findDeclaredType(List.class, state);
		if (listType == null) {
			handleCollectionTypeNotAvailable(literal, state, List.class);
			return;
		}
		for(ITypeExpectation expectation: state.getExpectations()) {
			computeType(literal, listType, expectation, state);
		}
	}
227999
def fields(class_or_instance):
    

    # Might it be worth caching this, per class?
    try:
        fields = getattr(class_or_instance, _FIELDS)
    except AttributeError:
        raise TypeError('must be called with a dataclass type or instance')

    # Exclude pseudo-fields.  Note that fields is sorted by insertion
    # order, so the order of the tuple is as the fields were defined.
    return tuple(f for f in fields.values() if f._field_type is _FIELD)
791135
def set_data(self, data):
        

        if not isinstance(data, basestring):
            raise ValueError("data must an instance of basestring")
        self._data = data
        self._current = 0
264012
def _flatten_list(self, data):
        ''

        if data is None:
            return ''
        if isinstance(data, types.StringTypes):
            return data
        elif isinstance(data, (list, tuple)):
            return '\n'.join(self._flatten_list(x) for x in data)
1267734
def _resolve_default(data_type, listify=False):
    """"""
    if isinstance(data_type, _ATOMIC):
        # A Python's object type needs to be left as is instead of being
        # wrapped into a NumPy type.
        out = (data_type.default if isinstance(data_type, Object)
               else _get_atomic_dtype(data_type)(data_type.default))
    elif isinstance(data_type, Array):
        element_default = _resolve_default(data_type.element_type,
                                           listify=listify)
        Sequence = list if listify else tuple
        shape = ((data_type.shape,) if isinstance(data_type.shape, int)
                 else data_type.shape)
        out = element_default
        for dimension in shape:
            out = Sequence(copy.deepcopy(out) for _ in _range(dimension))
    elif isinstance(data_type, Structure):
        if listify:
            out = [_resolve_default(field.type, listify=listify)
                   for field in data_type.fields]
        else:
            field_defaults = collections.OrderedDict(
                (field.name, _resolve_default(field.type, listify=listify))
                for field in data_type.fields)
            name = ('StructureDefault_%s' % (data_type.name,)
                    if data_type.name else 'StructureDefault')
            struct = collections.namedtuple(name, field_defaults.keys())
            out = struct(**field_defaults)

    return out
397527
def set_incoming(self, value):
        
        if not isinstance(value, list):
            raise TypeError("IncomingList new value must be a list")
        for element in value:
            if not isinstance(element, str):
                raise TypeError("IncomingList elements in variable must be of String class")
        self.__incoming_list = value
273024
def _forgiving_issubclass(derived_class, base_class):
    
    return (type(derived_class) is ClassType and \
            type(base_class) is ClassType and \
            issubclass(derived_class, base_class))
549473
def verify(self, x):
        
        if type(x) != type(self.data):
            raise TypeError("Input expected to be of type %s, got %s." %
                            (type(self.data).__name__, type(x).__name__))
        elif isinstance(x, np.ndarray):
            if x.ndim != 2:
                raise ValueError('Streamed array data must be two-dimensional')
            elif x.shape[1] != self.data.shape[1]:
                raise ValueError("Streamed array data expeced to have %d columns, "
                                 "got %d." % (self.data.shape[1], x.shape[1]))
        elif util.pd and isinstance(x, util.pd.DataFrame) and list(x.columns) != list(self.data.columns):
            raise IndexError("Input expected to have columns %s, got %s" %
                             (list(self.data.columns), list(x.columns)))
        elif isinstance(x, dict):
            if any(c not in x for c in self.data):
                raise IndexError("Input expected to have columns %s, got %s" %
                                 (sorted(self.data.keys()), sorted(x.keys())))
            elif len(set(len(v) for v in x.values())) > 1:
                raise ValueError("Input columns expected to have the "
                                 "same number of rows.")
908940
def order(self):
        
        return [x.val for theclass in self.classes for x in theclass.items]
587735
def check_type(self, zenpy_objects):
        
        expected_type = self.api._object_mapping.class_for_type(self.api.object_type)
        if not isinstance(zenpy_objects, collections.Iterable):
            zenpy_objects = [zenpy_objects]
        for zenpy_object in zenpy_objects:
            if type(zenpy_object) is not expected_type:
                raise ZenpyException(
                    "Invalid type - expected {} found {}".format(expected_type, type(zenpy_object))
                )
596796
def check_type_and_size_of_param_list(param_list, expected_length):
    
    try:
        assert isinstance(param_list, list)
        assert len(param_list) == expected_length
    except AssertionError:
        msg = "param_list must be a list containing {} elements."
        raise ValueError(msg.format(expected_length))

    return None
1010143
def checktype(self, val, kind, **kargs):
        """"""
        if not isinstance(val, kind):
            raise TypeError('Expected {}; got {}'.format(
                            self.str_kind(kind), self.str_valtype(val)))
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