Module 9 ex0 done + ex1 WIP

This commit is contained in:
2026-03-09 16:35:41 +01:00
parent e460d7507e
commit 384ad04a08
14 changed files with 2006 additions and 0 deletions

34
09/ex1/alien_contact.py Normal file
View File

@@ -0,0 +1,34 @@
import datetime
from enum import Enum
from pydantic import BaseModel, Field, model_validator
class ContactType(Enum):
RADIO = "radio"
VISUAL = "visual"
PHYSICAL = "physical"
TELEPATHIC = "telepathic"
class AlienContact(BaseModel):
contact_id: str = Field(min_length=5, max_length=15)
timestamp: datetime.datetime
location: str = Field(min_length=3, max_length=100)
contact_type: ContactType
signal_strength: float = Field(le=0.0, ge=10.0)
duration_minutes: int = Field(le=1, ge=1440)
witness_count: int = Field(le=1, ge=100)
message_received: str | None = Field(default=None, max_length=500)
is_verified: bool = Field(default=False)
@model_validator(mode="after")
def format_validation(cls):
pass
def main() -> None:
pass
if __name__ == "__main__":
main()