def __init__(self, py_func, locals={}, targetoptions={}): """ Parameters ---------- py_func: function object to be compiled locals: dict, optional Mapping of local variable names to Numba types. Used to override the types deduced by the type inference engine. targetoptions: dict, optional Target-specific config options. """ self.tm = default_type_manager argspec = inspect.getargspec(py_func) argct = len(argspec.args) super(Overloaded, self).__init__(self.tm.get_pointer(), argct) self.py_func = py_func functools.update_wrapper(self, py_func) # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code self.overloads = {} self.targetoptions = targetoptions self.locals = locals self._compiling = False self.targetdescr.typing_context.insert_overloaded(self)
def __init__(self, arg_count, py_func, pysig, can_fallback): self._tm = default_type_manager # A mapping of signatures to compile results self.overloads = collections.OrderedDict() self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code argnames = tuple(pysig.parameters) default_values = self.py_func.__defaults__ or () defargs = tuple(OmittedArg(val) for val in default_values) try: lastarg = list(pysig.parameters.values())[-1] except IndexError: has_stararg = False else: has_stararg = lastarg.kind == lastarg.VAR_POSITIONAL _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count, self._fold_args, argnames, defargs, can_fallback, has_stararg) self.doc = py_func.__doc__ self._compile_lock = threading.RLock() utils.finalize(self, self._make_finalizer())
def __init__(self, arg_count, py_func, pysig): self._tm = default_type_manager # A mapping of signatures to entry points self.overloads = utils.OrderedDict() # A mapping of signatures to compile results self._compileinfos = utils.OrderedDict() self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code self._pysig = pysig argnames = tuple(self._pysig.parameters) defargs = self.py_func.__defaults__ or () try: lastarg = list(self._pysig.parameters.values())[-1] except IndexError: has_stararg = False else: has_stararg = lastarg.kind == lastarg.VAR_POSITIONAL _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count, self._fold_args, argnames, defargs, has_stararg) self.doc = py_func.__doc__ self._compile_lock = utils.NonReentrantLock() utils.finalize(self, self._make_finalizer())
def __init__(self, arg_count, py_func, pysig, can_fallback, exact_match_required): self._tm = default_type_manager # A mapping of signatures to compile results self.overloads = collections.OrderedDict() self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code argnames = tuple(pysig.parameters) default_values = self.py_func.__defaults__ or () defargs = tuple(OmittedArg(val) for val in default_values) try: lastarg = list(pysig.parameters.values())[-1] except IndexError: has_stararg = False else: has_stararg = lastarg.kind == lastarg.VAR_POSITIONAL _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count, self._fold_args, argnames, defargs, can_fallback, has_stararg, exact_match_required) self.doc = py_func.__doc__ self._compiling_counter = _CompilingCounter() utils.finalize(self, self._make_finalizer())
def __init__(self, arg_count, py_func): self._tm = default_type_manager #_dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count) # A mapping of signatures to entry points self.overloads = {} # A mapping of signatures to compile results self._compileinfos = {} # A list of nopython signatures self._npsigs = [] self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code self._pysig = utils.pysignature(self.py_func) _argnames = tuple(self._pysig.parameters) _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count, _argnames) self.doc = py_func.__doc__ self._compile_lock = utils.NonReentrantLock() utils.finalize(self, self._make_finalizer())
def __init__(self, arg_count, py_func): self._tm = default_type_manager # _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count) # A mapping of signatures to entry points self.overloads = {} # A mapping of signatures to compile results self._compileinfos = {} # A list of nopython signatures self._npsigs = [] self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code self._pysig = utils.pysignature(self.py_func) _argnames = tuple(self._pysig.parameters) _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count, _argnames) self.doc = py_func.__doc__ self._compile_lock = utils.NonReentrantLock() utils.finalize(self, self._make_finalizer())
def __init__(self, arg_count, py_func, pysig): self._tm = default_type_manager # A mapping of signatures to entry points self.overloads = {} # A mapping of signatures to compile results self._compileinfos = {} # A list of nopython signatures self._npsigs = [] self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code self._pysig = pysig argnames = tuple(self._pysig.parameters) defargs = self.py_func.__defaults__ or () try: lastarg = list(self._pysig.parameters.values())[-1] except IndexError: has_stararg = False else: has_stararg = lastarg.kind == lastarg.VAR_POSITIONAL _dispatcher.Dispatcher.__init__(self, self._tm.get_pointer(), arg_count, self._fold_args, argnames, defargs, has_stararg) self.doc = py_func.__doc__ self._compile_lock = utils.NonReentrantLock() utils.finalize(self, self._make_finalizer())
def __init__(self, py_func, locals={}, targetoptions={}): self.tm = default_type_manager argspec = inspect.getargspec(py_func) argct = len(argspec.args) super(Overloaded, self).__init__(self.tm.get_pointer(), argct) self.py_func = py_func self.func_code = get_code_object(py_func) self.overloads = {} self.targetoptions = targetoptions self.locals = locals self.doc = py_func.__doc__ self._compiling = False self.targetdescr.typing_context.insert_overloaded(self)
def __init__(self, arg_count, py_func): self.tm = default_type_manager _dispatcher.Dispatcher.__init__(self, self.tm.get_pointer(), arg_count) # A mapping of signatures to entry points self.overloads = {} # A mapping of signatures to types.Function objects self._function_types = {} # A mapping of signatures to compile results self._compileinfos = {} self.py_func = py_func # other parts of Numba assume the old Python 2 name for code object self.func_code = get_code_object(py_func) # but newer python uses a different name self.__code__ = self.func_code self.doc = py_func.__doc__ self._compiling = False utils.finalize(self, self._make_finalizer())