Python-解决PEP8错误

Python-解决PEP8错误,python,github,pep8,Python,Github,Pep8,我正在尝试解决Travis构建在向Firefox UI GitHub repo发出拉取请求后生成的PEP8错误。我已经能够使用pep8库在本地重现这些错误。具体来说,我在一个超过99个字符限制的文件中有以下行: Wait(self.marionette).until(lambda _: self.autocomplete_results.is_open and len(self.autocomplete_results.visible_results) > 1)) 通过pep8运行时产生

我正在尝试解决Travis构建在向Firefox UI GitHub repo发出拉取请求后生成的PEP8错误。我已经能够使用
pep8
库在本地重现这些错误。具体来说,我在一个超过99个字符限制的文件中有以下行:

Wait(self.marionette).until(lambda _: self.autocomplete_results.is_open and len(self.autocomplete_results.visible_results) > 1))
通过
pep8
运行时产生的错误如下所示:

$ pep8 --max-line-length=99 --exclude=client firefox_ui_tests/functional/locationbar/test_access_locationbar.py
firefox_ui_tests/functional/locationbar/test_access_locationbar.py:51:100: E501 line too long (136 > 99 characters)
该行从木偶Python客户端调用
Wait().until()
方法。以前,这一行实际上是两条独立的行:

Wait(self.marionette).until(lambda _: self.autocomplete_results.is_open)
Wait(self.marionette).until(lambda _: len(self.autocomplete_results.visible_results) > 1)
回购经理建议我将这两行合并为一行,但这延长了结果行的长度,导致PEP8错误

我可以把它改回原来的样子,但是有没有办法格式化或缩进行,这样就不会导致这个PEP8错误

提前谢谢。

是的

Wait(self.marionette).until(
    lambda _: (
        self.autocomplete_results.is_open and
        len(self.autocomplete_results.visible_results) > 1
    )
)
检查:

$ pep8 --max-line-length=99 --exclude=client foo.py
帕伦斯去营救!:)