File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 8
8
from copy import deepcopy
9
9
from datetime import datetime
10
10
from enum import StrEnum
11
- from typing import Any , ClassVar , cast
11
+ from typing import Annotated , Any , ClassVar , cast
12
12
from uuid import UUID , uuid4
13
13
14
14
import tiktoken
21
21
BaseModel ,
22
22
ConfigDict ,
23
23
Field ,
24
+ PlainSerializer ,
24
25
computed_field ,
25
26
field_validator ,
26
27
model_validator ,
@@ -59,9 +60,12 @@ class Doc(Embeddable):
59
60
docname : str
60
61
dockey : DocKey
61
62
citation : str
62
- fields_to_overwrite_from_metadata : set [str ] = Field (
63
- default_factory = lambda : set (DEFAULT_FIELDS_TO_OVERWRITE_FROM_METADATA ),
64
- description = "fields from metadata to overwrite when upgrading to a DocDetails" ,
63
+ # Sort the serialization to minimize the diff of serialized objects
64
+ fields_to_overwrite_from_metadata : Annotated [set [str ], PlainSerializer (sorted )] = (
65
+ Field (
66
+ default_factory = lambda : set (DEFAULT_FIELDS_TO_OVERWRITE_FROM_METADATA ),
67
+ description = "fields from metadata to overwrite when upgrading to a DocDetails" ,
68
+ )
65
69
)
66
70
67
71
@model_validator (mode = "before" )
Original file line number Diff line number Diff line change @@ -536,6 +536,7 @@ unfixable = [
536
536
" ERA001" , # While debugging, temporarily commenting code can be useful
537
537
" F401" , # While debugging, unused imports can be useful
538
538
" F841" , # While debugging, unused locals can be useful
539
+ " PIE794" , # Autoremoving the latter of two fields is dangerous
539
540
" RUF059" , # While debugging, unused locals can be useful
540
541
" TC004" , # While debugging, it can be nice to keep TYPE_CHECKING in-tact
541
542
]
You can’t perform that action at this time.
0 commit comments