home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- import sys
- import os
- import bootstrap
- if os.name == 'nt':
- import ctypes
- ctypes.OleDLL._func_restype_ = ctypes.c_void_p
-
- USE_PEAK = False
- if USE_PEAK:
- import peak
- peak.install()
-
-
- try:
- import svnrev
- svnrev.REVISION
- except Exception:
- sys.REVISION = 'dev'
-
- sys.REVISION = svnrev.REVISION
- sys.TAG = ''
-
- try:
- import devmode
- except Exception:
- sys.DEV = False
-
- sys.DEV = devmode.awesome
- sys.BRAND = None
- sepjoin = os.pathsep.join
- pathjoin = os.path.join
- lib_dir = pathjoin(os.path.dirname(sys.executable), 'lib')
- os.environ['PATH'] = sepjoin([
- os.environ['PATH'],
- lib_dir])
- if USE_PEAK:
-
- def __monkeypatch_wx__CallAfter(mod):
- print 'lololmonkeypatch'
- import wx
- wx.CallAfter = mod.CallAfterCombining
-
- __monkeypatch_wx__CallAfter = peak.whenImported('events')(__monkeypatch_wx__CallAfter)
-
- bootstrap.install_sentinel()
- sys.modules['psyco'] = None
- restricted_names = frozenset([
- 'password',
- 'secret',
- 'pass',
- 'passwd'])
- OMITTED = '<OMITTED>'
- VALUE_LENGTH_LIMIT = 360
-
- def formatexception(excinfo = None, lastframes = 8):
- import StringIO
- import traceback
- if excinfo is None:
- excinfo = sys.exc_info()
-
- s = StringIO.StringIO()
- tb = excinfo[2]
- stack = []
- if tb is not None:
- while True:
- if not tb.tb_next:
- break
-
- tb = tb.tb_next
- f = tb.tb_frame
- while f:
- stack.append(f)
- f = f.f_back
-
- stack.reverse()
- if len(stack) > lastframes:
- stack = stack[-lastframes:]
-
- print >>s, '\nVariables by last %d frames, innermost last' % (lastframes,)
- restricted_values = []
- for frame in stack:
- print >>s, ''
- print >>s, ' File "%s", line %d, in %s' % (frame.f_code.co_filename, frame.f_lineno, frame.f_code.co_name)
- for key, value in frame.f_locals.items():
- if type(value) == type(sys):
- continue
-
- if key == '__builtins__':
- continue
-
- for badthing in restricted_names:
- if badthing in key and value:
- restricted_values.append(value)
- value = OMITTED
- continue
-
- print >>s, '%15s = ' % (key,),
-
- try:
- if isinstance(value, type({ })) and value:
- valstring = []
- for _kk, _vv in sorted(value.items()):
- if _kk == '__builtins__':
- continue
-
- if (any,)((lambda .0: for x in .0:
- x in _kk)(restricted_names)) and _vv:
- valstring.append('%s=%r' % (_kk, OMITTED))
- restricted_values.append(_vv)
- continue
- valstring.append('%s=%r' % (_kk, _vv))
-
- valstring = ' '.join(valstring)[:VALUE_LENGTH_LIMIT]
- print >>s, valstring,
- else:
- print >>s, repr(value)[:VALUE_LENGTH_LIMIT]
- continue
- print >>s, '(Exception occurred printing value)'
- continue
-
-
-
- traceback.print_exception(*excinfo, **{
- 'file': s })
- retval = s.getvalue()
- if isinstance(retval, unicode):
- retval_str = retval.encode('utf-8', 'replace')
- else:
- retval_str = retval
- for value in restricted_values:
- if not value or value == OMITTED:
- continue
-
-
- try:
- value_type = type(value)
- if issubclass(value_type, basestring):
- if issubclass(value_type, unicode):
- value_str = value.encode('utf-8', 'replace')
- elif issubclass(value_type, str):
- value_str = value
-
- retval_str = retval_str.replace(value_str, OMITTED)
-
- retval_str = retval_str.replace(repr(value)[:VALUE_LENGTH_LIMIT], OMITTED)
- continue
- except UnicodeError:
- continue
- continue
-
-
-
- return retval
-
- import traceback
- traceback._old_print_exc = traceback.print_exc
- traceback._old_format_exc = traceback.format_exc
- COLORIZE_EXCEPTIONS = False
- SHOW_TRACEBACK_DIALOG = sys.DEV
-
- def get_exc_dialog():
- diag = getattr(sys, 'exc_dialog', None)
- if diag is not None:
- import wx
- if wx.IsDestroyed(diag):
- diag = None
-
-
- if diag is None:
- import gui.tracebackdialog as gui
- diag = sys.exc_dialog = gui.tracebackdialog.ErrorDialog()
-
- return diag
-
-
- def tb_pref_enabled():
- import common
- return common.pref('debug.traceback_dialog', default = True)
-
-
- def print_exc(limit = None, file = None):
- traceback.format_exc = traceback._old_format_exc()
-
- try:
- if file is None:
- file = sys.stderr
-
- formattedexc = formatexception()
- if SHOW_TRACEBACK_DIALOG and tb_pref_enabled():
-
- def show_dialog():
-
- try:
- diag = get_exc_dialog()
- diag.AppendText(formattedexc + '\n\n')
- if not diag.IsShown():
- diag.CenterOnScreen()
-
- diag.Show()
- except Exception:
- print sys.stderr, 'error showing exception dialog: %r' % e
-
-
- import wx
- if wx.App.IsMainLoopRunning():
- wx.CallAfter(show_dialog)
-
-
- if COLORIZE_EXCEPTIONS and file is sys.stderr:
- console = console
- import gui.native.win
- console.color('bold red').__enter__()
-
- try:
- file.write(formattedexc)
- finally:
- pass
-
- else:
- file.write(formattedexc)
- except:
- traceback._old_print_exc()
- finally:
- traceback.format_exc = formatexception
-
-
- traceback.print_exc = print_exc
-
- def format_exc():
- traceback.format_exc = traceback._old_print_exc()
-
- try:
- return formatexception()
- except:
- return traceback._old_format_exc()
- finally:
- traceback.format_exc = formatexception
-
-
- traceback.format_exc = formatexception
- print_exc_once_cache = set()
- import inspect
-
- def print_exc_once():
- import traceback
-
- try:
- frame = inspect.currentframe()
- filename = frame.f_back.f_code.co_filename
- line_number = frame.f_lineno
- key = (filename, line_number)
- except Exception:
- traceback.print_exc()
-
- if key not in print_exc_once_cache:
- traceback.print_exc()
- print_exc_once_cache.add(key)
-
-
- traceback.print_exc_once = print_exc_once
- if not sys.DEV and getattr(getattr(sys, 'opts', None), 'track_windowids', False):
- pass
- TRACK_WINDOW_ID_ALLOCATIONS = getattr(sys, 'TAG', None) == 'alpha'
- if TRACK_WINDOW_ID_ALLOCATIONS:
- import wx
- count_map = { }
- _original_NewId = wx.NewId
-
- def debug_NewId():
- global count_map
-
- try:
- loc = tuple(traceback.extract_stack()[-3:-1])
- new_count = count_map.get(loc, 0) + 1
- count_map[loc] = new_count
- if len(count_map) > 100:
- count_map = dict(sorted(count_map.iteritems(), key = (lambda item: item[1]), reverse = True)[:50])
- except Exception:
- print_exc()
-
- return _original_NewId()
-
- wx.NewId = debug_NewId
-
- def get_window_id_allocs():
- return count_map
-
-
-
- def eh(*args):
-
- try:
- print >>sys.stderr, formatexception(args)
- except:
- print >>sys.stderr, args
-
-
- if True:
- sys.excepthook = eh
-
-
- class NullType(object):
-
- def __new__(cls, *args, **kwargs):
- if '_inst' not in vars(cls):
- cls._inst = object.__new__(cls, *args, **kwargs)
-
- return cls._inst
-
-
- def __init__(self, *args, **kwargs):
- pass
-
-
- def __call__(self, *args, **kwargs):
- return self
-
-
- def __repr__(self):
- return '<Null>'
-
-
- def __nonzero__(self):
- return False
-
-
- def __getattr__(self, name):
- return self
-
-
- def __setattr__(self, name, value):
- return self
-
-
- def __delattr__(self, name):
- return self
-
-
- import __builtin__
- __builtin__.Null = NullType()
- del NullType
- find_library = None
- if os.name == 'nt':
-
- def find_library(name):
- for directory in sys.path + os.environ['PATH'].split(os.pathsep):
- fname = os.path.join(directory, name)
- if os.path.exists(fname):
- return fname
- if fname.lower().endswith('.dll'):
- continue
-
- fname = fname + '.dll'
- if os.path.exists(fname):
- return fname
-
-
-
- if find_library is not None:
- import ctypes.util as ctypes
- ctypes.util.find_library = find_library
-
- del find_library
- import gettext
- gettext.install('Digsby', './locale', unicode = True)
-