Skip to content
Browse files

Merge remote-tracking branch 'loewis/no-six'

  • Loading branch information...
2 parents 56d3658 + 8caf6c0 commit 1a573152f2dab4c4d98ee3284eec32ead8344d66 @mitsuhiko committed Mar 14, 2012
Showing with 16 additions and 1 deletion.
  1. +11 −0 libmodernize/fixes/__init__.py
  2. +5 −1 libmodernize/main.py
View
11 libmodernize/fixes/__init__.py
@@ -29,3 +29,14 @@
'lib2to3.fixes.fix_xrange',
'lib2to3.fixes.fix_xreadlines'
])
+
+# fixes that involve using six
+six_fix_names = set([
+ 'libmodernize.fixes.fix_dict',
+ 'libmodernize.fixes.fix_filter',
+ 'libmodernize.fixes.fix_map',
+ 'libmodernize.fixes.fix_next',
+ 'libmodernize.fixes.fix_range',
+ 'libmodernize.fixes.fix_unicode',
+ 'libmodernize.fixes.fix_zip',
+ ])
View
6 libmodernize/main.py
@@ -5,7 +5,7 @@
from lib2to3.main import warn, StdoutRefactoringTool
from lib2to3 import refactor
-from libmodernize.fixes import lib2to3_fix_names
+from libmodernize.fixes import lib2to3_fix_names, six_fix_names
def main(args=None):
@@ -38,6 +38,8 @@ def main(args=None):
parser.add_option("--future-unicode", action="store_true", default=False,
help="Use unicode_strings future_feature instead of the six.u function "
"(only useful for Python 2.6+).")
+ parser.add_option("--no-six", action="store_true", default=False,
+ help="Exclude fixes that depend on the six package")
fixer_pkg = 'libmodernize.fixes'
avail_fixes = set(refactor.get_fixers_from_package(fixer_pkg))
@@ -79,6 +81,8 @@ def main(args=None):
unwanted_fixes.add('libmodernize.fixes.fix_unicode')
else:
unwanted_fixes.add('libmodernize.fixes.fix_unicode_future')
+ if options.no_six:
+ unwanted_fixes.update(six_fix_names)
explicit = set()
if options.fix:
all_present = False

0 comments on commit 1a57315

Please sign in to comment.
Something went wrong with that request. Please try again.