コード例 #1
0
def _type_infer_method(context, ext_type, method, method_name, class_dict):
    if method_name not in ext_type.methoddict:
        return

    signature = ext_type.get_signature(method_name)
    restype, argtypes = signature.return_type, signature.args

    class_dict[method_name] = method
    func_signature, symtab, ast = pipeline.infer_types(
                        context, method.py_func, restype, argtypes)
    ext_type.add_method(method_name, func_signature)
コード例 #2
0
ファイル: decorators.py プロジェクト: glycerine/numba
        def wrapper(numba_func, *args, **kwargs):
            # Infer argument types
            arguments = args + tuple(kwargs[k] for k in sorted(kwargs))
            types = tuple(context.typemapper.from_python(value) for value in arguments)
            if types in _func_cache:
                compiled_numba_func = _func_cache[types]
            else:
                # Infer the return type
                func_signature, symtab, ast = pipeline.infer_types(context, f, argtypes=types)

                decorator = jit(restype=func_signature.return_type, argtypes=types, target=target)
                compiled_numba_func = decorator(f)
                _func_cache[types] = compiled_numba_func

            return numba_func.invoke_compiled(compiled_numba_func, *args, **kwargs)
コード例 #3
0
        def wrapper(numba_func, *args, **kwargs):
            # Infer argument types
            arguments = args + tuple(kwargs[k] for k in sorted(kwargs))
            types = tuple(
                context.typemapper.from_python(value) for value in arguments)
            if types in _func_cache:
                compiled_numba_func = _func_cache[types]
            else:
                # Infer the return type
                func_signature, symtab, ast = pipeline.infer_types(
                    context, f, argtypes=types)

                decorator = jit(restype=func_signature.return_type,
                                argtypes=types,
                                target=target)
                compiled_numba_func = decorator(f)
                _func_cache[types] = compiled_numba_func

            return numba_func.invoke_compiled(compiled_numba_func, *args,
                                              **kwargs)
コード例 #4
0
def infer(func, argtypes):
    sig, symtab, ast = pipeline.infer_types(decorators.context, func,
                                            argtypes=argtypes)
    return sig, symtab
コード例 #5
0
def infer(func, argtypes):
    sig, symtab, ast = pipeline.infer_types(decorators.context,
                                            func,
                                            argtypes=argtypes)
    return sig, symtab