python - pep8- 视觉缩进缩进下的续行

标签 python eclipse pydev

我在我的 eclipse 上运行一个 pep-8 并且遇到了这个错误并且不知道如何修复它..

'''
Created on Aug 31, 2015

@author: testuser
'''


def telemetry_client_show_alarm_history_testststsststst(id1, name):
    pass

show_alarm = telemetry_client_show_alarm_history_testststsststst('alarm_id',
                                            'tessdlkjsdsdsdsdsdsdsdt')

错误

E128 continuation line under-indented for visual indent

我该如何解决这个错误?

注意:方法名称是虚拟名称,用于在 eclipse 中重现此错误..

最佳答案

当函数调用跨行中断时,第二个和后续参数在视觉上应与第一个参数对齐,如下所示:

show_alarm = telemetry_client_show_alarm_history_testststsststst('alarm_id',
                                                                 'tessdlkjsdsdsdsdsdsdsdt')

如果这会产生不良结果,例如行太长,您可以在第一个参数之前添加一个换行符,如下所示:

show_alarm = telemetry_client_show_alarm_history_testststsststst(
    'alarm_id',
    'tessdlkjsdsdsdsdsdsdsdt')

关于python - pep8- 视觉缩进缩进下的续行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32315995/

相关文章:

Python Concurrency ThreadPoolExecutor - 如果满足条件则停止执行

python - Numpy 反转不可逆矩阵

java - 在 Eclipse 的 Debug模式下动态执行命令/代码

python - pycharm "Note that you cannot install any Python packages into Docker-based project interpreters."

python - Excel 文件和 DataFrame 没有数字数据可绘制错误

java - 在 Eclipse 中创建 Hibernate 项目时显示的错误

java - 如何将 PostgreSQL 与 Spring Mvc 连接

python - 单元测试导入失败——缺少符号

使用 Pydev 进行 Django/Docker/远程调试

python - 有没有办法在 PyDev 项目中抑制 eclipse 中 Unresolved 导入?