472,354 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

help: code formatter?

Hi all,

as a newbie I have problems with formatting code of downloaded programs,
because IDLE's reformatting capabilities are limited . Incorrect
indentation, mixing of TAB with BLANKs or eol are often very nasty to
correct.
Is there a simple code formatter that first removes all indentations and
then refomats correctly?

Please help!

Thank you,

siggi


Jan 8 '07 #1
9 3693
siggi wrote:
as a newbie I have problems with formatting code of downloaded
programs, because IDLE's reformatting capabilities are limited .
Incorrect indentation, mixing of TAB with BLANKs or eol are often
very nasty to correct.
Is there a simple code formatter that first removes all
indentations and then refomats correctly?
Why don't you just write one? :)

Seriously: Try.

BTW: Guessing to what amount of space TABs must be converted in
mixed source can be non-trivial.

Regards,
Björn

--
BOFH excuse #289:

Interference between the keyboard and the chair.

Jan 8 '07 #2
siggi schrieb:
Hi all,

as a newbie I have problems with formatting code of downloaded programs,
because IDLE's reformatting capabilities are limited . Incorrect
indentation, mixing of TAB with BLANKs or eol are often very nasty to
correct.
Is there a simple code formatter that first removes all indentations and
then refomats correctly?

Please help!

Tools\scripts\reindent.py in your Python distribution.

Thomas
Jan 8 '07 #3
siggi wrote this on Mon, Jan 08, 2007 at 03:33:21PM +0100. My reply is below.
Is there a simple code formatter that first removes all indentations
and then refomats correctly?
Why, yes, there is:

http://lacusveris.com/PythonTidy/PythonTidy.python

--
... Chuck Rhode, Sheboygan, WI, USA
... 1979 Honda Goldwing GL1000 (Geraldine)
... Weather: http://LacusVeris.com/WX
... 26° — Wind W 17 mph

Jan 8 '07 #4
Bjoern wrote:
Why don't you just write one? :)
Very funny! Just learning Python :(

Regards,

siggi
siggi wrote:
>as a newbie I have problems with formatting code of downloaded
programs, because IDLE's reformatting capabilities are limited .
Incorrect indentation, mixing of TAB with BLANKs or eol are often
very nasty to correct.
Is there a simple code formatter that first removes all
indentations and then refomats correctly?

Why don't you just write one? :)

Seriously: Try.

BTW: Guessing to what amount of space TABs must be converted in
mixed source can be non-trivial.

Regards,
Björn

--
BOFH excuse #289:

Interference between the keyboard and the chair.

Jan 9 '07 #5
Thomas wrote:
Tools\scripts\reindent.py in your Python distribution.
Thank you Thomas!

What a bucket full of toolsin \tools! I didn't know that.

siggi
"Thomas Heller" <th*****@ctypes.orgschrieb im Newsbeitrag
news:ma***************************************@pyt hon.org...
siggi schrieb:
>Hi all,

as a newbie I have problems with formatting code of downloaded programs,
because IDLE's reformatting capabilities are limited . Incorrect
indentation, mixing of TAB with BLANKs or eol are often very nasty to
correct.
Is there a simple code formatter that first removes all indentations and
then refomats correctly?

Please help!


Tools\scripts\reindent.py in your Python distribution.

Thomas

Jan 9 '07 #6
Chuck wrote:
http://lacusveris.com/PythonTidy/PythonTidy.python
Wow, what a giant of a program! Trying to find out how this works.

Thank you,

siggi

"Chuck Rhode" <CR****@LacusVeris.comschrieb im Newsbeitrag
news:ma***************************************@pyt hon.org...
siggi wrote this on Mon, Jan 08, 2007 at 03:33:21PM +0100. My reply is
below.
>Is there a simple code formatter that first removes all indentations
and then refomats correctly?

Why, yes, there is:

http://lacusveris.com/PythonTidy/PythonTidy.python

--
.. Chuck Rhode, Sheboygan, WI, USA
.. 1979 Honda Goldwing GL1000 (Geraldine)
.. Weather: http://LacusVeris.com/WX
.. 26° - Wind W 17 mph

Jan 9 '07 #7
"siggi" <sm***********@yahoo.comwrote:
Is there a simple code formatter that first removes all indentations and
then refomats correctly?
tabnanny ?

- Hendrik

Jan 9 '07 #8
>tabnanny?
not quite!

"Hendrik van Rooyen" <ma**@microcorp.co.zaschrieb im Newsbeitrag
news:ma***************************************@pyt hon.org...
"siggi" <sm***********@yahoo.comwrote:
>Is there a simple code formatter that first removes all indentations and
then refomats correctly?

tabnanny ?

- Hendrik

Jan 9 '07 #9
siggi wrote:
Bjoern wrote:
>Why don't you just write one? :)

Very funny! Just learning Python :(
It isn't funny at all. You'll learn by doing and trying things.
That's how all programmers start.

Regards,
Björn

--
BOFH excuse #265:

The mouse escaped.

Jan 9 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: farseer | last post by:
Hi, does anyone out there use Eclipse 3.0.1 as their Java Editor? >From menu "Window->Preferences->Java->Code Style->Code Formatter", i created a new Code Formatter profile and set it up how i...
2
by: rh0dium | last post by:
Hi all, So I have a slice of code which calls other python code. I have started to take a real liking to the logging module, but I want to extend this into the called python code. I have no...
1
by: CLEAR-RCIC | last post by:
I have a piece of code that works in C# but when I convert it to VB.Net I get the following error: "Cannot deserialize the message passed as an argument. Cannot recognize the serialization format."...
4
by: Johnny Lee | last post by:
Hi, I've met a problem in match a regular expression in python. Hope any of you could help me. Here are the details: I have many tags like this: xxx<a href="http://xxx.xxx.xxx" xxx>xxx xxx<a...
4
by: George | last post by:
Hello everyone I know many have helped but I cannot get this to work out correctly. I cannot use BeautifulSoup at all. I need to: Parse the HTML and extracting all the links, convert them to IP...
1
by: Skip | last post by:
Hi, I get the following exception thrown when I try to run my code: "An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll Additional...
4
by: Daedric | last post by:
Hello and thanks in advance to anyone who offers help. To make this simple, let's say I have a game which has 100 different monsters. I want a binary data file to hold all of these. It would...
2
by: alexandre martins | last post by:
Every time i try to make Deserialize the computer gives me the folowing error: "End of Stream encountered before parsing was complete" the code that i'm running is simple and is based on an...
2
by: bvav22 | last post by:
Hey guys, im trying to finish an assignment for a java class, and i have finished the program except for one part. The program requires that i take 3 values inputted from the user, the first 2 must...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.