OpoTests/Python/Models/QuestionModel.py

20 lines
739 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Self, Any
from Utils.Check import Check
from Models.SetModel import SetModel
class QuestionModel:
def __init__(self:Self, data:dict[str, str|list[str]|bool|None], set:SetModel) -> None:
questions:str|list[str] = data.get("questions", [])
self.set:int = set.i
self.group:int = set.group_i
self.questions:list[str] = questions if Check.is_array(questions) else [questions]
self.rights:list[str] = data.get("rights")
self.wrongs:list[str] = data.get("wrongs", [])
self.own_variables:dict[str, Any] = data.get("own_variables", {})
self.brothers_are_wrongs:bool = data.get("brothers_are_wrongs", True)