OLD | NEW |
(Empty) | |
| 1 """ |
| 2 For the ``future`` package. |
| 3 |
| 4 Changes any imports needed to reflect the standard library reorganization. Also |
| 5 Also adds these import lines: |
| 6 |
| 7 from future import standard_library |
| 8 standard_library.install_aliases() |
| 9 |
| 10 after any __future__ imports but before any other imports. |
| 11 """ |
| 12 |
| 13 from lib2to3.fixes.fix_imports import FixImports |
| 14 from libfuturize.fixer_util import touch_import_top |
| 15 |
| 16 |
| 17 class FixFutureStandardLibrary(FixImports): |
| 18 run_order = 8 |
| 19 |
| 20 def transform(self, node, results): |
| 21 result = super(FixFutureStandardLibrary, self).transform(node, results) |
| 22 # TODO: add a blank line between any __future__ imports and this? |
| 23 touch_import_top(u'future', u'standard_library', node) |
| 24 return result |
| 25 |
| 26 |
OLD | NEW |