Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decorator that returns a @classmethod triggers no-value-for-parameter #3209

Closed
AlexRiina opened this issue Oct 21, 2019 · 0 comments
Closed

Comments

@AlexRiina
Copy link

AlexRiina commented Oct 21, 2019

Steps to reproduce

Here's a snippet with two equivalent decorators (klassmethod1, klassmethod2) that call classmethod slightly differently. klassmethod1 triggers pylint errors while klassmethod2 is fine, but both work when executed.

def klassmethod1(method):
    @classmethod
    def inner(cls):
        return method(cls)

    return inner


def klassmethod2(method):
    def inner(cls):
        return method(cls)

    return classmethod(inner)


class X(object):
    @klassmethod1
    def x(cls):  # triggers no-self-argument
        return 'X'

    @klassmethod2
    def y(cls):
        return 'Y'


print(X.x())  # triggers no-value-for-parameter
print(X.y())

pylint --version output

pylint 2.4.3
astroid 2.3.2
Python 3.6.8 (default, Apr  3 2019, 16:37:35)
[GCC 7.3.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant