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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import IPython.ipapi as IPython
  5. from IPython.genutils import Term
  6. from IPython.external import pretty
  7. ip = IPython.ipapi.get()
  8.  
  9. def pretty_result_display(self, arg):
  10.     if ip.options.pprint:
  11.         verbose = getattr(ip.options, 'pretty_verbose', False)
  12.         out = pretty.pretty(arg, verbose = verbose)
  13.         if '\n' in out:
  14.             Term.cout.write('\n')
  15.         
  16.         print >>Term.cout, out
  17.     else:
  18.         raise TryNext
  19.     return ip.options.pprint
  20.  
  21. for_type = pretty.for_type
  22. for_type_by_name = pretty.for_type_by_name
  23.  
  24. def activate():
  25.     ip.set_hook('result_display', pretty_result_display, priority = 99)
  26.  
  27.  
  28. def dtype_pprinter(obj, p, cycle):
  29.     if cycle:
  30.         return p.text('dtype(...)')
  31.     if obj.fields is None:
  32.         p.text(repr(obj))
  33.     else:
  34.         p.begin_group(7, 'dtype([')
  35.         for i, field in enumerate(obj.descr):
  36.             if i > 0:
  37.                 p.text(',')
  38.                 p.breakable()
  39.             
  40.             p.pretty(field)
  41.         
  42.         p.end_group(7, '])')
  43.  
  44.  
  45. def test_pretty():
  46.     pass
  47.  
  48.