Return types must be correct, their codes must match actual use.
19140
def check_return_types(self, method):
        ''''''
        mn = method.__name__
        retanno = method.__annotations__.get('return', None)
        # Take a look at the syntax
        if not retanno:
            return ['Missing return types for method "{}"'.format(mn)]
        if not isinstance(retanno, (list, tuple)):
            msg = 'Return annotation for method "{}" not tuple nor list'
            return [msg.format(mn)]
        if (any(map(lambda t: not isinstance(t, (list, tuple)), retanno)) or
                any(map(lambda t: not (2 <= len(t) <= 3), retanno))):
            msg = ('Return values series for "{}" should be composed of '
                   '2 or 3-items tuples (code, msg, type).')
            return [msg.format(mn)]
        errors = []
        # Take a look at the codes
        declared = set([t[0] for t in retanno])
        actual = set(int(s)
                     for s in HTTP_STATUSES_REGEX.findall(method.source))
        if declared != actual:
            if declared.issubset(actual):
                msg = 'Method {} returns undeclared codes: {}.'
                errors.append(msg.format(mn, actual - declared))
            elif actual.issubset(declared):
                msg = 'Method {} declares codes {} that are never used.'
                errors.append(msg.format(mn, declared - actual))
            else:
                msg = 'Declared {} and Used {} codes mismatch.'
                errors.append(msg.format(declared, actual))
        # Take a look at the types
        ret_with_types = filter(lambda t: len(t) == 3, retanno)
        msg = 'Method {} return type for code {} must be class (not instance).'
        msg_mod = 'Method {} return type for code {} must subclass from Model.'
        for code, _, type_ in ret_with_types:
            try:
                if Model not in type_.__bases__:
                    errors.append(msg_mod.format(mn, code))
            except AttributeError:
                errors.append(msg.format(mn, code))
        return errors
935742
def match_value_by_name(expected_type, actual_value):
        
        if expected_type == None:
            return True
        if actual_value == None:
            raise Exception("Actual value cannot be null")

        return TypeMatcher.match_type_by_name(expected_type, type(actual_value))
619474
function (typeSpecs, values, location) {
	    checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
	  }
249485
private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) {
		if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) {
			// In this case, code reaches the end of the function or method and,
			// furthermore, that this requires a return value. To get here means
			// that there was no explicit return statement given on at least one
			// execution path.
			syntaxError(d, MISSING_RETURN_STATEMENT);
		}
	}
1175448
def validate_types(self, types=None):
        
        types = types or self.default_types
        if types is None:
            types = []
        if isinstance(types, six.string_types):
            types = [types]
        return types
977390
def check(self, return_code=0):
        
        ret = self.call().return_code
        ok = ret == return_code
        if not ok:
            raise EasyProcessError(
                self, 'check error, return code is not {0}!'.format(return_code))
        return self
759565
def match_type(mtype, patterns):
    ''''''
    for p in patterns:
        if fnmatch.fnmatch(mtype, p):
            return True
    return False
488524
def _set_return(self):
        """"""
        # TODO: manage return retrieved from element code (external)
        # TODO: manage different in/out styles
        if type(self.docs['in']['return']) is list and self.dst.style['out'] not in ['groups', 'numpydoc', 'google']:
            # TODO: manage return names
            # manage not setting return if not mandatory for numpy
            lst = self.docs['in']['return']
            if lst:
                if lst[0][0] is not None:
                    self.docs['out']['return'] = "%s-> %s" % (lst[0][0], lst[0][1])
                else:
                    self.docs['out']['return'] = lst[0][1]
                self.docs['out']['rtype'] = lst[0][2]
        else:
            self.docs['out']['return'] = self.docs['in']['return']
            self.docs['out']['rtype'] = self.docs['in']['rtype']
251015
function(expectedType, value) {
  var actualType = getType(value);
  if (expectedType!== actualType) {
    throw new TypeError('Expected type to be ' +
      expectedType + ', but got ' + actualType);
  }
  return value;
}
1110694
def _validate_type_key(key, value, types, validated):
    """"""
    for key_schema, value_schema in types.items():
        if not isinstance(key, key_schema):
            continue
        try:
            validated[key] = value_schema(value)
        except NotValid:
            continue
        else:
            return []

    return ['%r: %r not matched' % (key, value)]
903780
def check_return_type(value, cllable = None, clss = None, caller_level = 0):
    
    return _check_caller_type(True, cllable, value, clss, caller_level+1)
148185
def _check_type(name, obj, expected_type):
    
    if not isinstance(obj, expected_type):
        raise TypeError(
            '"%s" must be an a %s' % (name, expected_type.__name__)
        )
810640
function isType(type, val) {
  if (Struct.typeChecker[type]) {
    return Struct.typeChecker[type](val);
  }
  return false;
}
1262996
function assert (value, expected, method, type, identifier) {
    if (value !== expected) {
      throw new Error(method + ' only accepts ' + type + ' as ' + identifier);
    }
  }
732395
def _validate_return_fields(self, return_fields):
        
        for return_field in return_fields:
            if return_field not in self.RESPONSE_FIELD_MAP:
                raise InvalidReturnFieldException(
                    '"{0}" is an invalid return field'.format(return_field)
                )
717196
private static ReturnType returnType(final String s) {
        String[] args = ARGS_REGEX.split(s);
        return ReturnType.getReturnType(args[args.length - 1]);
    }
1184780
def _check_base_classes(base_classes, check_for_type):
    
    return_value = False
    for base in base_classes:
        if base.__name__ == check_for_type:
            return_value = True
            break
        else:
            return_value = _check_base_classes(base.__bases__, check_for_type)
            if return_value is True:
                break

    return return_value