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
569edd21
Commit
569edd21
authored
Sep 16, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! fix quality issues.
parent
c2cf9ae0
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
20 additions
and
19 deletions
+20
-19
common/lib/xmodule/xmodule/modulestore/__init__.py
+0
-1
lms/djangoapps/course_api/blocks/forms.py
+2
-2
lms/djangoapps/course_blocks/transformers/tests/test_helpers.py
+1
-2
lms/djangoapps/course_blocks/transformers/tests/test_split_test.py
+2
-2
lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
+2
-2
lms/djangoapps/course_blocks/transformers/user_partitions.py
+1
-0
openedx/core/lib/block_cache/graph_traversals.py
+1
-1
openedx/core/lib/block_cache/tests/test_block_cache.py
+2
-2
openedx/core/lib/block_cache/tests/test_block_structure.py
+4
-4
openedx/core/lib/block_cache/tests/test_graph_traversals.py
+2
-2
openedx/core/lib/block_cache/tests/test_utils.py
+2
-1
openedx/core/lib/block_cache/user_info.py
+1
-0
No files found.
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
569edd21
...
...
@@ -905,7 +905,6 @@ class ModuleStoreRead(ModuleStoreAssetBase):
"""
pass
@abstractmethod
def
make_course_usage_key
(
self
,
course_key
):
"""
...
...
lms/djangoapps/course_api/blocks/forms.py
View file @
569edd21
...
...
@@ -15,6 +15,7 @@ from opaque_keys.edx.keys import UsageKey
from
transformers.student_view
import
StudentViewTransformer
from
transformers.block_counts
import
BlockCountsTransformer
class
ListField
(
Field
):
"""
Field for a list of strings
...
...
@@ -26,7 +27,7 @@ class BlockListGetForm(Form):
"""
A form to validate query parameters in the block list retrieval endpoint
"""
user
=
CharField
(
required
=
True
)
# TODO return all blocks if user is not specified by requesting staff user
user
=
CharField
(
required
=
True
)
# TODO return all blocks if user is not specified by requesting staff user
usage_key
=
CharField
(
required
=
True
)
requested_fields
=
ListField
(
required
=
False
)
student_view_data
=
ListField
(
required
=
False
)
...
...
@@ -59,7 +60,6 @@ class BlockListGetForm(Form):
return
usage_key
def
clean
(
self
):
cleaned_data
=
super
(
BlockListGetForm
,
self
)
.
clean
()
...
...
lms/djangoapps/course_blocks/transformers/tests/test_helpers.py
View file @
569edd21
...
...
@@ -312,4 +312,4 @@ def create_location(org, course, run, block_type, block_id):
Returns the usage key for the given key parameters using the
default modulestore
"""
return
modulestore
()
.
make_course_key
(
org
,
course
,
run
)
.
make_usage_key
(
block_type
,
block_id
)
\ No newline at end of file
return
modulestore
()
.
make_course_key
(
org
,
course
,
run
)
.
make_usage_key
(
block_type
,
block_id
)
lms/djangoapps/course_blocks/transformers/tests/test_split_test.py
View file @
569edd21
...
...
@@ -48,7 +48,7 @@ class SplitTestTransformerTestCase(CourseStructureTestCase):
CourseEnrollmentFactory
.
create
(
user
=
self
.
user
,
course_id
=
self
.
course
.
id
,
is_active
=
True
)
self
.
transformer
=
UserPartitionTransformer
()
def
get_course_hierarchy
(
self
):
"""
Get a course hierarchy to test with.
...
...
@@ -156,7 +156,7 @@ class SplitTestTransformerTestCase(CourseStructureTestCase):
{
'#type'
:
'vertical'
,
'#ref'
:
'L'
,
'#children'
:
[{
'#type'
:
'vertical'
,
'#ref'
:
'P'
,},
],
'#children'
:
[{
'#type'
:
'vertical'
,
'#ref'
:
'P'
}
],
},
],
},
...
...
lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
View file @
569edd21
...
...
@@ -39,7 +39,7 @@ class UserPartitionTransformerTestCase(CourseStructureTestCase):
scheme
=
CohortPartitionScheme
)
self
.
user_partition
.
scheme
.
name
=
"cohort"
# Build course.
self
.
course_hierarchy
=
self
.
get_course_hierarchy
()
self
.
blocks
=
self
.
build_course
(
self
.
course_hierarchy
)
...
...
@@ -173,7 +173,7 @@ class UserPartitionTransformerTestCase(CourseStructureTestCase):
Test when user is assigned to group in user partition.
"""
if
group_id
:
add_user_to_cohort
(
self
.
cohorts
[
group_id
-
1
],
self
.
user
.
username
)
add_user_to_cohort
(
self
.
cohorts
[
group_id
-
1
],
self
.
user
.
username
)
trans_block_structure
=
get_course_blocks
(
self
.
user
,
...
...
lms/djangoapps/course_blocks/transformers/user_partitions.py
View file @
569edd21
...
...
@@ -6,6 +6,7 @@ from openedx.core.lib.block_cache.transformer import BlockStructureTransformer
from
.split_test
import
SplitTestTransformer
from
.utils
import
get_field_on_block
class
MergedGroupAccess
(
object
):
"""
...
...
...
openedx/core/lib/block_cache/graph_traversals.py
View file @
569edd21
...
...
@@ -129,7 +129,7 @@ def traverse_post_order(start_node, get_children, get_result=None, predicate=Non
while
stack
:
# peek at the next item in the stack
current_stack_item
=
stack
[
len
(
stack
)
-
1
]
current_stack_item
=
stack
[
len
(
stack
)
-
1
]
# verify the block wasn't already visited and the block satisfies the predicate
if
current_stack_item
.
block
in
visited
or
not
predicate
(
current_stack_item
.
block
):
...
...
openedx/core/lib/block_cache/tests/test_block_cache.py
View file @
569edd21
...
...
@@ -30,7 +30,7 @@ class TestBlockCache(TestCase, ChildrenMapTestMixin):
block_structure
.
topological_traversal
(
get_result
=
lambda
block_key
:
block_structure
.
set_transformer_block_data
(
block_key
,
self
,
self
.
block_key
(),
self
.
block_val
(
block_key
)
)))
)))
def
transform
(
self
,
user_info
,
block_structure
):
def
assert_collected_value
(
block_key
):
...
...
@@ -45,7 +45,7 @@ class TestBlockCache(TestCase, ChildrenMapTestMixin):
list
(
block_structure
.
topological_traversal
(
get_result
=
lambda
block_key
:
assert_collected_value
(
block_key
)
))
))
def
setUp
(
self
):
super
(
TestBlockCache
,
self
)
.
setUp
()
...
...
openedx/core/lib/block_cache/tests/test_block_structure.py
View file @
569edd21
...
...
@@ -35,11 +35,11 @@ class TestBlockStructure(TestCase, ChildrenMapTestMixin):
# get_children
for
parent
,
children
in
enumerate
(
children_map
):
self
.
assertSetEqual
(
set
(
block_structure
.
get_children
(
parent
)),
set
(
children
))
self
.
assertSetEqual
(
set
(
block_structure
.
get_children
(
parent
)),
set
(
children
))
# get_parents
for
child
,
parents
in
enumerate
(
self
.
get_parents_map
(
children_map
)):
self
.
assertSetEqual
(
set
(
block_structure
.
get_parents
(
child
)),
set
(
parents
))
self
.
assertSetEqual
(
set
(
block_structure
.
get_parents
(
child
)),
set
(
parents
))
# has_block
for
node
in
range
(
len
(
children_map
)):
...
...
@@ -68,7 +68,7 @@ class TestBlockStructureData(TestCase, ChildrenMapTestMixin):
transformers_info
=
[
TransformerInfo
(
transformer
=
MockTransformer
(),
structure_wide_data
=
[(
"t1.global1"
,
"t1.g.val1"
),
(
"t1.global2"
,
"t1.g.val2"
)
,
],
structure_wide_data
=
[(
"t1.global1"
,
"t1.g.val1"
),
(
"t1.global2"
,
"t1.g.val2"
)],
block_specific_data
=
{
"B1"
:
[(
"t1.key1"
,
"t1.b1.val1"
),
(
"t1.key2"
,
"t1.b1.val2"
)],
"B2"
:
[(
"t1.key1"
,
"t1.b2.val1"
),
(
"t1.key2"
,
"t1.b2.val2"
)],
...
...
@@ -78,7 +78,7 @@ class TestBlockStructureData(TestCase, ChildrenMapTestMixin):
),
TransformerInfo
(
transformer
=
MockTransformer
(),
structure_wide_data
=
[(
"t2.global1"
,
"t2.g.val1"
),
(
"t2.global2"
,
"t2.g.val2"
)
,
],
structure_wide_data
=
[(
"t2.global1"
,
"t2.g.val1"
),
(
"t2.global2"
,
"t2.g.val2"
)],
block_specific_data
=
{
"B1"
:
[(
"t2.key1"
,
"t2.b1.val1"
),
(
"t2.key2"
,
"t2.b1.val2"
)],
"B2"
:
[(
"t2.key1"
,
"t2.b2.val1"
),
(
"t2.key2"
,
"t2.b2.val2"
)],
...
...
openedx/core/lib/block_cache/tests/test_graph_traversals.py
View file @
569edd21
...
...
@@ -147,7 +147,7 @@ class GraphTraversalsTestCase(TestCase):
# / | \ / \
# M N O P
graph
=
{
'root'
:
[
'A'
,
'B'
,
'C'
,
'E'
,
'F'
,
'K'
,
'O'
],
# has additional links than what is drawn above
'root'
:
[
'A'
,
'B'
,
'C'
,
'E'
,
'F'
,
'K'
,
'O'
],
# has additional links than what is drawn above
'A'
:
[
'D'
,
'E'
],
'B'
:
[
'E'
,
'F'
,
'G'
],
'C'
:
[
'H'
,
'I'
],
...
...
@@ -166,7 +166,7 @@ class GraphTraversalsTestCase(TestCase):
'P'
:
[],
}
graph_parents
=
self
.
get_parent_map
(
graph
)
for
_
in
range
(
2
):
# should get the same result twice
for
_
in
range
(
2
):
# should get the same result twice
self
.
assertEqual
(
list
(
traverse_topologically
(
start_node
=
'root'
,
...
...
openedx/core/lib/block_cache/tests/test_utils.py
View file @
569edd21
...
...
@@ -74,6 +74,7 @@ class MockUserInfo(object):
class
MockTransformer
(
BlockStructureTransformer
):
VERSION
=
1
def
transform
(
self
,
user_info
,
block_structure
):
pass
...
...
@@ -111,7 +112,7 @@ class ChildrenMapTestMixin(object):
# add_relation
for
parent
,
children
in
enumerate
(
children_map
):
for
child
in
children
:
block_structure
.
add_relation
(
parent
,
child
)
block_structure
.
add_relation
(
parent
,
child
)
return
block_structure
def
get_parents_map
(
self
,
children_map
):
...
...
openedx/core/lib/block_cache/user_info.py
View file @
569edd21
...
...
@@ -3,6 +3,7 @@
"""
from
abc
import
abstractproperty
class
UserInfo
(
object
):
"""
...
...
...
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