blob: 2b78f3e96fc7f76690c8e420ba8cb3fe1688c180 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#from __future__ import annotations
from typing import ClassVar, Dict, get_type_hints
from dataclasses import *
class Starship:
stats: ClassVar[Dict[str, int]] = {}
#print(get_type_hints(Starship))
#class A:
# a: Dict[int, C]
#print(get_type_hints(A))
cv = [ClassVar[int]]
@dataclass
class C:
CVS = [ClassVar[str]]
a: cv[0]
b: 'C'
c: 'CVS[0]'
x: 'ClassVar["int"]'
y: 'ClassVar[C]'
print()
print(C.__annotations__)
print(C.__dataclass_fields__)
#print(get_type_hints(C))
|