473,700 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3756
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\r eindent.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\r eindent.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******** *************** *************** *@python.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\r eindent.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****@LacusVe ris.comschrieb im Newsbeitrag
news:ma******** *************** *************** *@python.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******** *************** *************** *@python.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
7015
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 want. However, when editing code in eclipse i do not see any of the formatting specifications being applied in my code. For instance, this code: public Component getIndicator(int x, int y);
2
1740
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 idea how to pass the handle from the calling code into the modules.. So basically here is what I do.. -- Main Program --
1
4431
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." C# Code ----------- System.Messaging.MessageQueue myInputQueue = new System.Messaging.MessageQueue(@".\Private$\InputQueue"); ((XmlMessageFormatter)myInputQueue.Formatter).TargetTypes = new Type{typeof(Order)};
4
2148
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 href="wap://xxx.xxx.xxx" xxx>xxx xxx<a href="http://xxx.xxx.xxx" xxx>xxx ..... And I want to find all the "http://xxx.xxx.xxx" out, so I do it
4
1236
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 addresses, and build a list of all these IP addresses, thwn I need to sort the list and remove the duplicates so that unit testing will work. Please help I have never done python before and I can't seem to get the hang of it. """ Module to print...
1
1426
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 information: Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed."
4
1702
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 have the index number of the mob, name, size, attributes, etc. I can easily create an editor to edit the records in this file, as soon as I know how to create this file and be able to find a specific monster in the file and fill, say, text boxes...
2
2426
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 MSDN example. The CODE is BELOW this lines. If you see something wrong or missing please answer. Class declaration:
2
2098
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 be digits between 0 and 9, and the third an operator. the operator decides if the two numbers are added subtracted...etc. anyways the things i cannot get, is i need to check if they enter valid digits, and not letters, however if i do put a letter...
0
9210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8968
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7805
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5900
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3086
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2389
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2025
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.