'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.'

def __init__(self, py_func, locals={}, targetoptions={}, impl_kind='direct'):

    self.typingctx = self.targetdescr.typing_context
    self.targetctx = self.targetdescr.target_context
    pysig = utils.pysignature(py_func)
    arg_count = len(pysig.parameters)
    can_fallback = (not targetoptions.get('nopython', False))
    _DispatcherBase.__init__(self, arg_count, py_func, pysig, can_fallback)
    functools.update_wrapper(self, py_func)
    self.targetoptions = targetoptions
    self.locals = locals
    self._cache = NullCache()
    compiler_class = self._impl_kinds[impl_kind]
    self._impl_kind = impl_kind
    self._compiler = compiler_class(py_func, self.targetdescr, targetoptions, locals)
    self._cache_hits = collections.Counter()
    self._cache_misses = collections.Counter()
    self._type = types.Dispatcher(self)
    self.typingctx.insert_global(self, self._type)
