Esempio n. 1
0
def typeof(variable):
    """
    Get the type of a variable.

    Used outside of Numba code, infers the type for the object.
    """
    from numba.environment import NumbaEnvironment
    context = NumbaEnvironment.get_environment().context
    return context.typemapper.from_python(variable)
Esempio n. 2
0
def typeof(variable):
    """
    Get the type of a variable.

    Used outside of Numba code, infers the type for the object.
    """
    from numba.environment import NumbaEnvironment
    context = NumbaEnvironment.get_environment().context
    return context.typemapper.from_python(variable)
Esempio n. 3
0
def test_typeset_matching():
    context = NumbaEnvironment.get_environment().context

    numeric = typeset.typeset([int_, longlong])
    n = numeric(numeric, numeric)
    f = numba.floating(numba.floating, numba.floating)

    signatures = [n, f, object_(object_, object_)]
    ts = typeset.typeset(signatures)

    assert ts.find_match(context, [float_, float_]) == s(float_)
    assert ts.find_match(context, [float_, double]) == s(double)
    assert ts.find_match(context, [longdouble, float_]) == s(longdouble)

    assert ts.find_match(context, [int_, int_]) == s(int_)
    assert ts.find_match(context, [int_, longlong]) == s(longlong)
    assert ts.find_match(context, [short, int_]) == s(int_)

    assert ts.find_match(context, [short, ulonglong]) is None
Esempio n. 4
0
def test_typeset_matching():
    context = NumbaEnvironment.get_environment().context

    numeric = typeset.typeset([int_, longlong])
    n = numeric(numeric, numeric)
    f = numba.floating(numba.floating, numba.floating)

    signatures = [n, f, object_(object_, object_)]
    ts = typeset.typeset(signatures)

    assert ts.find_match(context, [float_, float_]) == s(float_)
    assert ts.find_match(context, [float_, double]) == s(double)
    assert ts.find_match(context, [longdouble, float_]) == s(longdouble)

    assert ts.find_match(context, [int_, int_]) == s(int_)
    assert ts.find_match(context, [int_, longlong]) == s(longlong)
    assert ts.find_match(context, [short, int_]) == s(int_)

    assert ts.find_match(context, [short, ulonglong]) is None