]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_unicode.py
1 """Fixer that changes unicode to str, unichr to chr, and u"..." into "...".
6 from ..pgen2
import token
7 from .. import fixer_base
9 _mapping
= {u
"unichr" : u
"chr", u
"unicode" : u
"str"}
10 _literal_re
= re
.compile(ur
"[uU][rR]?[\'\"]")
12 class FixUnicode(fixer_base.BaseFix):
14 PATTERN = "STRING |
'unicode' |
'unichr'"
16 def transform(self, node, results):
17 if node.type == token.NAME:
19 new.value = _mapping[node.value]
21 elif node.type == token.STRING:
22 if _literal_re.match(node.value):
24 new.value = new.value[1:]