]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_zip.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / lib2to3 / fixes / fix_zip.py
CommitLineData
4710c53d 1"""\r
2Fixer that changes zip(seq0, seq1, ...) into list(zip(seq0, seq1, ...)\r
3unless there exists a 'from future_builtins import zip' statement in the\r
4top-level namespace.\r
5\r
6We avoid the transformation if the zip() call is directly contained in\r
7iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:.\r
8"""\r
9\r
10# Local imports\r
11from .. import fixer_base\r
12from ..fixer_util import Name, Call, in_special_context\r
13\r
14class FixZip(fixer_base.ConditionalFix):\r
15\r
16 BM_compatible = True\r
17 PATTERN = """\r
18 power< 'zip' args=trailer< '(' [any] ')' >\r
19 >\r
20 """\r
21\r
22 skip_on = "future_builtins.zip"\r
23\r
24 def transform(self, node, results):\r
25 if self.should_skip(node):\r
26 return\r
27\r
28 if in_special_context(node):\r
29 return None\r
30\r
31 new = node.clone()\r
32 new.prefix = u""\r
33 new = Call(Name(u"list"), [new])\r
34 new.prefix = node.prefix\r
35 return new\r