Construct a namer object for a given function scope.
422365
def build(cls, node):
    """"""
    if not isinstance(node, gast.FunctionDef):
      raise ValueError
    namer = cls()
    namer.names.update(get_names(node))
    return namer
1057766
def get_function(self, name):
        
        p = ffi.lib.LLVMPY_GetNamedFunction(self, _encode_string(name))
        if not p:
            raise NameError(name)
        return ValueRef(p, 'function', dict(module=self))
327529
def register_function(self, name: Optional[str]=None):
        
        def wrap(function: Callable)->Any:
            nonlocal name
            if name is None:
                name = function.__name__
            self.funcs[name] = function
            return function
        return wrap
242682
def _fun_names_iter(self, functyp, val):
        
        funcstore = getattr(self.engine, functyp)
        for v in val:
            if callable(v):
                # Overwrites anything already on the funcstore, is that bad?
                setattr(funcstore, v.__name__, v)
                yield v.__name__
            elif v not in funcstore:
                raise KeyError("Function {} not present in {}".format(
                    v, funcstore._tab
                ))
            else:
                yield v
813545
def typedefs(
            self,
            name=None,
            function=None,
            header_dir=None,
            header_file=None,
            recursive=None,
            allow_empty=None):
        """"""
        return (
            self._find_multiple(
                self._impl_matchers[scopedef_t.typedef],
                name=name,
                function=function,
                decl_type=self._impl_decl_types[
                    scopedef_t.typedef],
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive,
                allow_empty=allow_empty)
        )
457656
def decorate(func, caller):
    
    evaldict = dict(_call_=caller, _func_=func)
    fun = FunctionMaker.create(
        func, "return _call_(_func_, %(shortsignature)s)",
        evaldict, __wrapped__=func)
    if hasattr(func, '__qualname__'):
        fun.__qualname__ = func.__qualname__
    return fun
1324310
def scoped_session_decorator(func):
    """"""

    @wraps(func)
    def wrapper(*args, **kwargs):
        with sessions_scope(session):
            # The session used in func comes from the funcs globals, but
            # it will be a proxied thread local var from the session
            # registry, and will therefore be identical to the one returned
            # by the context manager above.
            logger.debug("Running worker %s in scoped DB session", func.__name__)
            return func(*args, **kwargs)

    return wrapper
580308
def new_scope(names)
      values = names.collect { |n| self[n] }
      self.class.new(names, values, self)
    end
811106
public static Object callName0(String name,
                                   Context cx, Scriptable scope)
    {
        Callable f = getNameFunctionAndThis(name, cx, scope);
        Scriptable thisObj = lastStoredScriptable(cx);
        return f.call(cx, scope, thisObj, ScriptRuntime.emptyArgs);
    }
864884
def makeref2namesdct(name2refdct):
    """"""
    ref2namesdct = {}
    for key, values in name2refdct.items():
        for value in values:
            ref2namesdct.setdefault(value, set()).add(key)
    return ref2namesdct
854340
def _get_on_name(self, func):
        """"""
        r = re.match("^on_(.+)$", func.__name__)
        if r:
            event = r.group(1)
        else:
            raise ValueError("The function name should be "
                             "`on_<eventname>`().")
        return event
723913
def infer_name(self, context=None):
    """"""
    frame, stmts = self.lookup(self.name)
    if not stmts:
        # Try to see if the name is enclosed in a nested function
        # and use the higher (first function) scope for searching.
        parent_function = _higher_function_scope(self.scope())
        if parent_function:
            _, stmts = parent_function.lookup(self.name)

        if not stmts:
            raise exceptions.NameInferenceError(
                name=self.name, scope=self.scope(), context=context
            )
    context = contextmod.copy_context(context)
    context.lookupname = self.name
    return bases._infer_stmts(stmts, context, frame)
865259
def with_name(self, name):
    """"""
    with self.g.as_default(), scopes.var_and_name_scope((name, None)) as (
        name_scope, var_scope):
      return Layer(copy=self, name=self._name, scope=(name_scope, var_scope))
1302023
function deanonymize(o, name) {
    name = name || 'named';
    var keys;
    if (o) {
        keys = Object.keys(o);
        keys.forEach(function (key) {
            if (typeof o[key] === 'function') {
                o[key][name] = key;
            }
        });
    }
    return keys || [];
}
25167
function getName(func) {
  if (!util.isFunction(func)) {
    return;
  }
  if (functionsHaveNames) {
    return func.name;
  }
  var str = func.toString();
  var match = str.match(regex);
  return match && match[1];
}
633596
def _create_scope(self):
        
        res = Scope(self._log)

        for func_name,native_func in six.iteritems(self._natives):
            res.add_local(func_name, native_func)

        return res
770807
def extension(names):
    """"""
    for name in names:
        if not NAME_PATTERN.match(name):
            raise ValueError('invalid extension name: %s' % name)
    def decorator(f, names=names):
        return Extension(f, names=names)
    return decorator