擅长:python、mysql、java
<p>您当前正在忽略此</p>
<pre><code>def on_enter(self, dummy_game, dummy_player): #pylint disable=no-self-use
...
</code></pre>
<p>相反地</p>
<pre><code># pylint: disable=R0201
def on_enter(self, dummy_game, dummy_player):
...
</code></pre>
<hr/>
<p>在文件中添加如下注释</p>
<pre><code># pylint: disable=R0201
</code></pre>
<p>对于<a href="http://docs.pylint.org/features.html#id21">documentation here</a>上的每个警告/错误,您都可以找到简短的代码助记符:</p>
<blockquote>
<p><code>no-self-use (R0201)</code>:</p>
<p>Method could be a function Used when a method doesn’t use its bound instance, and so could be written as a function.</p>
</blockquote>
<p>如果整个文件仅包含接口的代码,则可以将其放在顶部:</p>
<pre><code># pylint: disable=R0201
class SomeInterface(object):
...
...
</code></pre>
<p>如果您还有其他代码,并且希望仅对接口类禁用此项,则可以像</p>
<pre><code># pylint: disable=R0201
class SomeInterface(object):
...
...
# pylint: enable=R0201
class AnotherClass(object):
...
...
</code></pre>