def file_module_function_of(self, frame): #this code is take from trace module and fixed to work with new-style classes
        code = frame.f_code
        filename = code.co_filename
        if filename:
            modulename = trace.modname(filename)
        else:
            modulename = None

        funcname = code.co_name
        clsname = None
        if code in self._caller_cache:
            if self._caller_cache[code] is not None:
                clsname = self._caller_cache[code]
        else:
            self._caller_cache[code] = None
            clsname = get_clsname_for_code(code, frame)
            if clsname is not None:
                # cache the result - assumption is that new.* is
                # not called later to disturb this relationship
                # _caller_cache could be flushed if functions in
                # the new module get called.
                self._caller_cache[code] = clsname

        if clsname is not None:
            funcname = "%s.%s" % (clsname, funcname)

        return filename, modulename, funcname
Exemple #2
0
    def file_module_function_of(
        self, frame
    ):  #this code is take from trace module and fixed to work with new-style classes
        code = frame.f_code
        filename = code.co_filename
        if filename:
            modulename = _modname(filename)
        else:
            modulename = None

        funcname = code.co_name
        clsname = None
        if code in self._caller_cache:
            if self._caller_cache[code] is not None:
                clsname = self._caller_cache[code]
        else:
            self._caller_cache[code] = None
            clsname = get_clsname_for_code(code, frame)
            if clsname is not None:
                # cache the result - assumption is that new.* is
                # not called later to disturb this relationship
                # _caller_cache could be flushed if functions in
                # the new module get called.
                self._caller_cache[code] = clsname

        if clsname is not None:
            funcname = "%s.%s" % (clsname, funcname)

        return filename, modulename, funcname
Exemple #3
0
 def get_func_name(frame):
     code_obj = frame.f_code
     func_name = code_obj.co_name
     try:
         cls_name = get_clsname_for_code(code_obj, frame)
         if cls_name is not None:
             return "%s.%s" % (cls_name, func_name)
         else:
             return func_name
     except:
         traceback.print_exc()
         return func_name
Exemple #4
0
 def get_func_name(self, frame):
     code_obj = frame.f_code
     func_name = code_obj.co_name
     try:
         cls_name = get_clsname_for_code(code_obj, frame)
         if cls_name is not None:
             return "%s.%s" % (cls_name, func_name)
         else:
             return func_name
     except:
         pydev_log.exception()
         return func_name
Exemple #5
0
 def get_func_name(self, frame):
     code_obj = frame.f_code
     func_name = code_obj.co_name
     try:
         cls_name = get_clsname_for_code(code_obj, frame)
         if cls_name is not None:
             return "%s.%s" % (cls_name, func_name)
         else:
             return func_name
     except:
         traceback.print_exc()
         return func_name
 def get_func_name(self, frame):
     code_obj = frame.f_code
     func_name = code_obj.co_name
     try:
         cls_name = get_clsname_for_code(code_obj, frame)
         if cls_name is not None:
             return "%s.%s" % (cls_name, func_name)
         else:
             return func_name
     except:
         pydev_log.exception()
         return func_name