OLD | NEW |
(Empty) | |
| 1 """ |
| 2 Fixer for removing any of these lines: |
| 3 |
| 4 from __future__ import with_statement |
| 5 from __future__ import nested_scopes |
| 6 from __future__ import generators |
| 7 |
| 8 The reason is that __future__ imports like these are required to be the first |
| 9 line of code (after docstrings) on Python 2.6+, which can get in the way. |
| 10 |
| 11 These imports are always enabled in Python 2.6+, which is the minimum sane |
| 12 version to target for Py2/3 compatibility. |
| 13 """ |
| 14 |
| 15 from lib2to3 import fixer_base |
| 16 from libfuturize.fixer_util import remove_future_import |
| 17 |
| 18 class FixRemoveOldFutureImports(fixer_base.BaseFix): |
| 19 BM_compatible = True |
| 20 PATTERN = "file_input" |
| 21 run_order = 1 |
| 22 |
| 23 def transform(self, node, results): |
| 24 remove_future_import(u"with_statement", node) |
| 25 remove_future_import(u"nested_scopes", node) |
| 26 remove_future_import(u"generators", node) |
| 27 |
OLD | NEW |