MisterAI's picture
download
raw
606 Bytes
"""Fix bound method attributes (method.im_? -> method.__?__).
"""
# Author: Christian Heimes
# Local imports
from .. import fixer_base
from ..fixer_util import Name
MAP = {
"im_func" : "__func__",
"im_self" : "__self__",
"im_class" : "__self__.__class__"
}
class FixMethodattrs(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* >
"""
def transform(self, node, results):
attr = results["attr"][0]
new = MAP[attr.value]
attr.replace(Name(new, prefix=attr.prefix))

Xet Storage Details

Size:
606 Bytes
·
Xet hash:
4c32985b410b4bb90d8dd30608cbc11d75058245d4d4e31960b6d254575ce70e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.