

def standardize(ctx, f, intervals, options):
    if options.get('ignore'):
        f = wrapsafe(f)
    finite = []
    infinite = []
    for (k, points) in enumerate(intervals):
        (a, b) = ctx._as_points(points)
        if (b < a):
            return (False, (lambda : ctx.zero))
        if ((a == ctx.ninf) or (b == ctx.inf)):
            infinite.append((k, (a, b)))
        else:
            finite.append((k, (int(a), int(b))))
    if finite:
        f = fold_finite(ctx, f, finite)
        if (not infinite):
            return (False, (lambda : f(*([0] * len(intervals)))))
    if infinite:
        f = standardize_infinite(ctx, f, infinite)
        f = fold_infinite(ctx, f, infinite)
        args = ([0] * len(intervals))
        d = infinite[0][0]

        def g(k):
            args[d] = k
            return f(*args)
        return (True, g)

dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/calculus/extrapolation.py standardize/original