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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from IPython import generics, ipapi
  5. from IPython.genutils import dir2
  6.  
  7. def attr_matches(self, text):
  8.     import re
  9.     force_complete = 1
  10.     m = re.match('(\\S+(\\.\\w+)*)\\.(\\w*)$', text)
  11.     if m:
  12.         (expr, attr) = m.group(1, 3)
  13.     elif not force_complete:
  14.         return []
  15.     m2 = re.match('(.+)\\.(\\w*)$', self.lbuf)
  16.     if not m2:
  17.         return []
  18.     (expr, attr) = m2.group(1, 2)
  19.     
  20.     try:
  21.         obj = eval(expr, self.namespace)
  22.     except:
  23.         m2
  24.         
  25.         try:
  26.             obj = eval(expr, self.global_namespace)
  27.         return []
  28.  
  29.  
  30.     words = dir2(obj)
  31.     
  32.     try:
  33.         words = generics.complete_object(obj, words)
  34.     except ipapi.TryNext:
  35.         m2
  36.         m2
  37.     except:
  38.         m2
  39.  
  40.     n = len(attr)
  41.     res = _[1]
  42.     return res
  43.  
  44.  
  45. def main():
  46.     import IPython.rlineimpl as readline
  47.     readline.set_completer_delims(' \n\t')
  48.     import IPython.completer as IPython
  49.     IPython.completer.Completer.attr_matches = attr_matches
  50.  
  51. main()
  52.