]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_numliterals.py
1 """Fixer that turns 1L into 1, 0755 into 0o755.
3 # Copyright 2007 Georg Brandl.
4 # Licensed to PSF under a Contributor Agreement.
7 from ..pgen2
import token
8 from .. import fixer_base
9 from ..fixer_util
import Number
12 class FixNumliterals(fixer_base
.BaseFix
):
13 # This is so simple that we don't need the pattern compiler.
15 _accept_type
= token
.NUMBER
17 def match(self
, node
):
19 return (node
.value
.startswith(u
"0") or node
.value
[-1] in u
"Ll")
21 def transform(self
, node
, results
):
25 elif val
.startswith(u
'0') and val
.isdigit() and len(set(val
)) > 1:
28 return Number(val
, prefix
=node
.prefix
)