Exemplo n.º 1
0
def parse_staff_code(staff_dir):
  staff_files = crawl_submissions(staff_dir)
  num_subdirs = len(staff_dir.split('/'))
  staff_code = {}
  for files in staff_files.values():
    for file_path in files:
      relative_path = '/'.join(file_path.split('/')[num_subdirs+1:])
      staff_lines = open(file_path).read()
      staff_code[relative_path] = set([line.strip() for line in staff_lines.split('\n')])

  return staff_code
Exemplo n.º 2
0
# print settings

starting_time = time.time()

staff_code = {}
if settings['staff_dir'] is not None:
  print "Crawling staff code in", settings['staff_dir']
  staff_code = parse_staff_code(settings['staff_dir'], settings['include'], settings['exclude'])
#print staff_code.keys()

batch = Batch(name=milestone.full_name())
if settings['save_data']:
  batch.save()
  print "Batch ID: %s" % (batch.id)

# Crawling the file system.
student_code = crawl_submissions(settings['student_submission_dir'], settings['include'], settings['exclude'])

code_objects = parse_all_files(student_code, settings['student_submission_dir'], batch, milestone, settings['save_data'], staff_code, settings['restrict'], settings['restrict_to_usernames'])

if parse.failed_users:
  print "To add the missing users to Caesar, use scripts/addMembers.py to add the following list of users:"
  print ','.join(parse.failed_users)
  print "Then reload their submissions."

print "Found %s submissions." % (len(code_objects))

if settings['generate_comments']:
  print "Generating checkstyle comments..."
  generate_checkstyle_comments(code_objects, settings['save_data'], batch, settings['suppress_regex'])
Exemplo n.º 3
0
# load time, but it will automatically roll back the changes if there's an exception.
# with transaction.commit_on_success():

# Finding the submit milestone object
submit_milestone = SubmitMilestone.objects.get(id=settings['submit_milestone_id'])
print "Found existing submit milestone. Adding code to %s." % (submit_milestone.full_name())

staff_code = parse_staff_code(settings['staff_dir']) if settings['staff_dir'] is not None else {}
#print staff_code.keys()

batch = Batch(name=submit_milestone.full_name())
if settings['save_data']:
  batch.save()
  print "Batch ID: %s" % (batch.id)

# Crawling the file system.
student_code = crawl_submissions(settings['student_submission_dir'])

code_objects = parse_all_files(student_code, settings['student_submission_dir'], batch, submit_milestone, settings['save_data'], staff_code, args.restrict)

if parse.failed_users:
  print "To add the missing users to Caesar, use scripts/addMembers.py to add the following list of users:"
  print ','.join(parse.failed_users)
  print "Then reload their submissions."

print "Found %s submissions." % (len(code_objects))

if settings['generate_comments']:
  print "Generating checkstyle comments..."
  generate_checkstyle_comments(code_objects, settings['save_data'], batch)
Exemplo n.º 4
0
submit_milestone = SubmitMilestone.objects.get(
    id=settings['submit_milestone_id'])
print "Found existing submit milestone. Adding code to %s." % (
    submit_milestone.full_name())

staff_code = parse_staff_code(
    settings['staff_dir']) if settings['staff_dir'] is not None else {}
#print staff_code.keys()

batch = Batch(name=submit_milestone.full_name())
if settings['save_data']:
    batch.save()
    print "Batch ID: %s" % (batch.id)

# Crawling the file system.
student_code = crawl_submissions(settings['student_submission_dir'])

code_objects = parse_all_files(student_code,
                               settings['student_submission_dir'], batch,
                               submit_milestone, settings['save_data'],
                               staff_code, args.restrict)

if parse.failed_users:
    print "To add the missing users to Caesar, use scripts/addMembers.py to add the following list of users:"
    print ','.join(parse.failed_users)
    print "Then reload their submissions."

print "Found %s submissions." % (len(code_objects))

if settings['generate_comments']:
    print "Generating checkstyle comments..."
Exemplo n.º 5
0
starting_time = time.time()

staff_code = {}
if settings['staff_dir'] is not None:
    print "Crawling staff code in", settings['staff_dir']
    staff_code = parse_staff_code(settings['staff_dir'], settings['include'],
                                  settings['exclude'])
#print staff_code.keys()

batch = Batch(name=milestone.full_name())
if settings['save_data']:
    batch.save()
    print "Batch ID: %s" % (batch.id)

# Crawling the file system.
student_code = crawl_submissions(settings['student_submission_dir'],
                                 settings['include'], settings['exclude'])

code_objects = parse_all_files(student_code,
                               settings['student_submission_dir'], batch,
                               milestone, settings['save_data'], staff_code,
                               settings['restrict'],
                               settings['restrict_to_usernames'])

if parse.failed_users:
    print "To add the missing users to Caesar, use scripts/addMembers.py to add the following list of users:"
    print ','.join(parse.failed_users)
    print "Then reload their submissions."

print "Found %s submissions." % (len(code_objects))

if settings['generate_comments']: