summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes/fix_zip.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-05-23 17:40:02 (GMT)
committerGitHub <noreply@github.com>2023-05-23 17:40:02 (GMT)
commitae00b810d1d3ad7f1f7e226b02ece37c986330e7 (patch)
tree173ec10e86e887adad8740e7833c92a464779917 /Lib/lib2to3/fixes/fix_zip.py
parentddb14859535ab8091381b9d0baf32dbe245b5e65 (diff)
downloadcpython-ae00b810d1d3ad7f1f7e226b02ece37c986330e7.zip
cpython-ae00b810d1d3ad7f1f7e226b02ece37c986330e7.tar.gz
cpython-ae00b810d1d3ad7f1f7e226b02ece37c986330e7.tar.bz2
gh-104780: Remove 2to3 program and lib2to3 module (#104781)
* Remove the Tools/scripts/2to3 script. * Remove the Lib/test/test_lib2to3/ directory. * Doc/tools/extensions/pyspecific.py: remove the "2to3fixer" object type. * Makefile and PC/layout/main.py no longer compile lib2to3 grammar files. * Update Makefile for 2to3 removal.
Diffstat (limited to 'Lib/lib2to3/fixes/fix_zip.py')
-rw-r--r--Lib/lib2to3/fixes/fix_zip.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/Lib/lib2to3/fixes/fix_zip.py b/Lib/lib2to3/fixes/fix_zip.py
deleted file mode 100644
index 52c28df..0000000
--- a/Lib/lib2to3/fixes/fix_zip.py
+++ /dev/null
@@ -1,46 +0,0 @@
-"""
-Fixer that changes zip(seq0, seq1, ...) into list(zip(seq0, seq1, ...)
-unless there exists a 'from future_builtins import zip' statement in the
-top-level namespace.
-
-We avoid the transformation if the zip() call is directly contained in
-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
-
-
-class FixZip(fixer_base.ConditionalFix):
-
- BM_compatible = True
- PATTERN = """
- power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*]
- >
- """
-
- skip_on = "future_builtins.zip"
-
- def transform(self, node, results):
- if self.should_skip(node):
- return
-
- 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.prefix = node.prefix
- return new