Untitled
raw download clone
TEXT
views 35
,
size 848 b
def __init__(self):
        self.task_ent_quest_handlers = dict()
        self.task_ent_variants_handlers = dict()

    def make_ent_quest_and_vars_handlers(self, types, model):
        def quest_dicts_maker(function):
            for ty in types:
                self.task_ent_quest_handlers[ty] = function

        def vars_dicts_maker(function):
            for ty in types:
                self.task_ent_variants_handlers[ty] = function

        if model == Concept:
            return quest_dicts_maker
        else:
            return vars_dicts_maker


@task.make_ent_quest_and_vars_handlers(('writeAnswer', 'chooseOne', 'chooseSeveral',
                                            'removeWrong', 'list-items', 'list-sequence'), Thesis)
    def handle_other_vars(self, q_entity: t.Union[ConceptStorage, ThesisStorage],
close fullscreen
Login or Register to edit or fork this paste. It's free.