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