Exemplo n.º 1
0
def add_test(task, test, answer):
    path = own_dir + FW.make_path(task) + tests_dir
    num = len(FW.getdirs(path))
    name = str(num)
    FW.create_file(path, FW.make_path(name + ".txt"))
    FW.write_text(path, FW.make_path(name + ".txt"), test)
    FW.create_file(path, FW.make_path(name + ".ans"))
    FW.write_text(path, FW.make_path(name + ".ans"), answer)
Exemplo n.º 2
0
def new_submit(user, task, text):
    global submits, own_dir
    new_task(user, task)
    path = own_dir + FW.make_path(user) + FW.make_path(task)
    num = len(FW.getdirs(path))
    name = FW.make_path(str(num))
    FW.create_file(path, name)
    FW.write_text(path, name, text)
Exemplo n.º 3
0
def read():
    global submits, own_dir
    submits = dict()
    #list of str
    ls = FW.getdirs(own_dir)
    for user in ls:
        submits[user] = dict()
    for user in ls:
        now = own_dir + FW.make_path(user)
        tasks = FW.getdirs(now)
        for task in tasks:
            submits[user][task] = []
            now2 = now + FW.make_path(task)
            for sub in FW.getdirs(now2):
                submits[user][task].append(sub)
Exemplo n.º 4
0
def new_task(user, task):
    global submits, own_dir
    new_user(user)
    if task not in submits[user]:
        submits[user][task] = []
        FW.create_folder(own_dir + FW.make_path(user) + FW.make_path(task))
Exemplo n.º 5
0
def new_user(user):
    global submits, own_dir
    if user not in submits:
        submits[user] = dict()
        FW.create_folder(own_dir + FW.make_path(user))
Exemplo n.º 6
0
def add_lesson(name):
    name = FW.make_path(name)
    FW.create_file(own_folder, name)
Exemplo n.º 7
0
def add_task(lesson_name, task_name):
    lesson_name = make_path(lesson_name)
    if folder_exists(own_path +
                     lesson_name) and folder_exists("/.tasks" +
                                                    FW.make_path(task_name)):
        FW.write_text(own_dir, lesson_name, [task_name + "\n"])
Exemplo n.º 8
0
def add_task(task):
    FW.create_folder(own_dir + FW.make_path(task))
    tests = own_dir + FW.make_path(task) + tests_dir
    FW.create_folder(tests)
Exemplo n.º 9
0
def get_test_output(task, num):
    path = own_dir + FW.make_path(task) + tests_dir + "/" + str(num) + ".ans"
    return "".join(FW.to_string(path))    
    
      
Exemplo n.º 10
0
def get_statements(task):
    path = own_dir + FW.make_path(task) + "/statements.txt"
    answer = "".join(FW.to_string(path))
    return answer
Exemplo n.º 11
0
def add_statements(task, text):
    path = own_dir + FW.make_path(task)
    FW.create_file(path, "/statements.txt")
    FW.write_text(path, "/statements.txt", text)