We are currently deploying GitLab EE 10.1.0

Formatting, spacing

parent d9ef2880
......@@ -50,6 +50,7 @@ ENTRY_REGEX = re.compile(ENTRY_REGEX)
EXTRACTION_REGEX = r'([A-Z]+)\s+([0-4][0-9V-][0-9-][0-9-])[\s+A-Z-&/]+([0-9])\.000\s([0-9])\.000'
class TranscriptConversionError(Exception):
Error during conversion of unofficial transcript (pdf)
......@@ -92,9 +93,9 @@ def extract_courses(unofficial_transcript):
msg=err_msg, cmd=ps2ascii, err=ascii_err)
matches = ENTRY_REGEX.findall(ascii_out)
matches = re.findall(EXTRACTION_REGEX,'\n'.join(matches))
matches = [(t[0].lower()+t[1],int(t[2]),int(t[3])) for t in matches]
matches = re.findall(EXTRACTION_REGEX, '\n'.join(matches))
matches = [(t[0].lower() + t[1], int(t[2]), int(t[3])) for t in matches]
return matches
......@@ -25,21 +25,23 @@ import os.path as path
Transcript = namedtuple(
'Transcript', ['name', 'degree', 'major', 'year', 'spec', 'courses'])
class CourseNotFoundError(Exception):
Error raised an invalid course is encountered when
generating main.lp
msg = "Course {} was not found in the database.\n"\
"Make sure the class is spelled correctly or try removing this\n"\
"course and running the audit again."
def __init__(self, course):
self.msg = CourseNotFoundError.msg.format("'{}'".format(course))
def __str__(self):
return self.msg
def get_package_dir():
Returns the directory that this package is located.
......@@ -111,7 +113,7 @@ def gen_main(transcript):
# the _taken(<name>,[c1,c2...cn]). atom
taken_list = '_taken({},['.format(transcript.name)
has_taken = str() # series of _hasTaken/2 atoms
req = get_required_courses(
transcript.degree, transcript.major, transcript.year)
......@@ -119,13 +121,13 @@ def gen_main(transcript):
raise err
valid_courses = get_courses()
for course in transcript.courses:
# course not found in databse
if not course in valid_courses:
raise CourseNotFoundError(course)
# include only those courses that could possibly
# counted as electives i.e. those that are not required.
# in the 'taken list' (improves performance)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment