diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-12-07 22:44:10 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-12-07 22:44:10 -0500 |
commit | 448e81b2da41e2ad89302cc8cb384795f9f6306c (patch) | |
tree | 97798e92a82e2a2bc27085ec73eff1675a090c42 /Lib/lib2to3/fixes/fix_intern.py | |
parent | e7f2186f994f84e050b869559132d28d4fe26614 (diff) | |
download | cpython-448e81b2da41e2ad89302cc8cb384795f9f6306c.tar.gz cpython-448e81b2da41e2ad89302cc8cb384795f9f6306c.zip |
add fixer for reload() -> imp.reload() (closes #11797)\n\nPatch by Laurie Clark-Michalek and Berker Peksag
Diffstat (limited to 'Lib/lib2to3/fixes/fix_intern.py')
-rw-r--r-- | Lib/lib2to3/fixes/fix_intern.py | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/Lib/lib2to3/fixes/fix_intern.py b/Lib/lib2to3/fixes/fix_intern.py index 6be11cd39dc..fb2973c2425 100644 --- a/Lib/lib2to3/fixes/fix_intern.py +++ b/Lib/lib2to3/fixes/fix_intern.py @@ -6,9 +6,8 @@ intern(s) -> sys.intern(s)""" # Local imports -from .. import pytree from .. import fixer_base -from ..fixer_util import Name, Attr, touch_import +from ..fixer_util import ImportAndCall, touch_import class FixIntern(fixer_base.BaseFix): @@ -26,21 +25,7 @@ class FixIntern(fixer_base.BaseFix): """ def transform(self, node, results): - syms = self.syms - obj = results["obj"].clone() - if obj.type == syms.arglist: - newarglist = obj.clone() - else: - newarglist = pytree.Node(syms.arglist, [obj.clone()]) - after = results["after"] - if after: - after = [n.clone() for n in after] - new = pytree.Node(syms.power, - Attr(Name("sys"), Name("intern")) + - [pytree.Node(syms.trailer, - [results["lpar"].clone(), - newarglist, - results["rpar"].clone()])] + after) - new.prefix = node.prefix + names = ('sys', 'intern') + new = ImportAndCall(node, results, names) touch_import(None, 'sys', node) return new |