使用以下autopep8
命令:
autopep8 --pep8-passes 2000 --verbose --aggressive --aggressive --ignore=E501,E722
和python代码片段:
parser.add_argument('-a', '--auto', help='Activate automatic semi-intelligent inference for --some-long-flags and --other-long-flags. '
'--some-long-flags will be activated when the primary manifold script is presented with a single-node cluster. '
'--other-long-flags will be enabled when no resources are specified in the helm overrides file.', action='store_true')
最终结果是:
parser.add_argument('-a', '--auto', help='Activate automatic semi-intelligent inference for --some-long-flags and --other-long-flags. '
'--some-long-flags will be activated when the primary manifold script is presented with a single-node cluster. '
'--other-long-flags will be enabled when no resources are specified in the helm overrides file.', action='store_true')
注意--auto
标志的多行缩进现在是如何与parser.add_argument(
块的结尾对齐的,而不是缩进比父级深1级。你知道吗
我明白那是什么。同时,就我个人而言,我鄙视这种格式样式,并发现它:
基于函数字符串名称长度的不一致和任意性。
当不使用IDE或编辑器时手动键入这种样式非常烦人。
我不确定这种代码格式的正确名称是什么,IntelliJ似乎把它称为“连续缩进”。有没有一种方法可以温和地引导autopep8远离强制这种风格?你知道吗
另请参阅the full runnable example code inputs and outputs,其中包含autopep8想要应用的pretty diff view编辑。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐