mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
34 lines
746 B
HTML
34 lines
746 B
HTML
<html>
|
|
<body>
|
|
<p>Reports usages of <code>@classmethod</code> or <code>@staticmethod</code> decorators
|
|
in methods outside a class.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class State(object):
|
|
|
|
@classmethod
|
|
def my_state(cls, name):
|
|
cls.name = name
|
|
|
|
|
|
@classmethod
|
|
def change_state(self):
|
|
pass
|
|
</code></pre>
|
|
<p>The <code>change_state</code> method should not use the <code>@classmethod</code> decorator or it should be
|
|
moved to the <code>State</code> class declaration. </p>
|
|
<p>If you apply the <code>Remove decorator</code> action, the code changes to:</p>
|
|
<pre><code>
|
|
class State(object):
|
|
|
|
@classmethod
|
|
def my_state(cls, name):
|
|
cls.name = name
|
|
|
|
|
|
def change_state(self):
|
|
pass
|
|
</code></pre>
|
|
</body>
|
|
</html>
|