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