def validate_params(method, D):
    if type(D['params']) == Object:
        keys = list(method.json_arg_types.keys())
        if len(keys) != len(D['params']):
            raise InvalidParamsError('Not enough params provided for %s' %
                                     method.json_sig)
        for k in keys:
            if not D['params'] in k:
                print('\n\n\n\nSHITTER SHITTER', k, D, '\n\n\n\n')
                raise InvalidParamsError('%s is not a valid parameter for %s' %
                                         (k, method.json_sig))
            if not Any.kind(D['params'][k]) == method.json_arg_types[k]:
                raise InvalidParamsError(
                    '%s is not the correct type %s for %s' %
                    (type(D['params'][k]), method.json_arg_types[k],
                     method.json_sig))
    elif type(D['params']) == Array:
        arg_types = list(method.json_arg_types.values())
        try:
            for i, arg in enumerate(D['params']):
                if not Any.kind(arg) == arg_types[i]:
                    raise InvalidParamsError(
                        '%s is not the correct type %s for %s' %
                        (type(arg), arg_types[i], method.json_sig))
        except IndexError:
            raise InvalidParamsError('Too many params provided for %s' %
                                     method.json_sig)
        else:
            if len(D['params']) != len(arg_types):
                raise InvalidParamsError('Not enough params provided for %s' %
                                         method.json_sig)
dataset/ETHPy150Open samuraisam/django-json-rpc/jsonrpc/site.py/validate_params/swapped operands of `in`