PEP8忽略maxlinelength

2024-05-19 00:41:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我在sublime编辑器中使用PEP8,并具有以下设置:

{
    // autoformat code on save ?
    "autoformat_on_save": true,

    // enable possibly unsafe changes (E226, E24, W6)
    // aggressive level, 0 to disable:
    "aggressive": 0,

    // list codes for fixes; used by --ignore and --select
    "list-fixes": false,

    // do not fix these errors / warnings (e.g. [ "E501" , "E4" , "W"])
    "ignore": [],

    // select errors / warnings (e.g. ["E4", "W"])
    "select": [],

    // Maximum line length
    "max-line-length": 79
}

我的代码如下:

class MyTests(Tests):
    owner =...
    user = ...

    def create_my_cars(self, k):
        for i in range(k):
            p = MyCars.objects.create(license_plate="1234",color="blue",brand="Toyota", currentLocation="Somehwere in somewhere", owner=owner, user=user)

现在,当我保存文件时,PEP8将其分解为:

p = MyCars.objects.create(license_plate="1234",color="blue", brand="Toyota", 
                          currentLocation="Somehwere in somewhere", owner=owner, user=user)

但最后两行仍然比最大行长(79)?你知道吗


Tags: inforonsavecreateselectlistignore

热门问题