home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / lib2to3 / fixes / fix_methodattrs.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.1 KB  |  22 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Fix bound method attributes (method.im_? -> method.__?__).
  5. '''
  6. from  import fixer_base
  7. from fixer_util import Name
  8. MAP = {
  9.     'im_func': '__func__',
  10.     'im_self': '__self__',
  11.     'im_class': '__self__.__class__' }
  12.  
  13. class FixMethodattrs(fixer_base.BaseFix):
  14.     PATTERN = "\n    power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* >\n    "
  15.     
  16.     def transform(self, node, results):
  17.         attr = results['attr'][0]
  18.         new = MAP[attr.value]
  19.         attr.replace(Name(new, prefix = attr.get_prefix()))
  20.  
  21.  
  22.