home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- '''Fixer that turns 1L into 1, 0755 into 0o755.
- '''
- from pgen2 import token
- from import fixer_base
- from fixer_util import Number
-
- class FixNumliterals(fixer_base.BaseFix):
-
- def match(self, node):
- if not node.type == token.NUMBER and node.value.startswith('0'):
- pass
- return node.value[-1] in 'Ll'
-
-
- def transform(self, node, results):
- val = node.value
- if val[-1] in 'Ll':
- val = val[:-1]
- elif val.startswith('0') and val.isdigit() and len(set(val)) > 1:
- val = '0o' + val[1:]
-
- return Number(val, prefix = node.get_prefix())
-
-
-