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_staticmethod_decorator.py 921B

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