This will return the path to the calling function
    :param func:
    :return:
973560
def function_path(func):
    
    if getattr(func, 'func_code', None):
        return func.__code__.co_filename.replace('\\', '/')
    else:
        return func.__code__.co_filename.replace('\\', '/')
863773
def function_arguments(func):
    
    if getattr(inspect, 'signature', None) is None:
        return list(inspect.getargspec(func).args)
    else:
        return list(inspect.signature(func).parameters.keys())
728641
public Function getFunction(String iface, String func) throws RpcException {
        Interface i = interfaces.get(iface);
        if (i == null) {
            String msg = "Interface '" + iface + "' not found";
            throw RpcException.Error.METHOD_NOT_FOUND.exc(msg);
        }

        Function f = i.getFunction(func);
        if (f == null) {
            String msg = "Function '" + iface + "." + func + "' not found";
            throw RpcException.Error.METHOD_NOT_FOUND.exc(msg);
        }

        return f;
    }
391990
def _get_method(name, func):
    ""
    def method(self, *args, **kw):
        return func(self, *args, **kw)
    method.__name__ = name
    return method
973056
def func_call(self, t):
        
        func, params = t
        func_name = func.value
        func.value = "({}({}))".format(func_name, params)
        return func
206195
def function_defaults(func):
    
    if getattr(inspect, 'signature',None) is None:
        return inspect.getargspec(func)[-1] or []
    else:
        return [v.default for k,v in list(
            inspect.signature(func).parameters.items())
                if v.default is not inspect._empty]
1160919
def wrap_as_node(self, func):
        ''
        name = self.get_name(func)

        @wraps(func)
        def wrapped(*args, **kwargs):
            'wrapped version of func'
            message = self.get_message_from_call(*args, **kwargs)
            self.logger.info('calling "%s" with %r', name, message)
            result = func(message)

            # functions can return multiple values ("emit" multiple times)
            # by yielding instead of returning. Handle this case by making
            # a list of the results and processing them all after the
            # generator successfully exits. If we were to process them as
            # they came out of the generator, we might get a partially
            # processed input sent down the graph. This may be possible in
            # the future via a flag.
            if isinstance(result, GeneratorType):
                results = [
                    self.wrap_result(name, item)
                    for item in result
                    if item is not NoResult
                ]
                self.logger.debug(
                    '%s returned generator yielding %d items', func, len(results)
                )

                [self.route(name, item) for item in results]
                return tuple(results)

            # the case of a direct return is simpler. wrap, route, and
            # return the value.
            else:
                if result is NoResult:
                    return result

                result = self.wrap_result(name, result)
                self.logger.debug(
                    '%s returned single value %s', func, result
                )
                self.route(name, result)
                return result

        return wrapped
867104
def source_path(self):
        
        # Need to do this to ensure the function produces the
        # bundle path when called from subclasses
        names = [k for k, _, _ in self._name_parts]

        parts = [self.source]

        if self.bspace:
            parts.append(self.bspace)

        parts.append(
            self._path_join(names=names, excludes=['source', 'version', 'bspace'], sep=self.NAME_PART_SEP))

        return os.path.join(*parts)
145262
def _func(self) -> typing.Optional[typing.Callable[..., typing.Union["typing.Awaitable[typing.Any]", typing.Any]]]:
        
        return self.__func
175257
def map(self, func: Callable[[T], U]) -> 'TOption[T]':
        
        return self if self.is_none() else TOption(func(self.value))
108826
function getFunctionName(func) {
        if (func.name !== void(0)) {
            return func.name;
        }
        // Else use IE Shim
        var funcNameMatch = func.toString()
            .match(/function\s*([^\s]*)\s*\(/);
        func.name = (funcNameMatch && funcNameMatch[1]) || '';
        return func.name;
    }
79692
def require_remote_ref_path(func):
    """"""

    def wrapper(self, *args):
        if not self.is_remote():
            raise ValueError("ref path does not point to a remote reference: %s" % self.path)
        return func(self, *args)
    # END wrapper
    wrapper.__name__ = func.__name__
    return wrapper
624607
def cmd_func(self, command: str) -> Optional[Callable]:
        
        func_name = self.cmd_func_name(command)
        if func_name:
            return getattr(self, func_name)
70438
def getargspecs(func):
    
    if func is None:
        raise TypeError('None is not a Python function')
    if hasattr(func, 'ch_func'):
        return getargspecs(func.ch_func)
    elif hasattr(func, 'ov_func'):
        return getargspecs(func.ov_func)
    if hasattr(inspect, 'getfullargspec'):
        return inspect.getfullargspec(func) # Python 3
    else:
        return inspect.getargspec(func)
871637
def call(self, func, *args, **kwargs):
        
        wrapped = self.wrap(func)
        return wrapped(*args, **kwargs)
136242
def find(self, func: Callable[[K, T], bool]) -> TOption[T]:
        
        for k, v in self.items():
            if func(k, v):
                return TOption(v)
        return TOption(None)
1175630
def profile(func):
    
    @inlineCallbacks
    def callme(*args, **kwargs):
        start = time.time()
        ret = yield func(*args, **kwargs)
        time_to_execute = time.time() - start
        log.msg('%s executed in %.3f seconds' % (func.__name__, time_to_execute))
        returnValue(ret)
    return callme