diff options
Diffstat (limited to 'Lib/lib2to3/fixes/fix_zip.py')
-rw-r--r-- | Lib/lib2to3/fixes/fix_zip.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/Lib/lib2to3/fixes/fix_zip.py b/Lib/lib2to3/fixes/fix_zip.py index 52c28df..c5d7b66 100644 --- a/Lib/lib2to3/fixes/fix_zip.py +++ b/Lib/lib2to3/fixes/fix_zip.py @@ -9,16 +9,13 @@ iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. # Local imports from .. import fixer_base -from ..pytree import Node -from ..pygram import python_symbols as syms -from ..fixer_util import Name, ArgList, in_special_context - +from ..fixer_util import Name, Call, in_special_context class FixZip(fixer_base.ConditionalFix): BM_compatible = True PATTERN = """ - power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] + power< 'zip' args=trailer< '(' [any] ')' > > """ @@ -31,16 +28,8 @@ class FixZip(fixer_base.ConditionalFix): if in_special_context(node): return None - args = results['args'].clone() - args.prefix = "" - - trailers = [] - if 'trailers' in results: - trailers = [n.clone() for n in results['trailers']] - for n in trailers: - n.prefix = "" - - new = Node(syms.power, [Name("zip"), args], prefix="") - new = Node(syms.power, [Name("list"), ArgList([new])] + trailers) + new = node.clone() + new.prefix = u"" + new = Call(Name(u"list"), [new]) new.prefix = node.prefix return new |