home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / inspect.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  20.8 KB  |  738 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. __author__ = 'Ka-Ping Yee <ping@lfw.org>'
  5. __date__ = '1 Jan 2001'
  6. import sys
  7. import os
  8. import types
  9. import string
  10. import re
  11. import dis
  12. import imp
  13. import tokenize
  14. import linecache
  15. from operator import attrgetter
  16. from collections import namedtuple
  17. (CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS) = (1, 2, 4, 8)
  18. (CO_NESTED, CO_GENERATOR, CO_NOFREE) = (16, 32, 64)
  19. TPFLAGS_IS_ABSTRACT = 1048576
  20.  
  21. def ismodule(object):
  22.     return isinstance(object, types.ModuleType)
  23.  
  24.  
  25. def isclass(object):
  26.     if not isinstance(object, types.ClassType):
  27.         pass
  28.     return hasattr(object, '__bases__')
  29.  
  30.  
  31. def ismethod(object):
  32.     return isinstance(object, types.MethodType)
  33.  
  34.  
  35. def ismethoddescriptor(object):
  36.     if hasattr(object, '__get__') and not hasattr(object, '__set__') and not ismethod(object) and not isfunction(object):
  37.         pass
  38.     return not isclass(object)
  39.  
  40.  
  41. def isdatadescriptor(object):
  42.     if hasattr(object, '__set__'):
  43.         pass
  44.     return hasattr(object, '__get__')
  45.  
  46. if hasattr(types, 'MemberDescriptorType'):
  47.     
  48.     def ismemberdescriptor(object):
  49.         return isinstance(object, types.MemberDescriptorType)
  50.  
  51. else:
  52.     
  53.     def ismemberdescriptor(object):
  54.         return False
  55.  
  56. if hasattr(types, 'GetSetDescriptorType'):
  57.     
  58.     def isgetsetdescriptor(object):
  59.         return isinstance(object, types.GetSetDescriptorType)
  60.  
  61. else:
  62.     
  63.     def isgetsetdescriptor(object):
  64.         return False
  65.  
  66.  
  67. def isfunction(object):
  68.     return isinstance(object, types.FunctionType)
  69.  
  70.  
  71. def isgeneratorfunction(object):
  72.     if isfunction(object) or ismethod(object):
  73.         pass
  74.     return bool(object.func_code.co_flags & CO_GENERATOR)
  75.  
  76.  
  77. def isgenerator(object):
  78.     return isinstance(object, types.GeneratorType)
  79.  
  80.  
  81. def istraceback(object):
  82.     return isinstance(object, types.TracebackType)
  83.  
  84.  
  85. def isframe(object):
  86.     return isinstance(object, types.FrameType)
  87.  
  88.  
  89. def iscode(object):
  90.     return isinstance(object, types.CodeType)
  91.  
  92.  
  93. def isbuiltin(object):
  94.     return isinstance(object, types.BuiltinFunctionType)
  95.  
  96.  
  97. def isroutine(object):
  98.     if not isbuiltin(object) and isfunction(object) and ismethod(object):
  99.         pass
  100.     return ismethoddescriptor(object)
  101.  
  102.  
  103. def isgenerator(object):
  104.     return isinstance(object, types.GeneratorType)
  105.  
  106.  
  107. def isabstract(object):
  108.     if isinstance(object, type):
  109.         pass
  110.     return object.__flags__ & TPFLAGS_IS_ABSTRACT
  111.  
  112.  
  113. def getmembers(object, predicate = None):
  114.     results = []
  115.     for key in dir(object):
  116.         value = getattr(object, key)
  117.         if not predicate or predicate(value):
  118.             results.append((key, value))
  119.             continue
  120.     
  121.     results.sort()
  122.     return results
  123.  
  124. Attribute = namedtuple('Attribute', 'name kind defining_class object')
  125.  
  126. def classify_class_attrs(cls):
  127.     mro = getmro(cls)
  128.     names = dir(cls)
  129.     result = []
  130.     for name in names:
  131.         if name in cls.__dict__:
  132.             obj = cls.__dict__[name]
  133.         else:
  134.             obj = getattr(cls, name)
  135.         homecls = getattr(obj, '__objclass__', None)
  136.         if homecls is None:
  137.             for base in mro:
  138.                 if name in base.__dict__:
  139.                     homecls = base
  140.                     break
  141.                     continue
  142.             
  143.         
  144.         if homecls is not None and name in homecls.__dict__:
  145.             obj = homecls.__dict__[name]
  146.         
  147.         obj_via_getattr = getattr(cls, name)
  148.         if isinstance(obj, staticmethod):
  149.             kind = 'static method'
  150.         elif isinstance(obj, classmethod):
  151.             kind = 'class method'
  152.         elif isinstance(obj, property):
  153.             kind = 'property'
  154.         elif ismethod(obj_via_getattr) or ismethoddescriptor(obj_via_getattr):
  155.             kind = 'method'
  156.         else:
  157.             kind = 'data'
  158.         result.append(Attribute(name, kind, homecls, obj))
  159.     
  160.     return result
  161.  
  162.  
  163. def _searchbases(cls, accum):
  164.     if cls in accum:
  165.         return None
  166.     accum.append(cls)
  167.     for base in cls.__bases__:
  168.         _searchbases(base, accum)
  169.     
  170.  
  171.  
  172. def getmro(cls):
  173.     if hasattr(cls, '__mro__'):
  174.         return cls.__mro__
  175.     result = []
  176.     _searchbases(cls, result)
  177.     return tuple(result)
  178.  
  179.  
  180. def indentsize(line):
  181.     expline = string.expandtabs(line)
  182.     return len(expline) - len(string.lstrip(expline))
  183.  
  184.  
  185. def getdoc(object):
  186.     
  187.     try:
  188.         doc = object.__doc__
  189.     except AttributeError:
  190.         return None
  191.  
  192.     if not isinstance(doc, types.StringTypes):
  193.         return None
  194.     return cleandoc(doc)
  195.  
  196.  
  197. def cleandoc(doc):
  198.     
  199.     try:
  200.         lines = string.split(string.expandtabs(doc), '\n')
  201.     except UnicodeError:
  202.         return None
  203.  
  204.     margin = sys.maxint
  205.     for line in lines[1:]:
  206.         content = len(string.lstrip(line))
  207.         if content:
  208.             indent = len(line) - content
  209.             margin = min(margin, indent)
  210.             continue
  211.     
  212.     if lines:
  213.         lines[0] = lines[0].lstrip()
  214.     
  215.     if margin < sys.maxint:
  216.         for i in range(1, len(lines)):
  217.             lines[i] = lines[i][margin:]
  218.         
  219.     
  220.     while lines and not lines[-1]:
  221.         lines.pop()
  222.     while lines and not lines[0]:
  223.         lines.pop(0)
  224.     return string.join(lines, '\n')
  225.  
  226.  
  227. def getfile(object):
  228.     if ismodule(object):
  229.         if hasattr(object, '__file__'):
  230.             return object.__file__
  231.         raise TypeError('arg is a built-in module')
  232.     ismodule(object)
  233.     if isclass(object):
  234.         object = sys.modules.get(object.__module__)
  235.         if hasattr(object, '__file__'):
  236.             return object.__file__
  237.         raise TypeError('arg is a built-in class')
  238.     isclass(object)
  239.     if ismethod(object):
  240.         object = object.im_func
  241.     
  242.     if isfunction(object):
  243.         object = object.func_code
  244.     
  245.     if istraceback(object):
  246.         object = object.tb_frame
  247.     
  248.     if isframe(object):
  249.         object = object.f_code
  250.     
  251.     if iscode(object):
  252.         return object.co_filename
  253.     raise TypeError('arg is not a module, class, method, function, traceback, frame, or code object')
  254.  
  255. ModuleInfo = namedtuple('ModuleInfo', 'name suffix mode module_type')
  256.  
  257. def getmoduleinfo(path):
  258.     filename = os.path.basename(path)
  259.     suffixes = map((lambda info: (-len(info[0]), info[0], info[1], info[2])), imp.get_suffixes())
  260.     suffixes.sort()
  261.     for neglen, suffix, mode, mtype in suffixes:
  262.         if filename[neglen:] == suffix:
  263.             return ModuleInfo(filename[:neglen], suffix, mode, mtype)
  264.     
  265.  
  266.  
  267. def getmodulename(path):
  268.     info = getmoduleinfo(path)
  269.     if info:
  270.         return info[0]
  271.  
  272.  
  273. def getsourcefile(object):
  274.     filename = getfile(object)
  275.     if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
  276.         filename = filename[:-4] + '.py'
  277.     
  278.     for suffix, mode, kind in imp.get_suffixes():
  279.         if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix:
  280.             return None
  281.     
  282.     if os.path.exists(filename):
  283.         return filename
  284.     if hasattr(getmodule(object, filename), '__loader__'):
  285.         return filename
  286.  
  287.  
  288. def getabsfile(object, _filename = None):
  289.     if _filename is None:
  290.         if not getsourcefile(object):
  291.             pass
  292.         _filename = getfile(object)
  293.     
  294.     return os.path.normcase(os.path.abspath(_filename))
  295.  
  296. modulesbyfile = { }
  297. _filesbymodname = { }
  298.  
  299. def getmodule(object, _filename = None):
  300.     if ismodule(object):
  301.         return object
  302.     if hasattr(object, '__module__'):
  303.         return sys.modules.get(object.__module__)
  304.     if _filename is not None and _filename in modulesbyfile:
  305.         return sys.modules.get(modulesbyfile[_filename])
  306.     
  307.     try:
  308.         file = getabsfile(object, _filename)
  309.     except TypeError:
  310.         _filename in modulesbyfile
  311.         _filename in modulesbyfile
  312.         hasattr(object, '__module__')
  313.         return None
  314.         ismodule(object)
  315.  
  316.     if file in modulesbyfile:
  317.         return sys.modules.get(modulesbyfile[file])
  318.     for modname, module in sys.modules.items():
  319.         if ismodule(module) and hasattr(module, '__file__'):
  320.             f = module.__file__
  321.             _filesbymodname[modname] = f
  322.             f = getabsfile(module)
  323.             continue
  324.         modulesbyfile[f] = modulesbyfile[os.path.realpath(f)] = module.__name__
  325.     
  326.     if file in modulesbyfile:
  327.         return sys.modules.get(modulesbyfile[file])
  328.     main = sys.modules['__main__']
  329.     if not hasattr(object, '__name__'):
  330.         return None
  331.     builtin = sys.modules['__builtin__']
  332.  
  333.  
  334. def findsource(object):
  335.     if not getsourcefile(object):
  336.         pass
  337.     file = getfile(object)
  338.     module = getmodule(object, file)
  339.     if module:
  340.         lines = linecache.getlines(file, module.__dict__)
  341.     else:
  342.         lines = linecache.getlines(file)
  343.     if not lines:
  344.         raise IOError('could not get source code')
  345.     lines
  346.     if ismodule(object):
  347.         return (lines, 0)
  348.     if isclass(object):
  349.         name = object.__name__
  350.         pat = re.compile('^(\\s*)class\\s*' + name + '\\b')
  351.         candidates = []
  352.         for i in range(len(lines)):
  353.             match = pat.match(lines[i])
  354.             if match:
  355.                 if lines[i][0] == 'c':
  356.                     return (lines, i)
  357.                 candidates.append((match.group(1), i))
  358.                 continue
  359.             lines[i][0] == 'c'
  360.         
  361.         if candidates:
  362.             candidates.sort()
  363.             return (lines, candidates[0][1])
  364.         raise IOError('could not find class definition')
  365.     isclass(object)
  366.     if ismethod(object):
  367.         object = object.im_func
  368.     
  369.     if isfunction(object):
  370.         object = object.func_code
  371.     
  372.     if istraceback(object):
  373.         object = object.tb_frame
  374.     
  375.     if isframe(object):
  376.         object = object.f_code
  377.     
  378.     if iscode(object):
  379.         if not hasattr(object, 'co_firstlineno'):
  380.             raise IOError('could not find function definition')
  381.         hasattr(object, 'co_firstlineno')
  382.         lnum = object.co_firstlineno - 1
  383.         pat = re.compile('^(\\s*def\\s)|(.*(?<!\\w)lambda(:|\\s))|^(\\s*@)')
  384.         while lnum > 0:
  385.             if pat.match(lines[lnum]):
  386.                 break
  387.             
  388.             lnum = lnum - 1
  389.         return (lines, lnum)
  390.     raise IOError('could not find code object')
  391.  
  392.  
  393. def getcomments(object):
  394.     
  395.     try:
  396.         (lines, lnum) = findsource(object)
  397.     except (IOError, TypeError):
  398.         return None
  399.  
  400.     if ismodule(object):
  401.         start = 0
  402.         if lines and lines[0][:2] == '#!':
  403.             start = 1
  404.         
  405.         while start < len(lines) and string.strip(lines[start]) in ('', '#'):
  406.             start = start + 1
  407.         if start < len(lines) and lines[start][:1] == '#':
  408.             comments = []
  409.             end = start
  410.             while end < len(lines) and lines[end][:1] == '#':
  411.                 comments.append(string.expandtabs(lines[end]))
  412.                 end = end + 1
  413.             return string.join(comments, '')
  414.     elif lnum > 0:
  415.         indent = indentsize(lines[lnum])
  416.         end = lnum - 1
  417.         if end >= 0 and string.lstrip(lines[end])[:1] == '#' and indentsize(lines[end]) == indent:
  418.             comments = [
  419.                 string.lstrip(string.expandtabs(lines[end]))]
  420.             if end > 0:
  421.                 end = end - 1
  422.                 comment = string.lstrip(string.expandtabs(lines[end]))
  423.                 while comment[:1] == '#' and indentsize(lines[end]) == indent:
  424.                     comments[:0] = [
  425.                         comment]
  426.                     end = end - 1
  427.                     if end < 0:
  428.                         break
  429.                     
  430.                     comment = string.lstrip(string.expandtabs(lines[end]))
  431.             
  432.             while comments and string.strip(comments[0]) == '#':
  433.                 comments[:1] = []
  434.             while comments and string.strip(comments[-1]) == '#':
  435.                 comments[-1:] = []
  436.             return string.join(comments, '')
  437.     
  438.  
  439.  
  440. class EndOfBlock(Exception):
  441.     pass
  442.  
  443.  
  444. class BlockFinder:
  445.     
  446.     def __init__(self):
  447.         self.indent = 0
  448.         self.islambda = False
  449.         self.started = False
  450.         self.passline = False
  451.         self.last = 1
  452.  
  453.     
  454.     def tokeneater(self, type, token, srow_scol, erow_ecol, line):
  455.         (srow, scol) = srow_scol
  456.         (erow, ecol) = erow_ecol
  457.         if not self.started:
  458.             if token in ('def', 'class', 'lambda'):
  459.                 if token == 'lambda':
  460.                     self.islambda = True
  461.                 
  462.                 self.started = True
  463.             
  464.             self.passline = True
  465.         elif type == tokenize.NEWLINE:
  466.             self.passline = False
  467.             self.last = srow
  468.             if self.islambda:
  469.                 raise EndOfBlock
  470.             self.islambda
  471.         elif self.passline:
  472.             pass
  473.         elif type == tokenize.INDENT:
  474.             self.indent = self.indent + 1
  475.             self.passline = True
  476.         elif type == tokenize.DEDENT:
  477.             self.indent = self.indent - 1
  478.             if self.indent <= 0:
  479.                 raise EndOfBlock
  480.             self.indent <= 0
  481.         elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL):
  482.             raise EndOfBlock
  483.         
  484.  
  485.  
  486.  
  487. def getblock(lines):
  488.     blockfinder = BlockFinder()
  489.     
  490.     try:
  491.         tokenize.tokenize(iter(lines).next, blockfinder.tokeneater)
  492.     except (EndOfBlock, IndentationError):
  493.         pass
  494.  
  495.     return lines[:blockfinder.last]
  496.  
  497.  
  498. def getsourcelines(object):
  499.     (lines, lnum) = findsource(object)
  500.     if ismodule(object):
  501.         return (lines, 0)
  502.     return (getblock(lines[lnum:]), lnum + 1)
  503.  
  504.  
  505. def getsource(object):
  506.     (lines, lnum) = getsourcelines(object)
  507.     return string.join(lines, '')
  508.  
  509.  
  510. def walktree(classes, children, parent):
  511.     results = []
  512.     classes.sort(key = attrgetter('__module__', '__name__'))
  513.     for c in classes:
  514.         results.append((c, c.__bases__))
  515.         if c in children:
  516.             results.append(walktree(children[c], children, c))
  517.             continue
  518.     
  519.     return results
  520.  
  521.  
  522. def getclasstree(classes, unique = 0):
  523.     children = { }
  524.     roots = []
  525.     for c in classes:
  526.         if c.__bases__:
  527.             for parent in c.__bases__:
  528.                 if parent not in children:
  529.                     children[parent] = []
  530.                 
  531.                 children[parent].append(c)
  532.                 if unique and parent in classes:
  533.                     break
  534.                     continue
  535.             
  536.         if c not in roots:
  537.             roots.append(c)
  538.             continue
  539.     
  540.     for parent in children:
  541.         if parent not in classes:
  542.             roots.append(parent)
  543.             continue
  544.     
  545.     return walktree(roots, children, None)
  546.  
  547. Arguments = namedtuple('Arguments', 'args varargs keywords')
  548.  
  549. def getargs(co):
  550.     if not iscode(co):
  551.         raise TypeError('arg is not a code object')
  552.     iscode(co)
  553.     nargs = co.co_argcount
  554.     names = co.co_varnames
  555.     args = list(names[:nargs])
  556.     step = 0
  557.     for i in range(nargs):
  558.         if args[i][:1] in ('', '.'):
  559.             stack = []
  560.             remain = []
  561.             count = []
  562.             while step < len(co.co_code):
  563.                 op = ord(co.co_code[step])
  564.                 step = step + 1
  565.                 if op >= dis.HAVE_ARGUMENT:
  566.                     opname = dis.opname[op]
  567.                     value = ord(co.co_code[step]) + ord(co.co_code[step + 1]) * 256
  568.                     step = step + 2
  569.                     if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'):
  570.                         remain.append(value)
  571.                         count.append(value)
  572.                     elif opname == 'STORE_FAST':
  573.                         stack.append(names[value])
  574.                         if not remain:
  575.                             stack[0] = [
  576.                                 stack[0]]
  577.                             break
  578.                         else:
  579.                             remain[-1] = remain[-1] - 1
  580.                             while remain[-1] == 0:
  581.                                 remain.pop()
  582.                                 size = count.pop()
  583.                                 stack[-size:] = [
  584.                                     stack[-size:]]
  585.                                 if not remain:
  586.                                     break
  587.                                 
  588.                                 remain[-1] = remain[-1] - 1
  589.                             if not remain:
  590.                                 break
  591.                             
  592.                     
  593.                 opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE')
  594.             args[i] = stack[0]
  595.             continue
  596.     
  597.     varargs = None
  598.     if co.co_flags & CO_VARARGS:
  599.         varargs = co.co_varnames[nargs]
  600.         nargs = nargs + 1
  601.     
  602.     varkw = None
  603.     if co.co_flags & CO_VARKEYWORDS:
  604.         varkw = co.co_varnames[nargs]
  605.     
  606.     return Arguments(args, varargs, varkw)
  607.  
  608. ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults')
  609.  
  610. def getargspec(func):
  611.     if ismethod(func):
  612.         func = func.im_func
  613.     
  614.     if not isfunction(func):
  615.         raise TypeError('arg is not a Python function')
  616.     isfunction(func)
  617.     (args, varargs, varkw) = getargs(func.func_code)
  618.     return ArgSpec(args, varargs, varkw, func.func_defaults)
  619.  
  620. ArgInfo = namedtuple('ArgInfo', 'args varargs keywords locals')
  621.  
  622. def getargvalues(frame):
  623.     (args, varargs, varkw) = getargs(frame.f_code)
  624.     return ArgInfo(args, varargs, varkw, frame.f_locals)
  625.  
  626.  
  627. def joinseq(seq):
  628.     if len(seq) == 1:
  629.         return '(' + seq[0] + ',)'
  630.     return '(' + string.join(seq, ', ') + ')'
  631.  
  632.  
  633. def strseq(object, convert, join = joinseq):
  634.     if type(object) in (list, tuple):
  635.         return join(map((lambda o, c = convert, j = join: strseq(o, c, j)), object))
  636.     return convert(object)
  637.  
  638.  
  639. def formatargspec(args, varargs = None, varkw = None, defaults = None, formatarg = str, formatvarargs = (lambda name: '*' + name), formatvarkw = (lambda name: '**' + name), formatvalue = (lambda value: '=' + repr(value)), join = joinseq):
  640.     specs = []
  641.     if defaults:
  642.         firstdefault = len(args) - len(defaults)
  643.     
  644.     for i in range(len(args)):
  645.         spec = strseq(args[i], formatarg, join)
  646.         if defaults and i >= firstdefault:
  647.             spec = spec + formatvalue(defaults[i - firstdefault])
  648.         
  649.         specs.append(spec)
  650.     
  651.     if varargs is not None:
  652.         specs.append(formatvarargs(varargs))
  653.     
  654.     if varkw is not None:
  655.         specs.append(formatvarkw(varkw))
  656.     
  657.     return '(' + string.join(specs, ', ') + ')'
  658.  
  659.  
  660. def formatargvalues(args, varargs, varkw, locals, formatarg = str, formatvarargs = (lambda name: '*' + name), formatvarkw = (lambda name: '**' + name), formatvalue = (lambda value: '=' + repr(value)), join = joinseq):
  661.     
  662.     def convert(name, locals = locals, formatarg = formatarg, formatvalue = formatvalue):
  663.         return formatarg(name) + formatvalue(locals[name])
  664.  
  665.     specs = []
  666.     for i in range(len(args)):
  667.         specs.append(strseq(args[i], convert, join))
  668.     
  669.     if varargs:
  670.         specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
  671.     
  672.     if varkw:
  673.         specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
  674.     
  675.     return '(' + string.join(specs, ', ') + ')'
  676.  
  677. Traceback = namedtuple('Traceback', 'filename lineno function code_context index')
  678.  
  679. def getframeinfo(frame, context = 1):
  680.     if istraceback(frame):
  681.         lineno = frame.tb_lineno
  682.         frame = frame.tb_frame
  683.     else:
  684.         lineno = frame.f_lineno
  685.     if not isframe(frame):
  686.         raise TypeError('arg is not a frame or traceback object')
  687.     isframe(frame)
  688.     if not getsourcefile(frame):
  689.         pass
  690.     filename = getfile(frame)
  691.     if context > 0:
  692.         start = lineno - 1 - context // 2
  693.         
  694.         try:
  695.             (lines, lnum) = findsource(frame)
  696.         except IOError:
  697.             lines = None
  698.             index = None
  699.  
  700.         start = max(start, 1)
  701.         start = max(0, min(start, len(lines) - context))
  702.         lines = lines[start:start + context]
  703.         index = lineno - 1 - start
  704.     else:
  705.         lines = None
  706.         index = None
  707.     return Traceback(filename, lineno, frame.f_code.co_name, lines, index)
  708.  
  709.  
  710. def getlineno(frame):
  711.     return frame.f_lineno
  712.  
  713.  
  714. def getouterframes(frame, context = 1):
  715.     framelist = []
  716.     while frame:
  717.         framelist.append((frame,) + getframeinfo(frame, context))
  718.         frame = frame.f_back
  719.     return framelist
  720.  
  721.  
  722. def getinnerframes(tb, context = 1):
  723.     framelist = []
  724.     while tb:
  725.         framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
  726.         tb = tb.tb_next
  727.     return framelist
  728.  
  729. currentframe = sys._getframe
  730.  
  731. def stack(context = 1):
  732.     return getouterframes(sys._getframe(1), context)
  733.  
  734.  
  735. def trace(context = 1):
  736.     return getinnerframes(sys.exc_info()[2], context)
  737.  
  738.