Commit fb14bedf by Will Daly

Merge pull request #1803 from MITx/fix/zoldak/pep8-psychometrics

pep8 fixes for psychoanalyze and capa module
parents 1717782c 22017ac2
...@@ -108,11 +108,10 @@ class CapaModule(CapaFields, XModule): ...@@ -108,11 +108,10 @@ class CapaModule(CapaFields, XModule):
''' '''
icon_class = 'problem' icon_class = 'problem'
js = {'coffee': [resource_string(__name__, 'js/src/capa/display.coffee'), js = {'coffee': [resource_string(__name__, 'js/src/capa/display.coffee'),
resource_string(__name__, 'js/src/collapsible.coffee'), resource_string(__name__, 'js/src/collapsible.coffee'),
resource_string(__name__, 'js/src/javascript_loader.coffee'), resource_string(__name__, 'js/src/javascript_loader.coffee'),
], ],
'js': [resource_string(__name__, 'js/src/capa/imageinput.js'), 'js': [resource_string(__name__, 'js/src/capa/imageinput.js'),
resource_string(__name__, 'js/src/capa/schematic.js') resource_string(__name__, 'js/src/capa/schematic.js')
]} ]}
...@@ -367,11 +366,11 @@ class CapaModule(CapaFields, XModule): ...@@ -367,11 +366,11 @@ class CapaModule(CapaFields, XModule):
self.set_state_from_lcp() self.set_state_from_lcp()
# Prepend a scary warning to the student # Prepend a scary warning to the student
warning = '<div class="capa_reset">'\ warning = '<div class="capa_reset">'\
'<h2>Warning: The problem has been reset to its initial state!</h2>'\ '<h2>Warning: The problem has been reset to its initial state!</h2>'\
'The problem\'s state was corrupted by an invalid submission. ' \ 'The problem\'s state was corrupted by an invalid submission. ' \
'The submission consisted of:'\ 'The submission consisted of:'\
'<ul>' '<ul>'
for student_answer in student_answers.values(): for student_answer in student_answers.values():
if student_answer != '': if student_answer != '':
warning += '<li>' + cgi.escape(student_answer) + '</li>' warning += '<li>' + cgi.escape(student_answer) + '</li>'
...@@ -388,7 +387,6 @@ class CapaModule(CapaFields, XModule): ...@@ -388,7 +387,6 @@ class CapaModule(CapaFields, XModule):
return html return html
def get_problem_html(self, encapsulate=True): def get_problem_html(self, encapsulate=True):
'''Return html for the problem. Adds check, reset, save buttons '''Return html for the problem. Adds check, reset, save buttons
as necessary based on the problem config and state.''' as necessary based on the problem config and state.'''
...@@ -401,7 +399,6 @@ class CapaModule(CapaFields, XModule): ...@@ -401,7 +399,6 @@ class CapaModule(CapaFields, XModule):
except Exception, err: except Exception, err:
html = self.handle_problem_html_error(err) html = self.handle_problem_html_error(err)
# The convention is to pass the name of the check button # The convention is to pass the name of the check button
# if we want to show a check button, and False otherwise # if we want to show a check button, and False otherwise
# This works because non-empty strings evaluate to True # This works because non-empty strings evaluate to True
...@@ -454,7 +451,7 @@ class CapaModule(CapaFields, XModule): ...@@ -454,7 +451,7 @@ class CapaModule(CapaFields, XModule):
'score_update': self.update_score, 'score_update': self.update_score,
'input_ajax': self.handle_input_ajax, 'input_ajax': self.handle_input_ajax,
'ungraded_response': self.handle_ungraded_response 'ungraded_response': self.handle_ungraded_response
} }
if dispatch not in handlers: if dispatch not in handlers:
return 'Error' return 'Error'
...@@ -472,7 +469,7 @@ class CapaModule(CapaFields, XModule): ...@@ -472,7 +469,7 @@ class CapaModule(CapaFields, XModule):
d.update({ d.update({
'progress_changed': after != before, 'progress_changed': after != before,
'progress_status': Progress.to_js_status_str(after), 'progress_status': Progress.to_js_status_str(after),
}) })
return json.dumps(d, cls=ComplexEncoder) return json.dumps(d, cls=ComplexEncoder)
def is_past_due(self): def is_past_due(self):
...@@ -535,7 +532,6 @@ class CapaModule(CapaFields, XModule): ...@@ -535,7 +532,6 @@ class CapaModule(CapaFields, XModule):
return False return False
def update_score(self, get): def update_score(self, get):
""" """
Delivers grading response (e.g. from asynchronous code checking) to Delivers grading response (e.g. from asynchronous code checking) to
...@@ -590,7 +586,6 @@ class CapaModule(CapaFields, XModule): ...@@ -590,7 +586,6 @@ class CapaModule(CapaFields, XModule):
self.set_state_from_lcp() self.set_state_from_lcp()
return response return response
def get_answer(self, get): def get_answer(self, get):
''' '''
For the "show answer" button. For the "show answer" button.
...@@ -700,7 +695,6 @@ class CapaModule(CapaFields, XModule): ...@@ -700,7 +695,6 @@ class CapaModule(CapaFields, XModule):
'max_value': score['total'], 'max_value': score['total'],
}) })
def check_problem(self, get): def check_problem(self, get):
''' Checks whether answers to a problem are correct, and ''' Checks whether answers to a problem are correct, and
returns a map of correct/incorrect answers: returns a map of correct/incorrect answers:
......
...@@ -15,7 +15,6 @@ from scipy.optimize import curve_fit ...@@ -15,7 +15,6 @@ from scipy.optimize import curve_fit
from django.conf import settings from django.conf import settings
from django.db.models import Sum, Max from django.db.models import Sum, Max
from psychometrics.models import * from psychometrics.models import *
from xmodule.modulestore import Location
log = logging.getLogger("mitx.psychometrics") log = logging.getLogger("mitx.psychometrics")
...@@ -292,7 +291,7 @@ def generate_plots_for_problem(problem): ...@@ -292,7 +291,7 @@ def generate_plots_for_problem(problem):
'info': '', 'info': '',
'data': jsdata, 'data': jsdata,
'cmd': '[%s], %s' % (','.join(jsplots), axisopts), 'cmd': '[%s], %s' % (','.join(jsplots), axisopts),
}) })
#log.debug('plots = %s' % plots) #log.debug('plots = %s' % plots)
return msg, plots return msg, plots
...@@ -333,9 +332,9 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key): ...@@ -333,9 +332,9 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key):
pmd.done = done pmd.done = done
try: try:
pmd.attempts = state.get('attempts',0) pmd.attempts = state.get('attempts', 0)
except: except:
log.exception("no attempts for %s (state=%s)" % (sm,sm.state)) log.exception("no attempts for %s (state=%s)" % (sm, sm.state))
try: try:
checktimes = eval(pmd.checktimes) # update log of attempt timestamps checktimes = eval(pmd.checktimes) # update log of attempt timestamps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment