def display_test_results(data): results = [] results.append('Student: %s' % data['student']) results.append('URL: %s' % data['url']) for i, r in enumerate(data['requirements']): results.append('Requirement %s: %s, %s, %s' % (r.num, r.selector, r.actual, r.status)) return text_join(results)
def list_projects(course): results = [] for p in Project.objects.filter(course__name=course).order_by('due'): results.append('\nProject %s' % p) for r in p.requirements: results.append(' selector=%s, transform=%s' % (r.selector, r.transform)) return text_join(results)
def list_assignments(course): assigned = [ '\n\nAssignments for %s: project due status last update\n' % course ] for h in Assignment.objects.filter(project__course__name=course): assigned.append(str(h)) return text_join(assigned)
def list_functions(): functions = [] files = code_files() for code in files: text = open(code).read() functions.append(code + ':') functions.append(' ' + '\n '.join(find_functions(text))) return text_join(functions)
def display_requirements(project): results = [] for i, r in enumerate(project.requirements): results.append('\nRequirement #%s: %s \n' % (r.num, r.selector)) results.append(' Correct Output: \n %s' % r.correct) results.append(' Actual Output: \n %s' % r.actual) results.append(' Transform Output: \n %s' % r.transform) results.append(' Test Status: \n %s' % r.results) return text_join(results)
def list_course_content(): data = [banner('Course Content Data')] data += Course.list() for c in unc_courses(): data.append(banner(c)) data.append('\nPROJECTS:\n') data += [str(p) for p in Project.list(c)] data.append('\nLESSONS:\n') data += Lesson.list(c) data.append('\nSTUDENTS:') data.append(list_students(c)) # data.append('\nASSIGNMENTS:') # data.append(list_assignments(c)) return text_join(data)
def render_slides(text, **kwargs): def slides_text(text): slides = ['### ' + s for s in text.split('### ')[1:]] return slides def create_slide_section(title, body): return dict(title=title, text=body, slides=slides_text(body)) def render_sections(markdown_text): output = [] sections = markdown_text.split("\n## ") for text in sections: body = fix_images(text, '../images') title = text_lines(text)[0] settings = create_slide_section(title, body) output.append(settings) return output def render_section(section, kwargs): kwargs.update(section) return render_to_string("slides_section.html", kwargs) return text_join( [render_section(s, kwargs) for s in render_sections(text)][1:])
def list_students(course): return ("\nStudents %s:\n" % course) + text_join( [str(s) for s in Course.students(course)])
def show_course_files(course): return banner(course) + text_join( recursive_list('Documents/unc/%s' % course))
def import_schedule(course): table = read_schedule(course) for row in table[2:]: add_lesson(course, row) return text_join(Lesson.list(course))
def import_all_students(): import_students('bacs350') import_students('bacs200') print(text_join([list_students(c) for c in unc_courses()]))
def show_assignments(): return text_join([list_assignments(c) for c in Course.all()])
def list_users(): return text_join([list_user_login(u) for u in User.objects.all()])
def task_recent_days_test(): return text_join([d for d in enumerate_days(to_date(today()), 7)])
def code_html_files_test(): return text_join(html_files())
def code_files_test(): return text_join(code_files('tool') + code_files('mybook'))
def code_doc_files_test(): return text_join(doc_files())
def files(path): if not path: path = ['.'] print("code files %s:" % path[0]) print(text_join(code_files(path[0])))
def no_blank_lines(text): text = text_lines(text) text = [x for x in text if x.strip() != ''] text = text_join(text) return text