mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
22 lines
479 B
HTML
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> |