Is it possible to locally disable a particular message?
Yes, this feature has been added in Pylint 0.11. This may be done by adding # pylint: disable=some-message,another-one
at the desired block level or at the end of the desired line of code
您可以使用消息代码或符号名称。
例如
def test():
# Disable all the no-member violations in this function
# pylint: disable=no-member
...
Pylint消息控件记录在the Pylint manual:
您可以使用消息代码或符号名称。
例如
手册还有further examples。
有a wiki记录所有pylint消息及其代码。
我相信你要找的是。。。
请注意注释前的双空格,以避免碰到其他格式警告。
另外,根据您的IDE(如果您使用的是IDE),可能有一个选项来添加正确的忽略规则(例如在eclipse中,当光标位于警告上方时按CtrlCtrl1kbd>
这很简单,而且是针对这一行的。
正如斯泰诺善意地指出的,你可以而且应该使用更可读的形式:
相关问题 更多 >
编程相关推荐