コード例 #1
0
ファイル: dispatcher.py プロジェクト: FedericoStra/numba
            flags = self.flags
            args, return_type = sigutils.normalize_signature(sig)

            # Don't recompile if signature already exists
            # (e.g. if another thread compiled it before we got the lock)
            existing = self.overloads.get(tuple(args))
            if existing is not None:
                return existing.entry_point

            assert not flags.enable_looplift, "Enable looplift flags is on"
            cres = compiler.compile_ir(typingctx=self.typingctx,
                                       targetctx=self.targetctx,
                                       func_ir=self.func_ir,
                                       args=args, return_type=return_type,
                                       flags=flags, locals=self.locals,
                                       lifted=(),
                                       lifted_from=self.lifted_from)

            # Check typing error if object mode is used
            if cres.typing_error is not None and not flags.enable_pyobject:
                raise cres.typing_error

            self.add_overload(cres)
            return cres.entry_point


# Initialize typeof machinery
_dispatcher.typeof_init(
    OmittedArg,
    dict((str(t), t._code) for t in types.number_domain))
コード例 #2
0
ファイル: dispatcher.py プロジェクト: austinteshuba/DBSCAN
        args = [types.ffi_forced_object] * len(args)

        if self._can_compile:
            self.compile(tuple(args))

        signatures = [typing.signature(self.output_types, *args)]
        pysig = None
        func_name = self.py_func.__name__
        name = "CallTemplate({0})".format(func_name)
        call_template = typing.make_concrete_template(name,
                                                      key=func_name,
                                                      signatures=signatures)

        return call_template, pysig, args, kws

    def _legalize_arg_types(self, args):
        for i, a in enumerate(args, start=1):
            if isinstance(a, types.List):
                msg = ('Does not support list type inputs into '
                       'with-context for arg {}')
                raise errors.TypingError(msg.format(i))
            elif isinstance(a, types.Dispatcher):
                msg = ('Does not support function type inputs into '
                       'with-context for arg {}')
                raise errors.TypingError(msg.format(i))


# Initialize typeof machinery
_dispatcher.typeof_init(OmittedArg,
                        dict((str(t), t._code) for t in types.number_domain))