OLD | NEW |
(Empty) | |
| 1 """ |
| 2 For the ``future`` package. |
| 3 |
| 4 Adds this import line:: |
| 5 |
| 6 from builtins import (ascii, bytes, chr, dict, filter, hex, input, |
| 7 int, list, map, next, object, oct, open, pow, |
| 8 range, round, str, super, zip) |
| 9 |
| 10 to a module, irrespective of whether each definition is used. |
| 11 |
| 12 Adds these imports after any other imports (in an initial block of them). |
| 13 """ |
| 14 |
| 15 from __future__ import unicode_literals |
| 16 |
| 17 from lib2to3 import fixer_base |
| 18 |
| 19 from libfuturize.fixer_util import touch_import_top |
| 20 |
| 21 |
| 22 class FixAddAllFutureBuiltins(fixer_base.BaseFix): |
| 23 BM_compatible = True |
| 24 PATTERN = "file_input" |
| 25 run_order = 1 |
| 26 |
| 27 def transform(self, node, results): |
| 28 # import_str = """(ascii, bytes, chr, dict, filter, hex, input, |
| 29 # int, list, map, next, object, oct, open, pow, |
| 30 # range, round, str, super, zip)""" |
| 31 touch_import_top(u'builtins', '*', node) |
| 32 |
| 33 # builtins = """ascii bytes chr dict filter hex input |
| 34 # int list map next object oct open pow |
| 35 # range round str super zip""" |
| 36 # for builtin in sorted(builtins.split(), reverse=True): |
| 37 # touch_import_top(u'builtins', builtin, node) |
| 38 |
OLD | NEW |