]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_intern.py
1 # Copyright 2006 Georg Brandl.
2 # Licensed to PSF under a Contributor Agreement.
6 intern(s) -> sys.intern(s)"""
10 from .. import fixer_base
11 from ..fixer_util
import Name
, Attr
, touch_import
14 class FixIntern(fixer_base
.BaseFix
):
21 ( not(arglist | argument<any '=' any>) obj=any
22 | obj=arglist<(not argument<any '=' any>) any ','> )
28 def transform(self
, node
, results
):
30 obj
= results
["obj"].clone()
31 if obj
.type == syms
.arglist
:
32 newarglist
= obj
.clone()
34 newarglist
= pytree
.Node(syms
.arglist
, [obj
.clone()])
35 after
= results
["after"]
37 after
= [n
.clone() for n
in after
]
38 new
= pytree
.Node(syms
.power
,
39 Attr(Name(u
"sys"), Name(u
"intern")) +
40 [pytree
.Node(syms
.trailer
,
41 [results
["lpar"].clone(),
43 results
["rpar"].clone()])] + after
)
44 new
.prefix
= node
.prefix
45 touch_import(None, u
'sys', node
)