mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-03-14 05:06:55 +01:00
Module 9 ex0 done + ex1 WIP
This commit is contained in:
34
09/ex1/alien_contact.py
Normal file
34
09/ex1/alien_contact.py
Normal 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()
|
||||
Reference in New Issue
Block a user