Permalink
Browse files

Custom zip fixers

  • Loading branch information...
1 parent 761dc7d commit a0b7a2cc33c311e126d994f0d1fa7935efa35a7b @mitsuhiko mitsuhiko committed Feb 4, 2012
Showing with 29 additions and 2 deletions.
  1. +1 −2 libmodernize/fixes/__init__.py
  2. +28 −0 libmodernize/fixes/fix_zip.py
@@ -27,6 +27,5 @@
'lib2to3.fixes.fix_types',
'lib2to3.fixes.fix_ws_comma',
'lib2to3.fixes.fix_xrange',
- 'lib2to3.fixes.fix_xreadlines',
- 'lib2to3.fixes.fix_zip'
+ 'lib2to3.fixes.fix_xreadlines'
])
@@ -0,0 +1,28 @@
+# Copyright 2008 Armin Ronacher.
+# Licensed to PSF under a Contributor Agreement.
+
+from lib2to3 import fixer_base
+from lib2to3.fixer_util import touch_import
+
+
+class FixZip(fixer_base.BaseFix):
+
+ BM_compatible = True
+ order = "pre"
+
+ PATTERN = """
+ power< 'map'
+ trailer< '('
+ arglist< (
+ (not(argument<any '=' any>) any ','
+ not(argument<any '=' any>) any) |
+ (not(argument<any '=' any>) any ','
+ not(argument<any '=' any>) any ','
+ not(argument<any '=' any>) any)
+ ) >
+ ')' >
+ >
+ """
+
+ def transform(self, node, results):
+ touch_import(u'six.moves', u'zip', node)

0 comments on commit a0b7a2c

Please sign in to comment.