Files
openide/python/python-psi-impl/resources/inspectionDescriptions/PyMethodMayBeStaticInspection.html
Louis Vignier 1869ec9da6 [codeInspection] Fix python inspection descriptions
GitOrigin-RevId: 56876a5dd073a06c3fcc92f63ed1f5674830bc25
2023-04-28 13:13:25 +00:00

28 lines
643 B
HTML

<html>
<body>
<p>Reports any methods that do not require a class instance creation and can be
made static.</p>
<p><b>Example:</b></p>
<pre><code>
class MyClass(object):
def my_method(self, x):
print(x)
</code></pre>
<p>If a <b>Make function from method</b> quick-fix is applied, the code changes to:</p>
<pre><code>
def my_method(x):
print(x)
class MyClass(object):
pass
</code></pre>
<p>If you select the <b>Make method static</b> quick-fix, the <code>@staticmethod</code> decorator is added:</p>
<pre><code>
class MyClass(object):
@staticmethod
def my_method(x):
print(x)
</code></pre>
</body>
</html>