[Python-checkins] r55857 - sandbox/trunk/2to3/fixes/fix_numliterals.py

georg.brandl python-checkins at python.org
Sun Jun 10 20:31:05 CEST 2007


Author: georg.brandl
Date: Sun Jun 10 20:31:01 2007
New Revision: 55857

Modified:
   sandbox/trunk/2to3/fixes/fix_numliterals.py
Log:
Remove the parts of the numliterals fixer that aren't PEP compliant.


Modified: sandbox/trunk/2to3/fixes/fix_numliterals.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_numliterals.py	(original)
+++ sandbox/trunk/2to3/fixes/fix_numliterals.py	Sun Jun 10 20:31:01 2007
@@ -1,5 +1,4 @@
-"""Fixer that turns 1L into 1, 0755 into 0o755,
-0XABC into 0xABC, 1E5 into 1e5, 1J into 1j.
+"""Fixer that turns 1L into 1, 0755 into 0o755.
 """
 # Copyright 2007 Georg Brandl.
 # Licensed to PSF under a Contributor Agreement.
@@ -16,21 +15,12 @@
     def match(self, node):
         # Override
         return (node.type == token.NUMBER and
-                (node.value.startswith("0") or
-                 'E' in node.value or
-                 'J' in node.value or
-                 node.value[-1] in "Ll"))
+                (node.value.startswith("0") or node.value[-1] in "Ll"))
 
     def transform(self, node):
         val = node.value
         if val[-1] in 'Ll':
             val = val[:-1]
-        if 'J' in val:
-            val = val.replace('J', 'j')
-        if 'E' in val:
-            val = val.replace('E', 'e')
-        if val.startswith('0X'):
-            val = '0x' + val[2:]
         elif val.startswith('0') and val.isdigit() and len(set(val)) > 1:
             val = "0o" + val[1:]
 


More information about the Python-checkins mailing list