I have some Python code that have inconsistent indentation. There is a lot of mixture of tabs and spaces to make the matter even worse, and even space indentation is not pre
Use the reindent.py
script that you find in the Tools/scripts/
directory of your Python installation:
Change Python (.py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files. Also ensure the last line ends with a newline.
Have a look at that script for detailed usage instructions.