Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no_classmethod_decorator.py 914B

1234567891011121314151617181920212223242526272829303132333435
  1. """Checks class methods are declared with a decorator if within the class
  2. scope and if classmethod's argument is a member of the class
  3. """
  4. # pylint: disable=too-few-public-methods, using-constant-test, no-self-argument
  5. class MyClass(object):
  6. """Some class"""
  7. def __init__(self):
  8. pass
  9. def cmethod(cls):
  10. """class method-to-be"""
  11. cmethod = classmethod(cmethod) # [no-classmethod-decorator]
  12. if True:
  13. cmethod = classmethod(cmethod) # [no-classmethod-decorator]
  14. @classmethod
  15. def my_second_method(cls):
  16. """correct class method definition"""
  17. def other_method(cls):
  18. """some method"""
  19. cmethod2 = classmethod(other_method) # [no-classmethod-decorator]
  20. def helloworld():
  21. """says hello"""
  22. MyClass.new_class_method = classmethod(helloworld)
  23. class MyOtherClass(object):
  24. """Some other class"""
  25. _make = classmethod(tuple.__new__)