@@ -33,11 +33,14 @@ def _parse_optional_float(v: Any) -> float | None:
3333 return float (v )
3434
3535
36- # Reusable annotated types for optional fields that may come as empty strings
37- OptionalDatetime = Annotated [datetime | None , BeforeValidator (_parse_optional_datetime )]
38- OptionalFloat = Annotated [float | None , BeforeValidator (_parse_optional_float )]
36+ # Reusable annotated types for optional fields that may come as empty strings.
37+ # PEP 695 named aliases (requires pydantic>=2.11 for full support).
38+ type OptionalDatetime = Annotated [
39+ datetime | None , BeforeValidator (_parse_optional_datetime )
40+ ]
41+ type OptionalFloat = Annotated [float | None , BeforeValidator (_parse_optional_float )]
3942# Coerces a nullable value (e.g. a datetime or None) into a bool (present = True)
40- IsPresent = Annotated [bool , BeforeValidator (lambda v : v is not None and v != "" )]
43+ type IsPresent = Annotated [bool , BeforeValidator (lambda v : v is not None and v != "" )]
4144
4245
4346class GoalStatus (StrEnum ):
@@ -370,7 +373,8 @@ class HeadlineDetails(BloomyBaseModel):
370373 closed_at : str | None = None
371374
372375
373- # HeadlineListItem is identical to HeadlineDetails - use type alias
376+ # HeadlineListItem is identical to HeadlineDetails - use assignment alias so the
377+ # name remains callable (PEP 695 `type` produces a non-callable TypeAliasType).
374378HeadlineListItem = HeadlineDetails
375379
376380
0 commit comments