homework_checker/core/md_writer.py
def update(self: "MdWriter", hw_results: Dict[str, HomeworkResultDict]):
        """Update the table of completion."""
        for hw_name, hw_dict in sorted(hw_results.items()):
            hw_name = remove_number_from_name(hw_name)
            need_hw_name = True
            expired = False
            if EXPIRED_TAG in hw_dict:
                expired = True
            for task_name, ex_dict in sorted(hw_dict.items()):
                task_name = remove_number_from_name(task_name)
                if task_name == EXPIRED_TAG:
                    # Maybe there is a better way to handle this, but I don't
                    # want to dig into this right now. We have added the
                    # EXPIRED_TAG to this dict and need to ignore it here.
                    continue
                need_task_name = True
                for test_name, test_result in sorted(ex_dict.items()):
                    test_name = remove_number_from_name(test_name)
                    result_sign = SUCCESS_TAG if test_result.succeeded() else FAILED_TAG
                    extended_hw_name = (
                        hw_name + " `[PAST DEADLINE]`" if expired else hw_name
                    )
                    self._md_table += TABLE_TEMPLATE.format(
                        hw_name=extended_hw_name if need_hw_name else "",
                        task_name=task_name if need_task_name else "",
                        test_name=test_name,
                        result_sign=result_sign,
                    )
                    self._add_error(hw_name, task_name, test_name, test_result, expired)
                    need_hw_name = False  # We only print homework name once.
                    need_task_name = False
Update the table of completion.
Update the table of completion.
Update the table of completion .
def update(self: "MdWriter", hw_results: Dict[str, HomeworkResultDict]):
        for hw_name, hw_dict in sorted(hw_results.items()):
            hw_name = remove_number_from_name(hw_name)
            need_hw_name = True
            expired = False
            if EXPIRED_TAG in hw_dict:
                expired = True
            for task_name, ex_dict in sorted(hw_dict.items()):
                task_name = remove_number_from_name(task_name)
                if task_name == EXPIRED_TAG:
                    continue
                need_task_name = True
                for test_name, test_result in sorted(ex_dict.items()):
                    test_name = remove_number_from_name(test_name)
                    result_sign = SUCCESS_TAG if test_result.succeeded() else FAILED_TAG
                    extended_hw_name = (
                        hw_name + " `[PAST DEADLINE]`" if expired else hw_name
                    )
                    self._md_table += TABLE_TEMPLATE.format(
                        hw_name=extended_hw_name if need_hw_name else "",
                        task_name=task_name if need_task_name else "",
                        test_name=test_name,
                        result_sign=result_sign,
                    )
                    self._add_error(hw_name, task_name, test_name, test_result, expired)
                    need_hw_name = False  
                    need_task_name = False
def update ( self : "MdWriter" , hw_results : Dict [ str , HomeworkResultDict ] ) : for hw_name , hw_dict in sorted ( hw_results . items ( ) ) : hw_name = remove_number_from_name ( hw_name ) need_hw_name = True expired = False if EXPIRED_TAG in hw_dict : expired = True for task_name , ex_dict in sorted ( hw_dict . items ( ) ) : task_name = remove_number_from_name ( task_name ) if task_name == EXPIRED_TAG : continue need_task_name = True for test_name , test_result in sorted ( ex_dict . items ( ) ) : test_name = remove_number_from_name ( test_name ) result_sign = SUCCESS_TAG if test_result . succeeded ( ) else FAILED_TAG extended_hw_name = ( hw_name + " `[PAST DEADLINE]`" if expired else hw_name ) self . _md_table += TABLE_TEMPLATE . format ( hw_name = extended_hw_name if need_hw_name else "" , task_name = task_name if need_task_name else "" , test_name = test_name , result_sign = result_sign , ) self . _add_error ( hw_name , task_name , test_name , test_result , expired ) need_hw_name = False need_task_name = False
Update the table of completion.
Update the table of completion .
"""Update the table of completion.""" # Maybe there is a better way to handle this, but I don't # want to dig into this right now. We have added the # EXPIRED_TAG to this dict and need to ignore it here. # We only print homework name once.
self
"MdWriter"
hw_results
Dict[str, HomeworkResultDict]