home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_595 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.3 KB  |  63 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import _hotshot
  5. from _hotshot import ProfilerError
  6. from warnings import warnpy3k as _warnpy3k
  7. _warnpy3k("The 'hotshot' module is not supported in 3.x, use the 'profile' module instead.", stacklevel = 2)
  8.  
  9. class Profile:
  10.     
  11.     def __init__(self, logfn, lineevents = 0, linetimings = 1):
  12.         if not lineevents or 1:
  13.             pass
  14.         self.lineevents = 0
  15.         if not linetimings or lineevents or 1:
  16.             pass
  17.         self.linetimings = 0
  18.         self._prof = p = _hotshot.profiler(logfn, self.lineevents, self.linetimings)
  19.         if self.__class__ is Profile:
  20.             self.close = p.close
  21.             self.start = p.start
  22.             self.stop = p.stop
  23.             self.addinfo = p.addinfo
  24.         
  25.  
  26.     
  27.     def close(self):
  28.         self._prof.close()
  29.  
  30.     
  31.     def fileno(self):
  32.         return self._prof.fileno()
  33.  
  34.     
  35.     def start(self):
  36.         self._prof.start()
  37.  
  38.     
  39.     def stop(self):
  40.         self._prof.stop()
  41.  
  42.     
  43.     def addinfo(self, key, value):
  44.         self._prof.addinfo(key, value)
  45.  
  46.     
  47.     def run(self, cmd):
  48.         import __main__
  49.         dict = __main__.__dict__
  50.         return self.runctx(cmd, dict, dict)
  51.  
  52.     
  53.     def runctx(self, cmd, globals, locals):
  54.         code = compile(cmd, '<string>', 'exec')
  55.         self._prof.runcode(code, globals, locals)
  56.         return self
  57.  
  58.     
  59.     def runcall(self, func, *args, **kw):
  60.         return self._prof.runcall(func, args, kw)
  61.  
  62.  
  63.