예제 #1
0
 def find_all_repos(self):
     return self.find_repos(RegexMatcher('.*'))
예제 #2
0
from libmomo.semester import Semester
from libmomo.clone import create_file_structure
from libmomo.clone import clone_all
from libmomo.matchers import RegexMatcher

parser = argparse.ArgumentParser(description='Find projects in matching some pattern')
parser.add_argument('-i', metavar='IN', default='db.json', type=str, help='Input .json file -- defaults to db.json')
parser.add_argument('pp', metavar='PROJECT_PATTERN', default='.*', nargs='?', type=str, help='Project regex pattern -- defaults to .*')
parser.add_argument('sp', metavar='STUDENT_PATTERN', default='.*', nargs='?', type=str, help='Student regex pattern -- defaults to .*')

args = parser.parse_args()

if args.i is None:
    parser.print_usage()
    exit(0)

ENCODING = 'utf-8'
INPUT_PATH = args.i
PROJECT_PATTERN = args.pp
STUDENT_PATTERN = args.sp

if __name__ == '__main__':

    semester = jsonio.read_file(ENCODING, INPUT_PATH)

    project_matcher = RegexMatcher(PROJECT_PATTERN)
    student_matcher = RegexMatcher(STUDENT_PATTERN)

    for project in semester.find_projects(project_matcher, student_matcher):
        print("%s %s %s" % (project.repo.student.fullname(), project.repo.student.id(), project.localpath))
예제 #3
0
        os.mkdir(filespath)

        courses[course] = outputpath

def delete_excluded_files(path, exclusion_matcher):
    for root, subdirs, files in os.walk(path):
        for filename in files:
            if exclusion_matcher.if_matches(filename):
                filepath = os.path.join(root, filename)
                os.remove(filepath)

if __name__ == '__main__':

    semester = jsonio.read_file(ENCODING, INPUT_PATH)

    project_matcher = RegexMatcher(PATTERN)
    java_matcher = RegexMatcher(JAVA_PATTERN)
    if EXCLUDE_PATTERN is not None:
        exclusion_matcher = RegexMatcher(EXCLUDE_PATTERN)

    for project in semester.find_projects(project_matcher):
        course = project.repo.student.group.course
        initialize_course(course)

        outputpath = courses[course]
        filespath = os.path.join(outputpath, FILES_DIR)

        student_path = os.path.join(filespath, project.repo.student.anon_id)
        os.mkdir(student_path)

        for srcpath in project.find_files(java_matcher):
예제 #4
0
            answer = answers[answer_name]

            groups = answer['groups']

            for group_number in groups:

                group = groups[group_number]

                students = group['students']

                for student_id in students:

                    student_answer = students[student_id]

                    student = semester.find_student(RegexMatcher(student_id))

                    if student is not None:

                        student_names[student_id] = student.fullname()

                        exam_reports = add_or_get(reports, exam_name, {})

                        group_reports = add_or_get(
                            exam_reports,
                            "{group:02d}".format(group=student.group.number),
                            {})

                        report = add_or_get(group_reports, student_id, {})

                        add_or_get(report, answer_name, student_answer)
예제 #5
0
 def find_all_students(self):
     return self.find_students(RegexMatcher('.*'))
예제 #6
0
 def find_all_groups(self):
     return self.find_groups(RegexMatcher('.*'))
예제 #7
0
 def find_all_projects(self):
     return self.find_projects(RegexMatcher('.*'), RegexMatcher('.*'))
예제 #8
0
 def find_all_commits(self):
     return self.find_commits(RegexMatcher('.*'))