gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / pylint / test / functional / no_staticmethod_decorator.py @ 745
History | View | Annotate | Download (921 Bytes)
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 |
|
5 |
# pylint: disable=too-few-public-methods, using-constant-test, no-method-argument
|
6 |
|
7 |
class MyClass(object): |
8 |
"""Some class"""
|
9 |
def __init__(self): |
10 |
pass
|
11 |
|
12 |
def smethod(): |
13 |
"""static method-to-be"""
|
14 |
smethod = staticmethod(smethod) # [no-staticmethod-decorator] |
15 |
|
16 |
if True: |
17 |
smethod = staticmethod(smethod) # [no-staticmethod-decorator] |
18 |
|
19 |
@staticmethod
|
20 |
def my_second_method(): |
21 |
"""correct static method definition"""
|
22 |
|
23 |
def other_method(): |
24 |
"""some method"""
|
25 |
smethod2 = staticmethod(other_method) # [no-staticmethod-decorator] |
26 |
|
27 |
def helloworld(): |
28 |
"""says hello"""
|
29 |
|
30 |
|
31 |
MyClass.new_static_method = staticmethod(helloworld)
|
32 |
|
33 |
class MyOtherClass(object): |
34 |
"""Some other class"""
|
35 |
_make = staticmethod(tuple.__new__) |