<commit_before>#! /usr/bin/env python

import dircache
import misc
import optparse
import os
import submit
import sys
import traceback

from os.path import join


if __name__ == '__main__':
    parser = optparse.OptionParser()
    parser.add_option('-u', '--user', action='append',
                      help='user (omit for all users')
    parser.add_option('-a', '--assignment', action='append',
                      help='assignment (omit for all assignments)')
    (options, args) = parser.parse_args()

    users = options.user
    assignments = options.assignment

    if assignments is None:
        print >>sys.stderr, 'No assigment specified. Assuming all.'
        assignments = misc.config().sections()

    if users is None:
        print >>sys.stderr, 'No user specfied. Assuming all.'

    counter = 0
    for a in assignments:
        if not a in misc.config().sections():
            print >>sys.stderr, 'Unknown assignment `%s\'. Ignoring.' % a
            continue

        repository = join(misc.repository(a), a)

        users_ = users
        if users_ is None:
            users_ = dircache.listdir(repository)

        for u in users_:
            # gets user's homework directory
            location = join(repository, u)
            if not os.path.isdir(location):
                print >>sys.stderr, 'Not a directory `%s\'. Ignoring.' % location
                continue

            # gets configuration file
            location = join(location, 'config')
            if not os.path.isfile(location):
                print >>sys.stderr, 'Not a file `%s\'. Ignoring.' % location
                continue

            print '++++ Assignment `%s\'; User `%s\' ++++' % (a, u)<commit_msg>fixed bug<commit_after>#! /usr/bin/env python

import dircache
import misc
import optparse
import os
import submit
import sys
import traceback

from os.path import join


if __name__ == '__main__':
    parser = optparse.OptionParser()
    parser.add_option('-u', '--user', action='append',
                      help='user (omit for all users')
    parser.add_option('-a', '--assignment', action='append',
                      help='assignment (omit for all assignments)')
    (options, args) = parser.parse_args()

    users = options.user
    assignments = options.assignment

    if assignments is None:
        print >>sys.stderr, 'No assigment specified. Assuming all.'
        assignments = misc.config().sections()

    if users is None:
        print >>sys.stderr, 'No user specfied. Assuming all.'

    counter = 0
    for a in assignments:
        if not a in misc.config().sections():
            print >>sys.stderr, 'Unknown assignment `%s\'. Ignoring.' % a
            continue

        repository = join(misc.repository(), a)

        users_ = users
        if users_ is None:
            users_ = dircache.listdir(repository)

        for u in users_:
            # gets user's homework directory
            location = join(repository, u)
            if not os.path.isdir(location):
                print >>sys.stderr, 'Not a directory `%s\'. Ignoring.' % location
                continue

            # gets configuration file
            location = join(location, 'config')
            if not os.path.isfile(location):
                print >>sys.stderr, 'Not a file `%s\'. Ignoring.' % location
                continue

            print '++++ Assignment `%s\'; User `%s\' ++++' % (a, u)
{'fraction_non_alphanumeric': 0.11860940695296524, 'fraction_numerical': 0.0005842827928717499, 'mean_word_length': 2.0462633451957295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5237413', 'n_tokens_mistral': 968, 'n_tokens_neox': 922, 'n_words': 302}