|
28 | 28 | Python 3 with ``pasteurize`` as they are when converting from Python 2 with |
29 | 29 | ``futurize``. |
30 | 30 |
|
| 31 | +The --all-imports option forces adding all ``__future__`` imports, |
| 32 | +``future.builtins`` imports, and standard library hooks, even if they don't |
| 33 | +seem necessary for the current state of each module. (This can simplify |
| 34 | +testing, and can reduce the need to think about Py2 compatibility when editing |
| 35 | +the code further.) |
| 36 | +
|
31 | 37 | """ |
32 | 38 |
|
33 | 39 | from __future__ import (absolute_import, print_function, unicode_literals) |
@@ -115,22 +121,12 @@ def main(args=None): |
115 | 121 | # Initialize the refactoring tool |
116 | 122 | unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix) |
117 | 123 |
|
118 | | - # The 'all-imports' option forces adding all imports __future__ and "from |
119 | | - # future import standard_library", even if they don't seem necessary for |
120 | | - # the current state of each module. (This can simplify testing, and can |
121 | | - # reduce the need to think about Py2 compatibility when editing the code |
122 | | - # further.) |
123 | 124 | extra_fixes = set() |
124 | 125 | if options.all_imports: |
125 | | - prefix = 'libfuturize.fixes.' |
126 | | - if options.stage1: |
127 | | - extra_fixes.add(prefix + |
128 | | - 'fix_add__future__imports_except_unicode_literals') |
129 | | - else: |
130 | | - # In case the user hasn't run stage1 for some reason: |
131 | | - extra_fixes.add(prefix + 'fix_add__future__imports') |
132 | | - extra_fixes.add(prefix + 'fix_add_future_standard_library_import') |
133 | | - extra_fixes.add(prefix + 'fix_add_all_future_builtins') |
| 126 | + prefix = 'libpasteurize.fixes.' |
| 127 | + extra_fixes.add(prefix + 'fix_add_all__future__imports') |
| 128 | + extra_fixes.add(prefix + 'fix_add_future_standard_library_import') |
| 129 | + extra_fixes.add(prefix + 'fix_add_all_future_builtins') |
134 | 130 |
|
135 | 131 | fixer_names = avail_fixes | extra_fixes - unwanted_fixes |
136 | 132 |
|
|
0 commit comments