22import functools
33from collections import OrderedDict
44from enum import Enum , unique
5- from typing import Union , Annotated , Callable
5+ from typing import Union , Annotated
6+ from collections .abc import Callable
67
78import pandas as pd
89from pydantic import (
1819 ConfigDict ,
1920)
2021from typing_extensions import (
21- Literal ,
2222 Any ,
2323 Self ,
24- Concatenate ,
2524 ParamSpec ,
2625 TypeVar ,
2726)
27+ from typing import Literal , Concatenate
2828
2929
3030@unique
@@ -155,7 +155,7 @@ def __str__(self):
155155 return f'{{type={ self .type .name } , name="{ self .name } "}}'
156156
157157
158- def _to_time (value : Union [ dt .time , str ] ):
158+ def _to_time (value : dt .time | str ):
159159 """
160160 Convert value to time.
161161
@@ -230,7 +230,7 @@ class DayMeta(BaseModel, validate_assignment=True, extra="forbid"):
230230 tags : Tags = []
231231
232232 # Free-form comment.
233- comment : Union [ str , None ] = Field (default = None , examples = ["This is a comment." ])
233+ comment : str | None = Field (default = None , examples = ["This is a comment." ])
234234
235235 @model_validator (mode = "after" )
236236 def _canonicalize (self ) -> "DayMeta" :
@@ -459,7 +459,7 @@ def set_tags(self, meta: DayMeta, tags: Tags) -> DayMeta:
459459
460460 @_with_meta
461461 @validate_call
462- def set_comment (self , meta : DayMeta , comment : Union [ str , None ] ) -> DayMeta :
462+ def set_comment (self , meta : DayMeta , comment : str | None ) -> DayMeta :
463463 """
464464 Set the comment for a given day.
465465
@@ -482,7 +482,7 @@ def set_comment(self, meta: DayMeta, comment: Union[str, None]) -> DayMeta:
482482
483483 @_with_meta
484484 @validate_call
485- def set_meta (self , meta : DayMeta , meta0 : Union [ DayMeta , None ] ) -> DayMeta :
485+ def set_meta (self , meta : DayMeta , meta0 : DayMeta | None ) -> DayMeta :
486486 """
487487 Set the metadata for a given day.
488488
0 commit comments