mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
15 lines
376 B
Python
15 lines
376 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Postcode:
|
|
value: str
|
|
|
|
def __post_init__(self) -> None:
|
|
# Frozen dataclass: bypass the descriptor with object.__setattr__.
|
|
object.__setattr__(self, "value", "".join(self.value.split()).upper())
|
|
|
|
def __str__(self) -> str:
|
|
return self.value
|