Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8d9b242e
Commit
8d9b242e
authored
Jun 06, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of unused code
parent
eec80426
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
24 deletions
+5
-24
djangoapps/courseware/capa/responsetypes.py
+5
-24
No files found.
djangoapps/courseware/capa/responsetypes.py
View file @
8d9b242e
...
...
@@ -11,15 +11,12 @@ Used by capa_problem.py
import
inspect
import
json
import
logging
import
math
import
numbers
import
numpy
import
random
import
re
import
requests
import
scipy
import
traceback
import
copy
import
abc
# specific library imports
...
...
@@ -27,15 +24,8 @@ from calc import evaluator, UndefinedVariable
from
django.conf
import
settings
from
util
import
contextualize_text
from
lxml
import
etree
from
lxml.etree
import
Element
from
lxml.html.soupparser
import
fromstring
as
fromstring_bs
# uses Beautiful Soup!!! FIXME?
# local imports
import
calc
import
eia
from
util
import
contextualize_text
log
=
logging
.
getLogger
(
"mitx.courseware"
)
def
compare_with_tolerance
(
v1
,
v2
,
tol
):
...
...
@@ -186,12 +176,12 @@ class NumericalResponse(GenericResponse):
self
.
tolerance_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
id
=
xml
.
get
(
'id'
))[
0
]
self
.
tolerance
=
contextualize_text
(
self
.
tolerance_xml
,
context
)
except
Exception
,
err
:
except
Exception
:
self
.
tolerance
=
0
try
:
self
.
answer_id
=
xml
.
xpath
(
'//*[@id=$id]//textline/@id'
,
id
=
xml
.
get
(
'id'
))[
0
]
except
Exception
,
err
:
except
Exception
:
self
.
answer_id
=
None
def
get_score
(
self
,
student_answers
):
...
...
@@ -277,7 +267,7 @@ def sympy_check2():
answer
=
None
try
:
answer
=
xml
.
xpath
(
'//*[@id=$id]//answer'
,
id
=
xml
.
get
(
'id'
))[
0
]
except
IndexError
,
err
:
except
IndexError
:
# print "xml = ",etree.tostring(xml,pretty_print=True)
# if we have a "cfn" attribute then look for the function specified by cfn, in the problem context
...
...
@@ -308,12 +298,6 @@ def sympy_check2():
of each key removed (the string before the first "_").
'''
def
getkey2
(
dict
,
key
,
default
):
"""utilify function: get dict[key] if key exists, or return default"""
if
dict
.
has_key
(
key
):
return
dict
[
key
]
return
default
idset
=
sorted
(
self
.
answer_ids
)
# ordered list of answer id's
try
:
submission
=
[
student_answers
[
k
]
for
k
in
idset
]
# ordered list of answers
...
...
@@ -330,8 +314,6 @@ def sympy_check2():
if
len
(
idset
)
==
1
and
not
submission
[
0
]:
return
{
idset
[
0
]:
'no_answer_entered'
}
gctxt
=
self
.
context
[
'global_context'
]
correct
=
[
'unknown'
]
*
len
(
idset
)
messages
=
[
''
]
*
len
(
idset
)
...
...
@@ -649,13 +631,13 @@ class FormulaResponse(GenericResponse):
self
.
tolerance_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
id
=
xml
.
get
(
'id'
))[
0
]
self
.
tolerance
=
contextualize_text
(
self
.
tolerance_xml
,
context
)
except
Exception
,
err
:
except
Exception
:
self
.
tolerance
=
0
try
:
self
.
answer_id
=
xml
.
xpath
(
'//*[@id=$id]//textline/@id'
,
id
=
xml
.
get
(
'id'
))[
0
]
except
Exception
,
err
:
except
Exception
:
self
.
answer_id
=
None
raise
Exception
,
"[courseware.capa.responsetypes.FormulaResponse] Error: missing answer_id!!"
...
...
@@ -680,7 +662,6 @@ class FormulaResponse(GenericResponse):
self
.
samples
.
split
(
'@'
)[
1
]
.
split
(
'#'
)[
0
]
.
split
(
':'
)))
ranges
=
dict
(
zip
(
variables
,
sranges
))
correct
=
True
for
i
in
range
(
numsamples
):
instructor_variables
=
self
.
strip_dict
(
dict
(
self
.
context
))
student_variables
=
dict
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment