/opt/alt/python33/lib64/python3.3
NameSizeModeActions
collections/-0755rm
concurrent/-0755rm
config-3.3m/-0755rm
ctypes/-0755rm
curses/-0755rm
dbm/-0755rm
distutils/-0755rm
email/-0755rm
encodings/-0755rm
html/-0755rm
http/-0755rm
idlelib/-0755rm
importlib/-0755rm
json/-0755rm
lib-dynload/-0755rm
lib2to3/-0755rm
logging/-0755rm
multiprocessing/-0755rm
plat-linux/-0755rm
pydoc_data/-0755rm
site-packages/-0755rm
sqlite3/-0755rm
test/-0755rm
unittest/-0755rm
urllib/-0755rm
venv/-0755rm
wsgiref/-0755rm
xml/-0755rm
xmlrpc/-0755rm
__pycache__/-0755rm
abc.py80570644editdlrm
aifc.py310540644editdlrm
antigravity.py4750644editdlrm
argparse.py890690644editdlrm
ast.py121420644editdlrm
asynchat.py115880644editdlrm
asyncore.py207530644editdlrm
base64.py139860755editdlrm
bdb.py218940644editdlrm
binhex.py137080644editdlrm
bisect.py25950644editdlrm
bz2.py184730644editdlrm
calendar.py229400644editdlrm
cgi.py355540755editdlrm
cgitb.py120410644editdlrm
chunk.py53770644editdlrm
cmd.py148600644editdlrm
code.py100300644editdlrm
codecs.py359560644editdlrm
codeop.py59940644editdlrm
colorsys.py36910644editdlrm
compileall.py97430644editdlrm
configparser.py494370644editdlrm
contextlib.py91250644editdlrm
copy.py89910644editdlrm
copyreg.py66110644editdlrm
cProfile.py63610755editdlrm
crypt.py18790644editdlrm
csv.py161850644editdlrm
datetime.py749540644editdlrm
decimal.py2285580644editdlrm
difflib.py825190644editdlrm
dis.py101340644editdlrm
doctest.py1029330644editdlrm
dummy_threading.py28150644editdlrm
filecmp.py95970644editdlrm
fileinput.py142560644editdlrm
fnmatch.py31630644editdlrm
formatter.py149300644editdlrm
fractions.py230330644editdlrm
ftplib.py402530644editdlrm
functools.py135960644editdlrm
genericpath.py30930644editdlrm
getopt.py74880644editdlrm
getpass.py57930644editdlrm
gettext.py206370644editdlrm
glob.py28380644editdlrm
gzip.py244030644editdlrm
hashlib.py61930644editdlrm
heapq.py179970644editdlrm
hmac.py44400644editdlrm
imaplib.py501110644editdlrm
imghdr.py35280644editdlrm
imp.py97270644editdlrm
inspect.py789600644editdlrm
io.py32800644editdlrm
ipaddress.py703030644editdlrm
keyword.py20600755editdlrm
linecache.py38640644editdlrm
locale.py932150644editdlrm
lzma.py174540644editdlrm
macpath.py56170644editdlrm
macurl2path.py27320644editdlrm
mailbox.py790930644editdlrm
mailcap.py74370644editdlrm
mimetypes.py207350644editdlrm
modulefinder.py231980644editdlrm
netrc.py57470644editdlrm
nntplib.py427860644editdlrm
ntpath.py204370644editdlrm
nturl2path.py23960644editdlrm
numbers.py103980644editdlrm
opcode.py50980644editdlrm
optparse.py603460644editdlrm
os.py347790644editdlrm
os2emxpath.py46590644editdlrm
pdb.py606530755editdlrm
pickle.py478580644editdlrm
pickletools.py813490644editdlrm
pipes.py89160644editdlrm
pkgutil.py215390644editdlrm
platform.py507420755editdlrm
plistlib.py147770644editdlrm
poplib.py113720644editdlrm
posixpath.py142540644editdlrm
pprint.py127000644editdlrm
profile.py214480755editdlrm
pstats.py263720644editdlrm
pty.py50550644editdlrm
pyclbr.py134380644editdlrm
pydoc.py1016440755editdlrm
py_compile.py67170644editdlrm
queue.py88350644editdlrm
quopri.py73150755editdlrm
random.py256600644editdlrm
re.py149730644editdlrm
reprlib.py51100644editdlrm
rlcompleter.py55260644editdlrm
runpy.py104130644editdlrm
sched.py63990644editdlrm
shelve.py82430644editdlrm
shlex.py115020644editdlrm
shutil.py391470644editdlrm
site.py219710644editdlrm
smtpd.py302070755editdlrm
smtplib.py380210755editdlrm
sndhdr.py62190644editdlrm
socket.py149130644editdlrm
socketserver.py241960644editdlrm
sre_compile.py163450644editdlrm
sre_constants.py72310644editdlrm
sre_parse.py302120644editdlrm
ssl.py244780644editdlrm
stat.py43040644editdlrm
string.py94100644editdlrm
stringprep.py129170644editdlrm
struct.py2380644editdlrm
subprocess.py675780644editdlrm
sunau.py175230644editdlrm
symbol.py20510755editdlrm
symtable.py73830644editdlrm
sysconfig.py251740644editdlrm
tabnanny.py114100755editdlrm
tarfile.py888640755editdlrm
telnetlib.py273490644editdlrm
tempfile.py230130644editdlrm
textwrap.py164880644editdlrm
this.py10030644editdlrm
threading.py456410644editdlrm
timeit.py123950755editdlrm
token.py30340644editdlrm
tokenize.py248760644editdlrm
trace.py314870755editdlrm
traceback.py119820644editdlrm
tty.py8790644editdlrm
types.py31670644editdlrm
uu.py67660755editdlrm
uuid.py223490644editdlrm
warnings.py138250644editdlrm
wave.py185790644editdlrm
weakref.py114950644editdlrm
webbrowser.py229130755editdlrm
xdrlib.py53810644editdlrm
zipfile.py664240644editdlrm
_compat_pickle.py43380644editdlrm
_dummy_thread.py47690644editdlrm
_markupbase.py145980644editdlrm
_osx_support.py188550644editdlrm
_pyio.py729050644editdlrm
_strptime.py216740644editdlrm
_sysconfigdata.py210560644editdlrm
_threading_local.py74100644editdlrm
_weakrefset.py57050644editdlrm
__future__.py45840644editdlrm
__phello__.foo.py640644editdlrm
Edit: /opt/alt/python33/lib64/python3.3/traceback.py (11982B)
"""Extract, format and print information about Python stack traces.""" import linecache import sys __all__ = ['extract_stack', 'extract_tb', 'format_exception', 'format_exception_only', 'format_list', 'format_stack', 'format_tb', 'print_exc', 'format_exc', 'print_exception', 'print_last', 'print_stack', 'print_tb'] def _print(file, str='', terminator='\n'): file.write(str+terminator) def print_list(extracted_list, file=None): """Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.""" if file is None: file = sys.stderr for filename, lineno, name, line in extracted_list: _print(file, ' File "%s", line %d, in %s' % (filename,lineno,name)) if line: _print(file, ' %s' % line.strip()) def format_list(extracted_list): """Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; the strings may contain internal newlines as well, for those items whose source text line is not None. """ list = [] for filename, lineno, name, line in extracted_list: item = ' File "%s", line %d, in %s\n' % (filename,lineno,name) if line: item = item + ' %s\n' % line.strip() list.append(item) return list def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. """ if file is None: file = sys.stderr if limit is None: if hasattr(sys, 'tracebacklimit'): limit = sys.tracebacklimit n = 0 while tb is not None and (limit is None or n < limit): f = tb.tb_frame lineno = tb.tb_lineno co = f.f_code filename = co.co_filename name = co.co_name _print(file, ' File "%s", line %d, in %s' % (filename, lineno, name)) linecache.checkcache(filename) line = linecache.getline(filename, lineno, f.f_globals) if line: _print(file, ' ' + line.strip()) tb = tb.tb_next n = n+1 def format_tb(tb, limit=None): """A shorthand for 'format_list(extract_tb(tb, limit))'.""" return format_list(extract_tb(tb, limit)) def extract_tb(tb, limit=None): """Return list of up to limit pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a quadruple (filename, line number, function name, text) representing the information that is usually printed for a stack trace. The text is a string with leading and trailing whitespace stripped; if the source is not available it is None. """ if limit is None: if hasattr(sys, 'tracebacklimit'): limit = sys.tracebacklimit list = [] n = 0 while tb is not None and (limit is None or n < limit): f = tb.tb_frame lineno = tb.tb_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)) tb = tb.tb_next n = n+1 return list _cause_message = ( "\nThe above exception was the direct cause " "of the following exception:\n") _context_message = ( "\nDuring handling of the above exception, " "another exception occurred:\n") def _iter_chain(exc, custom_tb=None, seen=None): if seen is None: seen = set() seen.add(exc) its = [] context = exc.__context__ cause = exc.__cause__ if cause is not None and cause not in seen: its.append(_iter_chain(cause, False, seen)) its.append([(_cause_message, None)]) elif (context is not None and not exc.__suppress_context__ and context not in seen): its.append(_iter_chain(context, None, seen)) its.append([(_context_message, None)]) its.append([(exc, custom_tb or exc.__traceback__)]) # itertools.chain is in an extension module and may be unavailable for it in its: for x in it: yield x def print_exception(etype, value, tb, limit=None, file=None, chain=True): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if type is SyntaxError and value has the appropriate format, it prints the line where the syntax error occurred with a caret on the next line indicating the approximate position of the error. """ if file is None: file = sys.stderr if chain: values = _iter_chain(value, tb) else: values = [(value, tb)] for value, tb in values: if isinstance(value, str): _print(file, value) continue if tb: _print(file, 'Traceback (most recent call last):') print_tb(tb, limit, file) lines = format_exception_only(type(value), value) for line in lines: _print(file, line, '') def format_exception(etype, value, tb, limit=None, chain=True): """Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does print_exception(). """ list = [] if chain: values = _iter_chain(value, tb) else: values = [(value, tb)] for value, tb in values: if isinstance(value, str): list.append(value + '\n') continue if tb: list.append('Traceback (most recent call last):\n') list.extend(format_tb(tb, limit)) list.extend(format_exception_only(type(value), value)) return list def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is always the last string in the list. """ # Gracefully handle (the way Python 2.4 and earlier did) the case of # being called with (None, None). if etype is None: return [_format_final_exc_line(etype, value)] stype = etype.__name__ smod = etype.__module__ if smod not in ("__main__", "builtins"): stype = smod + '.' + stype if not issubclass(etype, SyntaxError): return [_format_final_exc_line(stype, value)] # It was a syntax error; show exactly where the problem was found. lines = [] filename = value.filename or "" lineno = str(value.lineno) or '?' lines.append(' File "%s", line %s\n' % (filename, lineno)) badline = value.text offset = value.offset if badline is not None: lines.append(' %s\n' % badline.strip()) if offset is not None: caretspace = badline.rstrip('\n') offset = min(len(caretspace), offset) - 1 caretspace = caretspace[:offset].lstrip() # non-space whitespace (likes tabs) must be kept for alignment caretspace = ((c.isspace() and c or ' ') for c in caretspace) lines.append(' %s^\n' % ''.join(caretspace)) msg = value.msg or "" lines.append("%s: %s\n" % (stype, msg)) return lines def _format_final_exc_line(etype, value): valuestr = _some_str(value) if value is None or not valuestr: line = "%s\n" % etype else: line = "%s: %s\n" % (etype, valuestr) return line def _some_str(value): try: return str(value) except: return '' % type(value).__name__ def print_exc(limit=None, file=None, chain=True): """Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.""" if file is None: file = sys.stderr try: etype, value, tb = sys.exc_info() print_exception(etype, value, tb, limit, file, chain) finally: etype = value = tb = None def format_exc(limit=None, chain=True): """Like print_exc() but return a string.""" try: etype, value, tb = sys.exc_info() return ''.join( format_exception(etype, value, tb, limit, chain)) finally: etype = value = tb = None def print_last(limit=None, file=None, chain=True): """This is a shorthand for 'print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file)'.""" if not hasattr(sys, "last_type"): raise ValueError("no last exception") if file is None: file = sys.stderr print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file, chain) def print_stack(f=None, limit=None, file=None): """Print a stack trace from its invocation point. The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception(). """ if f is None: try: raise ZeroDivisionError except ZeroDivisionError: f = sys.exc_info()[2].tb_frame.f_back print_list(extract_stack(f, limit), file) def format_stack(f=None, limit=None): """Shorthand for 'format_list(extract_stack(f, limit))'.""" if f is None: try: raise ZeroDivisionError except ZeroDivisionError: f = sys.exc_info()[2].tb_frame.f_back return format_list(extract_stack(f, limit)) 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