xdufacool/collect_local.py
def find_duplication(homework):
    """Find duplications in submitted homework."""
    re_id = re.compile(r'(?P<stuid>[0-9]{10,11})')
    dup_check = dict()
    with open(homework, 'r') as data:
        lines = data.readlines()
        for ln in lines:
            dt = ln.split()
            csum, right = dt[0], dt[1]
            if csum not in dup_check:
                dup_check[csum] = list()
            m = re_id.search(right)
            if m is not None:
                stu_id = m.group('stuid')
                dup_check[csum].append(stu_id)
    dup_check = filter(lambda k, v: len(v) > 1, dup_check.items())
    dup_check = [(key, sorted(val)) for key, val in dup_check]
    return dup_check
Find duplications in submitted homework.
Find duplications in submitted homework.
Find duplications in submitted homework .
def find_duplication(homework):
    re_id = re.compile(r'(?P<stuid>[0-9]{10,11})')
    dup_check = dict()
    with open(homework, 'r') as data:
        lines = data.readlines()
        for ln in lines:
            dt = ln.split()
            csum, right = dt[0], dt[1]
            if csum not in dup_check:
                dup_check[csum] = list()
            m = re_id.search(right)
            if m is not None:
                stu_id = m.group('stuid')
                dup_check[csum].append(stu_id)
    dup_check = filter(lambda k, v: len(v) > 1, dup_check.items())
    dup_check = [(key, sorted(val)) for key, val in dup_check]
    return dup_check
def find_duplication ( homework ) : re_id = re . compile ( r'(?P<stuid>[0-9]{10,11})' ) dup_check = dict ( ) with open ( homework , 'r' ) as data : lines = data . readlines ( ) for ln in lines : dt = ln . split ( ) csum , right = dt [ 0 ] , dt [ 1 ] if csum not in dup_check : dup_check [ csum ] = list ( ) m = re_id . search ( right ) if m is not None : stu_id = m . group ( 'stuid' ) dup_check [ csum ] . append ( stu_id ) dup_check = filter ( lambda k , v : len ( v ) > 1 , dup_check . items ( ) ) dup_check = [ ( key , sorted ( val ) ) for key , val in dup_check ] return dup_check
Find duplications in submitted homework.
Find duplications in submitted homework .
"""Find duplications in submitted homework."""
homework