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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4.  
  5. def prefilter_PQ(self, line, continuation):
  6.     match = match
  7.     import re
  8.     InteractiveShell = InteractiveShell
  9.     import IPython.iplib
  10.     unit_split = match('\\s*(\\w+)\\s*=\\s*(-?\\d*\\.?\\d*[eE]?-?\\d*)\\s+([a-zA-Z].*)', line)
  11.     if unit_split:
  12.         (var, val, units) = unit_split.groups()
  13.         if var and val and units:
  14.             units = units.replace('^', '**')
  15.             line = var + ' = PhysicalQuantityInteractive(' + val + ", '" + units + "')"
  16.         
  17.     
  18.     return InteractiveShell._prefilter(self, line, continuation)
  19.  
  20. from IPython.iplib import InteractiveShell
  21. InteractiveShell.prefilter = prefilter_PQ
  22. del InteractiveShell
  23. del prefilter_PQ
  24. print '*** Simplified input for physical quantities enabled.'
  25.