Python 缩进多行字符串,而不是使用autopep8与函数名结尾对齐

Python 缩进多行字符串,而不是使用autopep8与函数名结尾对齐,python,pep8,autopep8,Python,Pep8,Autopep8,使用以下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. '

使用以下
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
标志的多行缩进现在是如何与
解析器的结尾对齐的。添加_参数(
块,而不是比父级缩进1级

我明白这是什么。同时,就我个人而言,我鄙视这种格式风格,并发现它:

  • 基于函数字符串名称的长度不一致且任意

  • 如果不使用IDE或具有此样式意识的编辑器,手动键入非常烦人

我不确定这种代码格式的正确名称是什么,IntelliJ似乎将其称为“延续缩进”。有没有办法避免强制使用这种样式



另请参阅autopep8希望应用的编辑。

PEP-8似乎建议将
-a
等移到第二行。是的,此解决方案避免了难看的连续缩进!如果可能,我仍然很想了解如何完全禁用该行为。