How to instruct autopep8 to remove line breaks?

264 Views Asked by At

How to instruct autopep8 python formatter to remove line breaks if the resulting line after removing the line breaks does not exceed the maximum allowed line length? For example, I have the following code that was previously formatted with --max-line-length 80:

def function(a, b, c):
    pass


function('VERYLOOOOOOOOOOOOONGSTRING',
         'VERYLOOOOOOOOOOOOONGSTRING', 'VERYLOOOOOOOOOOOOONGSTRING')

Now maximum line length is 120. I want autopep8 -i --max-line-length 120 test.py to format it like this:

def function(a, b, c):
    pass


function('VERYLOOOOOOOOOOOOONGSTRING', 'VERYLOOOOOOOOOOOOONGSTRING', 'VERYLOOOOOOOOOOOOONGSTRING')

But it does not remove line breaks. Adding multiple --aggressive options does not help either.

If it's not possible do to with autopep8, what other formatters/software can I use to do it? Thanks in advance!

0

There are 0 best solutions below