Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
645 bytes
|
Line | |
---|
1 | """Fix function attribute names (f.func_x -> f.__x__)."""
|
---|
2 | # Author: Collin Winter
|
---|
3 |
|
---|
4 | # Local imports
|
---|
5 | from .. import fixer_base
|
---|
6 | from ..fixer_util import Name
|
---|
7 |
|
---|
8 |
|
---|
9 | class FixFuncattrs(fixer_base.BaseFix):
|
---|
10 | BM_compatible = True
|
---|
11 |
|
---|
12 | PATTERN = """
|
---|
13 | power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals'
|
---|
14 | | 'func_name' | 'func_defaults' | 'func_code'
|
---|
15 | | 'func_dict') > any* >
|
---|
16 | """
|
---|
17 |
|
---|
18 | def transform(self, node, results):
|
---|
19 | attr = results["attr"][0]
|
---|
20 | attr.replace(Name((u"__%s__" % attr.value[5:]),
|
---|
21 | prefix=attr.prefix))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.