

def optimization_func(info, pattern, node):
    'Invoked to count an applied optimization and to replace'
    info['c'] += 1
    if isinstance(pattern.replacement, collections.Callable):
        return pattern.replacement(node)
    else:
        return pattern.replacement

dataset/ETHPy150Open armon/pypred/pypred/optimizer.py optimization_func/original