fix_future.py 547 B

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