Commit 25860ca1 by ichuang Committed by Matthew Mongeau

fix capa_problems pep8

parent cd9e4672
...@@ -146,7 +146,7 @@ class LoncapaProblem(object): ...@@ -146,7 +146,7 @@ class LoncapaProblem(object):
def get_max_score(self): def get_max_score(self):
''' '''
Return maximum score for this problem. Return maximum score for this problem.
We do this by counting the number of answers available for each question We do this by counting the number of answers available for each question
in the problem. If the Response for a question has a get_max_score() method in the problem. If the Response for a question has a get_max_score() method
then we call that and add its return value to the count. That can be then we call that and add its return value to the count. That can be
used to give complex problems (eg programming questions) multiple points. used to give complex problems (eg programming questions) multiple points.
...@@ -351,7 +351,7 @@ class LoncapaProblem(object): ...@@ -351,7 +351,7 @@ class LoncapaProblem(object):
Also create capa Response instances for each responsetype and save as self.responders Also create capa Response instances for each responsetype and save as self.responders
''' '''
response_id = 1 response_id = 1
self.responders = {} self.responders = {}
for response in tree.xpath('//' + "|//".join(response_tag_dict)): for response in tree.xpath('//' + "|//".join(response_tag_dict)):
response_id_str = self.problem_id + "_" + str(response_id) response_id_str = self.problem_id + "_" + str(response_id)
response.set('id',response_id_str) # create and save ID for this response response.set('id',response_id_str) # create and save ID for this response
...@@ -367,7 +367,7 @@ class LoncapaProblem(object): ...@@ -367,7 +367,7 @@ class LoncapaProblem(object):
answer_id = answer_id + 1 answer_id = answer_id + 1
responder = response_tag_dict[response.tag](response, inputfields, self.context, self.system) # instantiate capa Response responder = response_tag_dict[response.tag](response, inputfields, self.context, self.system) # instantiate capa Response
self.responders[response] = responder # save in list in self self.responders[response] = responder # save in list in self
# <solution>...</solution> may not be associated with any specific response; give IDs for those separately # <solution>...</solution> may not be associated with any specific response; give IDs for those separately
# TODO: We should make the namespaces consistent and unique (e.g. %s_problem_%i). # TODO: We should make the namespaces consistent and unique (e.g. %s_problem_%i).
......
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