简体   繁体   中英

Undo shorter line-length when formatting Python code

I accidentally ran Black without --line-length . My company uses a line-length of 110. Now all of the code has been formatted to 80. How can I undo this? Running black --line-length 110 has no effect. Cheers.

You can revert the change using your version source control (you use a VCS, right ?). Theoretically, if you're not you could revert by removing the magic comma black added and launch black again. Ie if the new code is:

def function(
    a,
    b,
):
    pass

Then:

def function(
    a,
    b
):
    pass

Would be reformatted properly if you relaunch black with -l 110 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM