コード例 #1
0
ファイル: object_hook_trusted.py プロジェクト: bopopescu/QC
def numpy_pandas_function_from_str(f):
    """
    reconstruct function from string representation
    """
    if f.startswith(np.__name__):
        mod = np
    elif f.startswith(pd.__name__):
        mod = pd
    elif f.startswith(builtins.__name__):
        mod = builtins
    else:
        msg = ("Function {} not recognized; only numpy, pandas, or builtin "
               "functions are supported.")
        raise wz_ex.NotImplemented(msg.format(f))
    fcn = reduce(getattr, f.split('.')[1:], mod)
    return fcn
コード例 #2
0
ファイル: test_core_compute.py プロジェクト: postelrich/blaze
def test_simple_add(n):
    x = symbol('x', 'int')
    expr = reduce(operator.add, [x] * n)
    assert compute(expr, 1) == n
コード例 #3
0
def test_simple_add(n):
    x = symbol('x', 'int')
    expr = reduce(operator.add, [x] * n)
    assert compute(expr, 1) == n