Re: whitespace cleanup

2011-12-06 Thread Andrea Crotti
So apparently PythonTidy uses the AST (the compiler module) to find out the problems, and generates new nodes with a put method to write out the code with the fix. An awful lot of code is needed to make it work apparently, not very neat. Pep8 instead uses tokenize and regular expressions only,

Re: whitespace cleanup

2011-12-06 Thread Andrea Crotti
On 12/06/2011 12:17 PM, Pedro Henrique G. Souto wrote: Something like PythonTidy does what you want? http://pypi.python.org/pypi/PythonTidy If you like to write your own script, or if what you want is similar, but not the same, the source code is a good place to start: http://lacusveris.com

Re: whitespace cleanup

2011-12-06 Thread Pedro Henrique G. Souto
On 06/12/2011 10:06, Chris Angelico wrote: On Tue, Dec 6, 2011 at 10:59 PM, Andrea Crotti wrote: Well it's not so simple, I clearly don't want to strip out whitespace in the beginning of the line, or my nice code will break miserably ;) The question is: What is "wrong" whitespace? Whatever y

Re: whitespace cleanup

2011-12-06 Thread Chris Angelico
On Tue, Dec 6, 2011 at 10:59 PM, Andrea Crotti wrote: > Well it's not so simple, I clearly don't want to strip out whitespace in the > beginning of the line, > or my nice code will break miserably ;) The question is: What is "wrong" whitespace? Whatever you declare to be wrong, you can probably c

Re: whitespace cleanup

2011-12-06 Thread Andrea Crotti
On 12/06/2011 11:49 AM, Pedro Henrique G. Souto wrote: On 06/12/2011 09:28, Andrea Crotti wrote: > Now on Emacs I have a hook before every save that cleans up all the > "wrong" white spaces, > with the 'whitespace-cleanup' function. > > I would like that also

Re: whitespace cleanup

2011-12-06 Thread Pedro Henrique G. Souto
On 06/12/2011 09:28, Andrea Crotti wrote: > Now on Emacs I have a hook before every save that cleans up all the > "wrong" white spaces, > with the 'whitespace-cleanup' function. > > I would like that also for my non emacsers colleagues, and possibly with >

whitespace cleanup

2011-12-06 Thread Andrea Crotti
Now on Emacs I have a hook before every save that cleans up all the "wrong" white spaces, with the 'whitespace-cleanup' function. I would like that also for my non emacsers colleagues, and possibly with a Python script. I looked up around but I can't find anything us