我正在尝试解决由Travis生成的PEP8错误,这些错误是在对Firefox回购程序的拉请求之后生成的。我已经能够使用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)该行从Marionette客户端调用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错误。
提前谢谢。
发布于 2015-06-13 15:19:06
是;
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拯救父母!:)
https://stackoverflow.com/questions/30820242
复制相似问题