All Samples(323) | Call(283) | Derive(0) | Import(40)
Extract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line number, function name, text), and the entries are in order from oldest to newest stack frame.
def extract_stack(f=None, limit = None):
"""Extract the raw traceback from the current stack frame.
The return value has the same format as for extract_tb(). The
optional 'f' and 'limit' arguments have the same meaning as for
print_stack(). Each item in the list is a quadruple (filename,
line number, function name, text), and the entries are in order
from oldest to newest stack frame.
"""
if f is None:
try:
raise ZeroDivisionError
except ZeroDivisionError:
f = sys.exc_info()[2].tb_frame.f_back
if limit is None:
if hasattr(sys, 'tracebacklimit'):
limit = sys.tracebacklimit
list = []
n = 0
while f is not None and (limit is None or n < limit):
lineno = f.f_lineno
co = f.f_code
filename = co.co_filename
name = co.co_name
linecache.checkcache(filename)
line = linecache.getline(filename, lineno, f.f_globals)
if line: line = line.strip()
else: line = None
list.append((filename, lineno, name, line))
f = f.f_back
n = n+1
list.reverse()
return list
def debug(*args):
import logging
import traceback
tb = traceback.extract_stack(limit=2)
call_line = "%s:%d (%s)" % tb[0][0:3]
logging.debug("%s\n%r\n" % (call_line, args))
src/p/y/python-cookbook-HEAD/cb2_examples/cb2_8_5_sol_1.py python-cookbook(Download)
def watch(variableName):
if __debug__:
stack = traceback.extract_stack()[-2:][0]
actualCall = stack[3]
if actualCall is None:
actualCall = "watch([unknown])"
left = actualCall.find('(')
def trace(text):
if __debug__:
stack = traceback.extract_stack()[-2:][0]
paramDict = dict(text=text,
methodName=stack[2],
lineNumber=stack[1],
fileName=stack[0])
src/d/b/dbcook-HEAD/reporter/engine/util/dbg.py dbcook(Download)
def dbg_funcname( i=2, with_filename =False):
import traceback
filename, linenumber, functionname, text = traceback.extract_stack()[-i]
if with_filename: return functionname, filename
return functionname
def dbg_funcstack( start=2, depth=3, dlm=''):
import traceback
return dlm.join( traceback.format_list( traceback.extract_stack( limit=start+depth+1)[-start-depth+1:-start+1] ))
src/a/u/audiere-HEAD/trunk/audiere/third-party/scons-local-1.2.0/SCons/Debug.py audiere(Download)
def caller_stack(*backlist):
import traceback
if not backlist:
backlist = [0]
result = []
for back in backlist:
tb = traceback.extract_stack(limit=3+back)
def caller_trace(back=0):
import traceback
tb = traceback.extract_stack(limit=3+back)
tb.reverse()
callee = tb[1][:3]
caller_bases[callee] = caller_bases.get(callee, 0) + 1
for caller in tb[2:]:
src/a/u/audiere-HEAD/audiere/third-party/scons-local-1.2.0/SCons/Debug.py audiere(Download)
def caller_stack(*backlist):
import traceback
if not backlist:
backlist = [0]
result = []
for back in backlist:
tb = traceback.extract_stack(limit=3+back)
def caller_trace(back=0):
import traceback
tb = traceback.extract_stack(limit=3+back)
tb.reverse()
callee = tb[1][:3]
caller_bases[callee] = caller_bases.get(callee, 0) + 1
for caller in tb[2:]:
src/n/u/numscons-0.10.1/numscons/scons-local/scons-local-1.2.0/SCons/Debug.py numscons(Download)
def caller_stack(*backlist):
import traceback
if not backlist:
backlist = [0]
result = []
for back in backlist:
tb = traceback.extract_stack(limit=3+back)
def caller_trace(back=0):
import traceback
tb = traceback.extract_stack(limit=3+back)
tb.reverse()
callee = tb[1][:3]
caller_bases[callee] = caller_bases.get(callee, 0) + 1
for caller in tb[2:]:
src/r/s/rsf-HEAD/scons/scons-2.0.1/engine/SCons/Debug.py rsf(Download)
def caller_stack(*backlist):
import traceback
if not backlist:
backlist = [0]
result = []
for back in backlist:
tb = traceback.extract_stack(limit=3+back)
def caller_trace(back=0):
import traceback
tb = traceback.extract_stack(limit=3+back)
tb.reverse()
callee = tb[1][:3]
caller_bases[callee] = caller_bases.get(callee, 0) + 1
for caller in tb[2:]:
src/p/y/PyMVPA-HEAD/mvpa/base/verbosity.py PyMVPA(Download)
def __call__(self):
ftb = traceback.extract_stack(limit=100)[:-2]
entries = [[mbasename(x[0]), str(x[1])] for x in ftb]
entries = [ e for e in entries if e[0] != 'unittest' ]
# lets make it more consize
entries_out = [entries[0]]
# determine blank offset using backstacktrace
if self._offsetbydepth:
level = len(traceback.extract_stack())-2
else:
level = 1
if len(msg)>250 and 'DBG' in self.active and not setid.endswith('_TB'):
tb = traceback.extract_stack(limit=2)
src/g/e/geraldo-HEAD/site/newsite/site-geraldo/django/utils/translation/__init__.py geraldo(Download)
import trans_real as trans
else:
import trans_null as trans
caller = traceback.extract_stack(limit=2)[0][2]
g = globals()
for name in __all__:
if hasattr(trans, name):
src/g/e/geraldo-HEAD/site/newsite/django_1_0/django/utils/translation/__init__.py geraldo(Download)
import trans_real as trans
else:
import trans_null as trans
caller = traceback.extract_stack(limit=2)[0][2]
g = globals()
for name in __all__:
if hasattr(trans, name):
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next