from typing import Protocol from abc import abstractmethod from card import Card class Scheduler(Protocol): @abstractmethod def __init__(self, cards: dict[int, Card], state: dict): raise NotImplementedError @abstractmethod def practice(self, size: int) -> list[int]: raise NotImplementedError @abstractmethod def test(self, size: int) -> list[int]: raise NotImplementedError @abstractmethod def update(self, results: dict[int, int]) -> None: raise NotImplementedError @abstractmethod def getState(self) -> dict: raise NotImplementedError SCHEDULERS = ["brutal"] def getSchedulerClass(name: str) -> Scheduler: match name: case "brutal": from scheduler_brutal import SchedulerBrutal return SchedulerBrutal case _: raise Exception(f"Unknown scheduler: {name}")