|
2 | 2 | import uuid |
3 | 3 | from datetime import datetime |
4 | 4 | from functools import cached_property |
5 | | -from typing import List, Optional |
| 5 | +from typing import List, Optional, Annotated |
6 | 6 |
|
7 | 7 | import odin |
8 | 8 | from odin.annotated_resource import Options |
@@ -43,25 +43,25 @@ class Meta: |
43 | 43 | max_length=32, |
44 | 44 | ) |
45 | 45 | num_pages: Optional[int] |
46 | | - rrp: float = odin.Options( |
47 | | - 20.4, |
48 | | - use_default_if_not_provided=True, |
49 | | - ) |
| 46 | + rrp: Annotated[float, Options(use_default_if_not_provided=True)] = 20.4 |
50 | 47 | fiction: bool = True |
51 | | - genre: str = Options( |
52 | | - choices=( |
53 | | - ("sci-fi", "Science Fiction"), |
54 | | - ("fantasy", "Fantasy"), |
55 | | - ("biography", "Biography"), |
56 | | - ("others", "Others"), |
57 | | - ("computers-and-tech", "Computers & technology"), |
| 48 | + genre: Annotated[ |
| 49 | + str, |
| 50 | + Options( |
| 51 | + choices=( |
| 52 | + ("sci-fi", "Science Fiction"), |
| 53 | + ("fantasy", "Fantasy"), |
| 54 | + ("biography", "Biography"), |
| 55 | + ("others", "Others"), |
| 56 | + ("computers-and-tech", "Computers & technology"), |
| 57 | + ), |
58 | 58 | ), |
59 | | - ) |
60 | | - published: List[datetime] |
| 59 | + ] |
| 60 | + published: list[datetime] |
61 | 61 | authors: List[Author] = odin.Options( |
62 | 62 | use_container=True, |
63 | 63 | ) |
64 | | - publisher: Optional[Publisher] |
| 64 | + publisher: None | Publisher |
65 | 65 |
|
66 | 66 | A_CONST = "Foo Bar" |
67 | 67 |
|
|
0 commit comments