mod_python icon indicating copy to clipboard operation
mod_python copied to clipboard

indentation format should be configurable (or default to 4 spaces)

Open paulie4 opened this issue 5 years ago • 3 comments

If I'm reading this code correctly, it looks like a tab (\t) is hard-coded as the additional indentation format, even though PEP 8 says, "Spaces are the preferred indentation method." Can this be made configurable or maybe default to 4 spaces instead of a tab character, since this causes errors if the next line of code at the same level uses spaces instead of tabs?

paulie4 avatar Aug 21 '20 03:08 paulie4

Pull requests are welcome!

grisha avatar Aug 24 '20 13:08 grisha

I'm not familiar at all with this code and just searched for what would be adding the \t indent. Do you have a suggestion for what should be done to make it configurable (although, I'm not sure if/when I'll get a chance to implement the changes)? Thanks!

paulie4 avatar Aug 24 '20 14:08 paulie4

What we ended up doing was this workaround:

rawPsp = _psp.parse(...)
cleanPsp = re.sub(r'^(\s+)', lambda x: x.group(1).replace('\t', '    '), rawPsp, flags=re.MULTILINE)

paulie4 avatar Sep 04 '20 21:09 paulie4