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