#!/usr/bin/env python3 # -*- coding: utf-8 -*- from typing import Self, Any from time import time as timestamp class SessionModel: def __init__(self:Self, id:str) -> None: self.id:str = id self.date_from:float = timestamp() self.date_last:float = timestamp() self.variables:dict[str, Any|None] = {} def set(self:Self, key:str, value:Any|None) -> None: self.date_last = timestamp() self.variables[key] = value def get(self:Self, key:str, default:Any|None = None) -> Any|None: self.date_last = timestamp() return self.variables.get(key, default)