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
e8f8e9e1
Commit
e8f8e9e1
authored
Mar 29, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enough is enough.
parent
a5b1428b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
common/lib/capa/capa/correctmap.py
+16
-14
No files found.
common/lib/capa/capa/correctmap.py
View file @
e8f8e9e1
...
@@ -66,30 +66,32 @@ class CorrectMap(object):
...
@@ -66,30 +66,32 @@ class CorrectMap(object):
def
set_dict
(
self
,
correct_map
):
def
set_dict
(
self
,
correct_map
):
'''
'''
Set internal dict of CorrectMap to provided correct_map dict
Set internal dict of CorrectMap to provided correct_map dict
.
correct_map is saved by LMS as a plaintext JSON dump of the correctmap
dict. This
correct_map is saved by LMS as a plaintext JSON dump of the correctmap
means that when the definition of CorrectMap (e.g. its properties) are altered,
dict. This means that when the definition of CorrectMap (e.g. its
an existing correct_map dict will not coincide with the newest CorrectMap format as
properties) are altered, an existing correct_map dict will not coincide
defined by self.set.
with the newest CorrectMap format as
defined by self.set.
For graceful migration, feed the contents of each correct map to self.set, rather than
For graceful migration, feed the contents of each correct map to
making a direct copy of the given correct_map dict. This way, the common keys between
self.set, rather than making a direct copy of the given correct_map
the incoming correct_map dict and the new CorrectMap instance will be written, while
dict. This way, the common keys between the incoming correct_map dict
mismatched keys will be gracefully ignored.
and the new CorrectMap instance will be written, while mismatched keys
will be gracefully ignored.
Special migration case: If correct_map is a one-level dict, then
convert it to the new dict of dicts format.
Special migration case:
If correct_map is a one-level dict, then convert it to the new dict of dicts format.
'''
'''
if
correct_map
and
not
(
type
(
correct_map
[
correct_map
.
keys
()[
0
]])
==
dict
):
# empty current dict
# empty current dict
self
.
__init__
()
self
.
__init__
()
# create new dict entries
# create new dict entries
if
correct_map
and
not
isinstance
(
correct_map
.
values
()[
0
],
dict
):
# special migration
for
k
in
correct_map
:
for
k
in
correct_map
:
self
.
set
(
k
,
correct_map
[
k
])
self
.
set
(
k
,
correct
ness
=
correct
_map
[
k
])
else
:
else
:
self
.
__init__
()
for
k
in
correct_map
:
for
k
in
correct_map
:
self
.
set
(
k
,
**
correct_map
[
k
])
self
.
set
(
k
,
**
correct_map
[
k
])
...
...
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