home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / LibO_3.3.1_Win_x86_install_multi.exe / libreoffice1.cab / fix_future.py < prev    next >
Encoding:
Python Source  |  2011-02-15  |  527 b   |  21 lines

  1. """Remove __future__ imports
  2.  
  3. from __future__ import foo is replaced with an empty line.
  4. """
  5. # Author: Christian Heimes
  6.  
  7. # Local imports
  8. from .. import fixer_base
  9. from ..fixer_util import BlankLine
  10.  
  11. class FixFuture(fixer_base.BaseFix):
  12.     PATTERN = """import_from< 'from' module_name="__future__" 'import' any >"""
  13.  
  14.     # This should be run last -- some things check for the import
  15.     run_order = 10
  16.  
  17.     def transform(self, node, results):
  18.         new = BlankLine()
  19.         new.prefix = node.get_prefix()
  20.         return new
  21.