Имхо надо избавиться от дополнительного словаря
Step:
self.id = 0 # step_id, use in update and delete, filled by create method
self.name = 'text' # todo: various types (text, question, video, task)
self.lesson_id = 0 # todo: lesson_id, should be filled, need for create and update requests
self.position = 0 # step position in lesson, from 1
self.text = ''
self.step_type = StepType.TEXT
self.config = {} <--- вот тут конфигурация началась
self.score = Step.Cost.DEFAULT
StepTask:
def init(self, lang):
super().init()
# self.cost = Step.Cost.DEFAULT_TASK
self.text = ''
self.code = ''
self.name = 'code'
self.test_cases = []
self.samples_count = Step.DEAFAULT_TST_NUM
self.header = ''
self.footer = ''
self.lang = lang
self.generate = ''
self.checker = ''
self.solve = ''
self.params = {
'name': None,
'repo': None,
'statement': None,
# 'checker': '',
# 'solution': '',
# 'generate': '',
'tests': None,
'visible_tst_num': None,
'score': Step.Cost.DEFAULT_TASK,
'lang': None,
'header': None,
'footer': None
}
Почему этот словарь по сути дублирует self.config?
StepTaskinline
elif mode == InputState.Config:
d = parse_config(text)
self.config.update(d) <--- пишет в config
print(f'config = {self.config}')
Имхо надо избавиться от дополнительного словаря
Step:
self.id = 0 # step_id, use in update and delete, filled by create method
self.name = 'text' # todo: various types (text, question, video, task)
self.lesson_id = 0 # todo: lesson_id, should be filled, need for create and update requests
self.position = 0 # step position in lesson, from 1
self.text = ''
self.step_type = StepType.TEXT
self.config = {} <--- вот тут конфигурация началась
self.score = Step.Cost.DEFAULT
StepTask:
def init(self, lang):
super().init()
# self.cost = Step.Cost.DEFAULT_TASK
self.text = ''
self.code = ''
self.name = 'code'
self.test_cases = []
self.samples_count = Step.DEAFAULT_TST_NUM
self.header = ''
self.footer = ''
self.lang = lang
StepTaskinline
elif mode == InputState.Config:
d = parse_config(text)
self.config.update(d) <--- пишет в config
print(f'config = {self.config}')