]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_filter.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / lib2to3 / fixes / fix_filter.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_filter.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_filter.py
deleted file mode 100644 (file)
index 024987b..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright 2007 Google, Inc. All Rights Reserved.\r
-# Licensed to PSF under a Contributor Agreement.\r
-\r
-"""Fixer that changes filter(F, X) into list(filter(F, X)).\r
-\r
-We avoid the transformation if the filter() call is directly contained\r
-in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or\r
-for V in <>:.\r
-\r
-NOTE: This is still not correct if the original code was depending on\r
-filter(F, X) to return a string if X is a string and a tuple if X is a\r
-tuple.  That would require type inference, which we don't do.  Let\r
-Python 2.6 figure it out.\r
-"""\r
-\r
-# Local imports\r
-from ..pgen2 import token\r
-from .. import fixer_base\r
-from ..fixer_util import Name, Call, ListComp, in_special_context\r
-\r
-class FixFilter(fixer_base.ConditionalFix):\r
-    BM_compatible = True\r
-\r
-    PATTERN = """\r
-    filter_lambda=power<\r
-        'filter'\r
-        trailer<\r
-            '('\r
-            arglist<\r
-                lambdef< 'lambda'\r
-                         (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any\r
-                >\r
-                ','\r
-                it=any\r
-            >\r
-            ')'\r
-        >\r
-    >\r
-    |\r
-    power<\r
-        'filter'\r
-        trailer< '(' arglist< none='None' ',' seq=any > ')' >\r
-    >\r
-    |\r
-    power<\r
-        'filter'\r
-        args=trailer< '(' [any] ')' >\r
-    >\r
-    """\r
-\r
-    skip_on = "future_builtins.filter"\r
-\r
-    def transform(self, node, results):\r
-        if self.should_skip(node):\r
-            return\r
-\r
-        if "filter_lambda" in results:\r
-            new = ListComp(results.get("fp").clone(),\r
-                           results.get("fp").clone(),\r
-                           results.get("it").clone(),\r
-                           results.get("xp").clone())\r
-\r
-        elif "none" in results:\r
-            new = ListComp(Name(u"_f"),\r
-                           Name(u"_f"),\r
-                           results["seq"].clone(),\r
-                           Name(u"_f"))\r
-\r
-        else:\r
-            if in_special_context(node):\r
-                return None\r
-            new = node.clone()\r
-            new.prefix = u""\r
-            new = Call(Name(u"list"), [new])\r
-        new.prefix = node.prefix\r
-        return new\r