/Lib/lib2to3/fixes/fix_future.py
http://unladen-swallow.googlecode.com/ · Python · 20 lines · 9 code · 4 blank · 7 comment · 0 complexity · 0e2786c94aac6b11a47d8ec46d8b19d6 MD5 · raw file
- """Remove __future__ imports
- from __future__ import foo is replaced with an empty line.
- """
- # Author: Christian Heimes
- # Local imports
- from .. import fixer_base
- from ..fixer_util import BlankLine
- class FixFuture(fixer_base.BaseFix):
- PATTERN = """import_from< 'from' module_name="__future__" 'import' any >"""
- # This should be run last -- some things check for the import
- run_order = 10
- def transform(self, node, results):
- new = BlankLine()
- new.prefix = node.get_prefix()
- return new