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

22 lines
479 B
HTML

<html>
<body>
<p>Reports invalid usages of <a href="https://docs.python.org/3/library/typing.html#typing.ClassVar">ClassVar</a> annotations.</p>
<p><b>Example:</b></p>
<pre><code>
from typing import ClassVar
class Cat:
color: ClassVar[str] = "white"
weight: int
def __init__(self, weight: int):
self.weight = weight
Cat.color = "black" # OK
my_cat = Cat(5)
my_cat.color = "gray" # Error, setting class variable on instance
</code></pre>
</body>
</html>