How to disable pylint no-self-use warning?

julka picture julka · Jan 15, 2015 · Viewed 16.3k times · Source

I'm coding in Python3 and using pylint to keep my code clean.

I want to define something like interface class, so I could add more functionality in a clean and concise way, however, pylint gets in the way of this goal.

Here's a sample method:

def on_enter(self, dummy_game, dummy_player): #pylint disable=no-self-use
    """Defines effects when entering area."""
    return None

Here's pylint output:

R: 70, 4: Method could be a function (no-self-use)

The question is:

  1. How do I suppress warning (notice the #pylint comment)? or
  2. How do I tell pylint that this is merely an interface (notice the dummy_game and dummy_player

EDIT: Output of pylint --version:

pylint 1.2.1, 
astroid 1.1.1, common 0.61.0
Python 2.7.8 (default, Oct 20 2014, 15:05:19) 
[GCC 4.9.1]

Answer

julka picture julka · Jan 15, 2015

Turns out I was lacking colon :

I used
pylint disable=no-self-use
when it should have been
pylint: disable=no-self-use

Well, at least I will always have the latest (and the one built for python3) pylint from now on :)