return the first func defined named name
495932
def func(self, name: str):
        """"""
        for f in self.body:
            if (hasattr(f, '_ctype')
                    and isinstance(f._ctype, FuncType)
                    and f._name == name):
                return f
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
653336
def getAttributeName(self, name):
        '''
        '''
        if self.func_aname is None:
            return name
        assert callable(self.func_aname), \
            'expecting callable method for attribute func_aname, not %s' %type(self.func_aname)
        f = self.func_aname
        return f(name)
668398
def get_name_init(self, name):
        
        self._register_name(name)

        return self._var_name_mappers[name].get_init()
648229
def get_callable_name(c):
    
    if hasattr(c, 'name'):
        return six.text_type(c.name)
    elif hasattr(c, '__name__'):
        return six.text_type(c.__name__) + u'()'
    else:
        return six.text_type(c)
442634
def get_func(fullFuncName):
    """"""

    # Parse out the path, module, and function
    lastDot = fullFuncName.rfind(u".")
    funcName = fullFuncName[lastDot + 1:]
    modPath = fullFuncName[:lastDot]

    aMod = get_mod(modPath)
    aFunc = getattr(aMod, funcName)

    # Assert that the function is a *callable* attribute.
    assert callable(aFunc), u"%s is not callable." % fullFuncName

    # Return a reference to the function itself,
    # not the results of the function.
    return aFunc
476707
def logging_decorator(func):
    """"""
    def you_will_never_see_this_name(*args, **kwargs):
        """Neither this docstring"""
        print('calling %s ...' % func.__name__)
        result = func(*args, **kwargs)
        print('completed: %s' % func.__name__)
        return result
    return you_will_never_see_this_name
531562
def varnames(func):
    
    cache = getattr(func, "__dict__", {})
    try:
        return cache["_varnames"]
    except KeyError:
        pass

    if inspect.isclass(func):
        try:
            func = func.__init__
        except AttributeError:
            return (), ()
    elif not inspect.isroutine(func):  # callable object?
        try:
            func = getattr(func, "__call__", func)
        except Exception:
            return ()

    try:  # func MUST be a function or method here or we won't parse any args
        spec = _getargspec(func)
    except TypeError:
        return (), ()

    args, defaults = tuple(spec.args), spec.defaults
    if defaults:
        index = -len(defaults)
        args, defaults = args[:index], tuple(args[index:])
    else:
        defaults = ()

    # strip any implicit instance arg
    # pypy3 uses "obj" instead of "self" for default dunder methods
    implicit_names = ("self",) if not _PYPY3 else ("self", "obj")
    if args:
        if inspect.ismethod(func) or (
            "." in getattr(func, "__qualname__", ()) and args[0] in implicit_names
        ):
            args = args[1:]

    try:
        cache["_varnames"] = args, defaults
    except TypeError:
        pass
    return args, defaults
565977
def param(name, help=""):
    """"""
    def decorator(func):
        params = getattr(func, "params", [])
        _param = Param(name, help)
        # Insert at the beginning so the apparent order is preserved
        params.insert(0, _param)
        func.params = params
        return func

    return decorator
28921
def callable_name(func: Callable) -> str:
    """"""
    if func.__module__ == 'builtins':
        return func.__name__
    else:
        return '{}.{}'.format(func.__module__, func.__qualname__)
915995
def get_first(self):
		""""""
		try: # Nested try..except because of Python 2.4
			self.lock.acquire()
			try:
				return self.get(self.data_idx[0])
			except (IndexError, ValueError):
				return "NONE"
		finally:
			self.lock.release()
716562
function getNameOfType(x) {
  switch (false) {
    case !(x == null):
      return `${x}`; // null / undefined
    case !is.String(x):
      return x;
    case !is.Function(x):
      return x.name;
    case !is.NaN(x):
      return 'NaN';
    default:
      return x;
  }
}
987818
def named_config(self, func):
        
        config_scope = ConfigScope(func)
        self._add_named_config(func.__name__, config_scope)
        return config_scope
453533
def get_name(self, seq=None):
        """"""
        if seq is not None:
            it = iter(seq)

            def get_next_token():
                return next(it)
        else:
            get_next_token = self._get_next_token

        next_token = get_next_token()
        tokens = []
        last_token_was_name = False
        while (next_token.token_type == tokenize.NAME or
               (next_token.token_type == tokenize.SYNTAX and
                next_token.name in ('::', '<'))):
            # Two NAMEs in a row means the identifier should terminate.
            # It's probably some sort of variable declaration.
            if last_token_was_name and next_token.token_type == tokenize.NAME:
                break
            last_token_was_name = next_token.token_type == tokenize.NAME
            tokens.append(next_token)
            # Handle templated names.
            if next_token.name == '<':
                tokens.extend(self._get_matching_char('<', '>',
                                                      get_next_token))
                last_token_was_name = True
            next_token = get_next_token()
        return tokens, next_token
570517
def get_func_posargs_name(f):
    """"""
    sigparams = inspect.signature(f).parameters
    for p in sigparams:
        if sigparams[p].kind == inspect.Parameter.VAR_POSITIONAL:
            return sigparams[p].name
    return None
756701
def first_invoke(func1, func2):
	
	def wrapper(*args, **kwargs):
		func1()
		return func2(*args, **kwargs)
	return wrapper
833730
def copy_func(f, name=None):
    """"""
    '''
    return a function with same code, globals, defaults, closure, and 
    name (or provide a new name)
    '''
    fn = types.FunctionType(f.__code__, f.__globals__, name or f.__name__,
                            f.__defaults__, f.__closure__)
    # in case f was given attrs (note this dict is a shallow copy):
    fn.__dict__.update(f.__dict__)
    return fn