Temporarily switch off mixed tabs and spaces check at runtime

Is there a way how to switch off (and on later) this check at runtime?

The motivation is that I need to use third party libraries which do not care about tabs and spaces mixing and thus running my code with -t switch issues warnings.

(I hope that analogous method can be used for the -b switch.)

edit: I forgot to note, that the library already mixes tabs and spaces in one file and that's why I see the warnings.

Answers


The limitation is only within a module. It's perfectly OK to mix modules with tab indentation and those with space indentation inside the same project.

I can't think of a situation where you'd ever want to mix tabs and spaces in the same file and therefore wouldn't want to check for it.


I don't know a runtime switch like you describe, but converting a library from mixed to spaces-only isn't hard, if you have a copy you can edit: In the shell:

touch temp.py; for x in $(find /path/to/library/ -name '*.py' -print); do expand -it 4 $x > temp.tmp; cat temp.tmp > $x; done; rm temp.tmp

Replace /path/to/library/ with the path you your library files directory.

Personally, I prefer tabs to spaces, but this will prevent the warnings and shouldn't have many unforeseen consequences. One consequence you should be aware of is that leading tabs in multi-line string literals will also be converted to spaces.

Converting from mixed or spaces to tabs is also possible, like with the unexpand program. However, conversion from spaces/mixed to tabs is much harder and more error prone, since spaces are syntactically ambiguous.


Need Your Help

Displaying generic type parameters from compiled class files

java generics javap

Is there a tool similar to javap that could display methods and fields with their original (non-erased) types?

C# string encryption performance

c# performance encryption

I have a class with a bunch of fields that need to be encrypted before being saved, something like this;