首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在flake8中,用于视觉缩进的E128续行数不足缩进,E122续行数缺少缩进或缩进

在flake8中,用于视觉缩进的E128续行数不足缩进,E122续行数缺少缩进或缩进
EN

Stack Overflow用户
提问于 2019-09-13 04:09:53
回答 1查看 898关注 0票数 0

我有一个python脚本,flake8检测到我的脚本有一些错误:

代码语言:javascript
运行
复制
231 flake8  
E128 continuation line under-indented for visual indent

232 flake8  
E128 continuation line under-indented for visual indent

234 flake8  
E128 continuation line under-indented for visual indent

235 flake8  
E122 continuation line missing indentation or outdented

236 flake8  
E122 continuation line missing indentation or outdented

下面是我的代码:

代码语言:javascript
运行
复制
t = someFunction (
        data, title=so, Rows=1,
        Widths=[1.2 * inch, 0.3 * inch,
        0.1 * inch, 0.3 * inch, 2 * inch, 3 * inch,
        5.00 * inch],
        style=[("sth1", (0, 0), (-1, -1), "CENTER"),
            ("sth2", (0, 0), (-1, -1), "CENTER"),
            ('sth3', (0, 0), (-1, -1), 0.5, colors.grey),
            ('sth4', (0, 0), (-1, 0), colors.orange),
            ('sth5', (0, 1), (0, -1), colors.orange),
        ])

我尝试了不同的排列,但都不起作用。有人能告诉我如何格式化这个函数吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-13 04:43:05

E122:当您对一个函数的多个参数使用连续行时,它们应该使用普通的4列缩进。

E128:当您将列表、字典、元组等元素分布到多行时,需要将它们靠左对齐。

代码语言:javascript
运行
复制
t = someFunction (
    Widths=[1.2 * inch, 0.3 * inch,
            0.1 * inch, 0.3 * inch, 2 * inch, 3 * inch,
            5.00 * inch],
    style=[("sth1", (0, 0), (-1, -1), "CENTER"),
           ("sth2", (0, 0), (-1, -1), "CENTER"),
           ('sth3', (0, 0), (-1, -1), 0.5, colors.grey),
           ('sth4', (0, 0), (-1, 0), colors.orange),
           ('sth5', (0, 1), (0, -1), colors.orange)]
)

以下是文档:

Continuation line missing indentation or outdented (E122)

Continuation line under-indented for visual indent (E128)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57913873

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档