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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import re
  5. from IPython.iplib import InteractiveShell
  6. PROMPT_RE = re.compile('(^[ \\t]*>>> |^[ \\t]*\\.\\.\\. )')
  7.  
  8. def prefilter_paste(self, line, continuation):
  9.     if not line:
  10.         return ''
  11.     m = PROMPT_RE.match(line)
  12.     if m:
  13.         return self._prefilter(line[len(m.group(0)):], continuation)
  14.     if line.strip() == '...':
  15.         return self._prefilter('', continuation)
  16.     if line.isspace():
  17.         return ''
  18.     return self._prefilter(line, continuation)
  19.  
  20.  
  21. def activate_prefilter():
  22.     InteractiveShell.prefilter = prefilter_paste
  23.  
  24.  
  25. def deactivate_prefilter():
  26.     InteractiveShell.prefilter = InteractiveShell._prefilter
  27.  
  28. activate_prefilter()
  29. print '*** Pasting of code with ">>>" or "..." has been enabled.'
  30.