Autopep8没有打破长评论行?

时间:2014-01-29 18:05:10

标签: python pep8

我尝试使用autopep8格式化一些python代码,期望超过80个字符的注释行将被拆分,等等。我使用了这个测试文件test.py,它只包含注释:

#asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
#asdf asdf asdf asdf
#asdf asdf asdf asdf

#asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
#asdf asdf asdf asdf
#asdf asdf asdf asdf
#asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf

然后我跑了autopep8 test.py

这给出了以下输出:

# asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
# asdf asdf asdf asdf
# asdf asdf asdf asdf

# asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
# asdf asdf asdf asdf
# asdf asdf asdf asdf
# asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
# asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf

最后一行是拆分,但前两行不是。我想所有的线都要打破80个字符宽。我做错了什么?

1 个答案:

答案 0 :(得分:4)

autopep8不会自动修复所有长行;只有在被认为是“安全”的情况下才会这样做。看到: https://github.com/hhatto/autopep8/issues/39