]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_methodattrs.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / lib2to3 / fixes / fix_methodattrs.py
CommitLineData
4710c53d 1"""Fix bound method attributes (method.im_? -> method.__?__).\r
2"""\r
3# Author: Christian Heimes\r
4\r
5# Local imports\r
6from .. import fixer_base\r
7from ..fixer_util import Name\r
8\r
9MAP = {\r
10 "im_func" : "__func__",\r
11 "im_self" : "__self__",\r
12 "im_class" : "__self__.__class__"\r
13 }\r
14\r
15class FixMethodattrs(fixer_base.BaseFix):\r
16 BM_compatible = True\r
17 PATTERN = """\r
18 power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* >\r
19 """\r
20\r
21 def transform(self, node, results):\r
22 attr = results["attr"][0]\r
23 new = unicode(MAP[attr.value])\r
24 attr.replace(Name(new, prefix=attr.prefix))\r