Skip to content

Commit

Permalink
change color to annotated type
Browse files Browse the repository at this point in the history
  • Loading branch information
elsholz committed Jan 13, 2024
1 parent df41bd1 commit 666b376
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions api/code/metroplanner_api/type_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ class MissingValueBaseClass(BaseModel):
MaybeLocalizedShortText = Union[LocalizedShortText, ShortText]
MaybeLocalizedLongText = Union[LocalizedLongText, LongText]
Identifier = Annotated[str, pydantic.StringConstraints(max_length=36, min_length=36)]
ColorCSS = pydantic_extra_types.color.Color
ColorReference = pydantic.constr(
pattern=(
r"(^(fore|back)ground$)"
r"|(^landscape::(((deep|shallow)?water)|border)$)"
r"|(^lines::\d{1,3}$)"
)
)
# ColorCSS = pydantic_extra_types.color.Color
ColorCSS = Annotated[str, pydantic_extra_types.color.Color]
ColorReference = Annotated[
str,
pydantic.StringConstraints(
pattern=(
r"(^(fore|back)ground$)"
r"|(^landscape::(((deep|shallow)?water)|border)$)"
r"|(^lines::\d{1,3}$)"
)
),
]
Color = Union[ColorReference, ColorCSS]


# Point = Tuple[IntOrFloat, IntOrFloat]

Point = pydantic.conlist(IntOrFloat, min_length=2, max_length=2)


Expand Down Expand Up @@ -205,7 +206,7 @@ class CreatePlanstate(
PlanstateDimensions,
PlanstateComponents,
# PlanstateComponentOderings
ModelMayMissFields,
ModelMayMissFields,
):
color_theme: MaybeMissing(Optional[Union[str, ObjectId]]) = Missing
make_current: bool = False
Expand Down

0 comments on commit 666b376

Please sign in to comment.