# Path: submit/helpers.py
# def alphanum_key(string):
#     """Return a comparable tuple with extracted number segments.
# 
#     Adapted from: http://stackoverflow.com/a/2669120/176978
# 
#     """
#     convert = lambda text: int(text) if text.isdigit() else text
#     return [convert(segment) for segment in re.split('([0-9]+)', string)]


import xml.sax.saxutils
            import pprint
            import pprint
from diff_match_patch import diff_match_patch as DMP
from .helpers import alphanum_key
                right_buffer.append(line)

    for item, _, _ in yield_buffer(lineno_left, lineno_right):
        yield item


class Renderable(object):
    INCORRECT = '<a href="#{1}" style="color:red">{0}</a>'
    CORRECT = '<p style="color:green;margin:0;padding:0;">{0}</p>'
    HTML_ROW = '<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>'

    MAPPING = {
        'nonexistent_executable': ('The expected executable was not produced '
                                   'during make'),
        'output_limit_exceeded': 'Your program produced too much output',
        'signal': 'Your program terminated with signal {0}',
        'timed_out': 'Your program timed out'}

    def __init__(self, number, group, name, points, status, extra):
        self.number = number
        self.group = esc(group)
        self.name = esc(name)
        self.points = points
        self.status = status
        self.extra = extra
        self.custom_output = ''
        self.id = '{}_{}'.format(number, esc(name))

    def __cmp__(self, other):
        groups = cmp(alphanum_key(self.group),

# Path: submit/helpers.py
# def alphanum_key(string):
#     """Return a comparable tuple with extracted number segments.
# 
#     Adapted from: http://stackoverflow.com/a/2669120/176978
# 
#     """
#     convert = lambda text: int(text) if text.isdigit() else text
#     return [convert(segment) for segment in re.split('([0-9]+)', string)]


# Path: submit/diff_unit.py
import xml.sax.saxutils
            import pprint
            import pprint
from diff_match_patch import diff_match_patch as DMP
from .helpers import alphanum_key

                right_buffer.append(line)

    for item, _, _ in yield_buffer(lineno_left, lineno_right):
        yield item


class Renderable(object):
    INCORRECT = '<a href="#{1}" style="color:red">{0}</a>'
    CORRECT = '<p style="color:green;margin:0;padding:0;">{0}</p>'
    HTML_ROW = '<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>'

    MAPPING = {
        'nonexistent_executable': ('The expected executable was not produced '
                                   'during make'),
        'output_limit_exceeded': 'Your program produced too much output',
        'signal': 'Your program terminated with signal {0}',
        'timed_out': 'Your program timed out'}

    def __init__(self, number, group, name, points, status, extra):
        self.number = number
        self.group = esc(group)
        self.name = esc(name)
        self.points = points
        self.status = status
        self.extra = extra
        self.custom_output = ''
        self.id = '{}_{}'.format(number, esc(name))

    def __cmp__(self, other):
        groups = cmp(alphanum_key(self.group),

                     alphanum_key(other.group))