def takes_parameters(count):
    """Ensure the filter function has "count" parameters specified."""
    def decorator(f):
        """Decorate the supplied function with the "takes_parameters" logic."""
        @wraps(f)
        def wrapper(filter_operation_info, location, context, parameters, *args, **kwargs):
            """Check that the supplied number of parameters equals the expected number."""
            if len(parameters) != count:
                raise GraphQLCompilationError(u'Incorrect number of parameters, expected {} got '
                                              u'{}: {}'.format(count, len(parameters), parameters))

            return f(filter_operation_info, location, context, parameters, *args, **kwargs)

        return wrapper

    return decorator
def takes_parameters ( count ) : def decorator ( f ) : @ wraps ( f ) def wrapper ( filter_operation_info , location , context , parameters , * args , ** kwargs ) : if len ( parameters ) != count : raise GraphQLCompilationError ( u'Incorrect number of parameters, expected {} got ' u'{}: {}' . format ( count , len ( parameters ) , parameters ) ) return f ( filter_operation_info , location , context , parameters , * args , ** kwargs ) return wrapper return decorator
Ensure the filter function has "count" parameters specified.