Skip to content

Instantly share code, notes, and snippets.

@jvanvugt
Last active February 8, 2016 16:54
Show Gist options
  • Save jvanvugt/c75577e5799bf0290b77 to your computer and use it in GitHub Desktop.
Save jvanvugt/c75577e5799bf0290b77 to your computer and use it in GitHub Desktop.
import os
import sys
def print_usage():
print 'Usage:'
print 'python check_feedback directory'
def check_feedback(dir):
for _, dirnames, _ in os.walk(dir):
for subdir in dirnames:
print 'checking', subdir
with open(os.path.join(dir, subdir, subdir + '.txt'), 'r') as f:
text = f.read()
if not 'Feedback:' in text:
print 'Forgot feedback in:', subdir
grade = False
for line in text.split('\n'):
if 'Current Grade:' in line:
if line.split(' ')[2] in ['G', 'V', 'O', 'NSI']:
grade = True
break
if not grade:
print 'Missing grade:', subdir
if __name__ == '__main__':
if len(sys.argv) != 2:
print_usage()
else:
check_feedback(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment