Skip to content

Commit

Permalink
Merge pull request #1193 from lsst-sqre/tickets/DM-48196
Browse files Browse the repository at this point in the history
DM-48196: Use type keyword instead of TypeAlias
  • Loading branch information
rra authored Dec 18, 2024
2 parents 0bfa2af + f75983f commit a78f479
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gafaelfawr/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from collections.abc import Iterable
from ipaddress import IPv4Address, IPv6Address
from typing import Annotated, TypeAlias
from typing import Annotated

from pydantic import BeforeValidator, PlainSerializer, PlainValidator
from safir.pydantic import UtcDatetime
Expand Down Expand Up @@ -38,7 +38,7 @@ def _normalize_ip_address(v: str | IPv4Address | IPv6Address) -> str:
return v


IpAddress: TypeAlias = Annotated[str, BeforeValidator(_normalize_ip_address)]
type IpAddress = Annotated[str, BeforeValidator(_normalize_ip_address)]
"""Type for an IP address.
Used instead of ``pydantic.networks.IPvAnyAddress`` because most of Gafaelfawr
Expand Down Expand Up @@ -70,7 +70,7 @@ def _normalize_scopes(v: str | Iterable[str]) -> set[str]:
return set(v)


Scopes: TypeAlias = Annotated[
type Scopes = Annotated[
set[str],
PlainValidator(_normalize_scopes),
PlainSerializer(
Expand All @@ -83,7 +83,7 @@ def _normalize_scopes(v: str | Iterable[str]) -> set[str]:
"""


Timestamp: TypeAlias = Annotated[
type Timestamp = Annotated[
UtcDatetime,
PlainSerializer(lambda t: int(t.timestamp()), return_type=int),
]
Expand Down

0 comments on commit a78f479

Please sign in to comment.