pylint: getting it to understand decorators
<p>pylint doesn't seem to take into account decorators.</p>

<p>I have a decorator such that</p>

<pre><code>@decorator
def foo(arg1, arg2):
    pass
</code></pre>

<p>becomes</p>

<pre><code>def foo(arg2):
    pass
</code></pre>

<p>but pylint keeps complaining that when I call foo I'm missing an argument. I'd rather not disable this warning as it's quite useful even for those decorated functions. Is there a way to <strong>just make it understand, man</strong>?</p>

<p>If you have something like that </p>

<pre><code>def decorator(f):
    def wrapper(*args, **kwargs):
        return f(1, *args, **kwargs)
    return wrapper

@decorator
def z(a, b):
    return a + b

print( z(5) )
</code></pre>

<p>A simple solution that don't ask for too much change in your code is to just forget the @, that is just syntactic sugar. It works for me.</p>

<pre><code>def z(a, b):
    return a + b
z = decorator(z)

print( z(5) )
</code></pre>

python python-decorators pylint