[Python-checkins] r54964 - in sandbox/trunk/2to3: example.py fixes/fix_ws_comma.py pytree.py refactor.py (original) (raw)

guido.van.rossum python-checkins at python.org
Wed Apr 25 21:47:58 CEST 2007


Author: guido.van.rossum Date: Wed Apr 25 21:47:49 2007 New Revision: 54964

Added: sandbox/trunk/2to3/fixes/fix_ws_comma.py (contents, props changed) Modified: sandbox/trunk/2to3/example.py sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/refactor.py Log: Example fixer that normalizes the whitespace around commas (and around colons in dict displays). This required a few minor tweaks elsewhere.

Modified: sandbox/trunk/2to3/example.py

--- sandbox/trunk/2to3/example.py (original) +++ sandbox/trunk/2to3/example.py Wed Apr 25 21:47:49 2007 @@ -65,6 +65,13 @@ def foo(): pass # body indented by tab

+def test_ws_comma():

Added: sandbox/trunk/2to3/fixes/fix_ws_comma.py

--- (empty file) +++ sandbox/trunk/2to3/fixes/fix_ws_comma.py Wed Apr 25 21:47:49 2007 @@ -0,0 +1,37 @@ +"""Fixer that changes 'a ,b' into 'a, b'. + +This also changes '{a :b}' into '{a: b}', but does not touch other +uses of colons. It does not touch other uses of whitespace. + +""" + +import pytree +from pgen2 import token +from fixes import basefix + +class FixWsComma(basefix.BaseFix): +

Modified: sandbox/trunk/2to3/pytree.py

--- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Wed Apr 25 21:47:49 2007 @@ -460,8 +460,9 @@ """Initializer. Takes optional type, content, and name.

     The type, if given, must be a symbol type (>= 256).  If the

@@ -472,8 +473,6 @@ """ if type is not None: assert type >= 256, type

Modified: sandbox/trunk/2to3/refactor.py

--- sandbox/trunk/2to3/refactor.py (original) +++ sandbox/trunk/2to3/refactor.py Wed Apr 25 21:47:49 2007 @@ -256,7 +256,8 @@ for fixer in self.fixers: if fixer.match(node): new = fixer.transform(node)



More information about the Python-checkins mailing list