Skip to content

Commit

Permalink
Use old-style unions
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan committed Apr 23, 2024
1 parent dfd0193 commit dbdcb8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mreg_cli/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class IPAddress(FrozenModelWithTimestamps, WithHost, APIMixin["IPAddress"]):

@field_validator("macaddress", mode="before")
@classmethod
def create_valid_macadress_or_none(cls, v: str) -> MACAddressField | None:
def create_valid_macadress_or_none(cls, v: str) -> Union[MACAddressField, None]:
"""Create macaddress or convert empty strings to None."""
if v:
return MACAddressField(address=v)
Expand Down Expand Up @@ -763,7 +763,7 @@ def validate_name(cls, value: str) -> HostT:

@field_validator("comment", mode="before")
@classmethod
def empty_string_to_none(cls, v: str) -> str | None:
def empty_string_to_none(cls, v: str) -> Union[str, None]:
"""Convert empty strings to None."""
return v or None

Expand Down

0 comments on commit dbdcb8c

Please sign in to comment.