Commit b215d771 by stv

Fix PEP8: E128 continuation line under-indented

for visual indent
parent 4d30aedf
...@@ -286,8 +286,15 @@ def _do_studio_prompt_action(intent, action): ...@@ -286,8 +286,15 @@ def _do_studio_prompt_action(intent, action):
Wait for a studio prompt to appear and press the specified action button Wait for a studio prompt to appear and press the specified action button
See cms/static/js/views/feedback_prompt.js for implementation See cms/static/js/views/feedback_prompt.js for implementation
""" """
assert intent in ['warning', 'error', 'confirmation', 'announcement', assert intent in [
'step-required', 'help', 'mini'] 'warning',
'error',
'confirmation',
'announcement',
'step-required',
'help',
'mini',
]
assert action in ['primary', 'secondary'] assert action in ['primary', 'secondary']
world.wait_for_present('div.wrapper-prompt.is-shown#prompt-{}'.format(intent)) world.wait_for_present('div.wrapper-prompt.is-shown#prompt-{}'.format(intent))
......
...@@ -93,8 +93,10 @@ def click_component_from_menu(category, component_type, is_advanced): ...@@ -93,8 +93,10 @@ def click_component_from_menu(category, component_type, is_advanced):
""" """
if is_advanced: if is_advanced:
# Sometimes this click does not work if you go too fast. # Sometimes this click does not work if you go too fast.
world.retry_on_exception(_click_advanced, world.retry_on_exception(
ignored_exceptions=AssertionError) _click_advanced,
ignored_exceptions=AssertionError,
)
# Retry this in case the list is empty because you tried too fast. # Retry this in case the list is empty because you tried too fast.
link = world.retry_on_exception( link = world.retry_on_exception(
......
...@@ -55,9 +55,10 @@ class InternationalizationTest(ModuleStoreTestCase): ...@@ -55,9 +55,10 @@ class InternationalizationTest(ModuleStoreTestCase):
self.client = AjaxEnabledTestClient() self.client = AjaxEnabledTestClient()
self.client.login(username=self.uname, password=self.password) self.client.login(username=self.uname, password=self.password)
resp = self.client.get_html('/course/', resp = self.client.get_html(
{}, '/course/',
HTTP_ACCEPT_LANGUAGE='en' {},
HTTP_ACCEPT_LANGUAGE='en',
) )
self.assertContains(resp, self.assertContains(resp,
......
...@@ -32,13 +32,14 @@ class TestCourseAccess(ModuleStoreTestCase): ...@@ -32,13 +32,14 @@ class TestCourseAccess(ModuleStoreTestCase):
# create a course via the view handler which has a different strategy for permissions than the factory # create a course via the view handler which has a different strategy for permissions than the factory
self.course_key = SlashSeparatedCourseKey('myu', 'mydept.mycourse', 'myrun') self.course_key = SlashSeparatedCourseKey('myu', 'mydept.mycourse', 'myrun')
course_url = reverse_url('course_handler') course_url = reverse_url('course_handler')
self.client.ajax_post(course_url, self.client.ajax_post(
course_url,
{ {
'org': self.course_key.org, 'org': self.course_key.org,
'number': self.course_key.course, 'number': self.course_key.course,
'display_name': 'My favorite course', 'display_name': 'My favorite course',
'run': self.course_key.run, 'run': self.course_key.run,
} },
) )
self.users = self._create_users() self.users = self._create_users()
......
...@@ -104,18 +104,25 @@ js_info_dict = { ...@@ -104,18 +104,25 @@ js_info_dict = {
'packages': ('openassessment',), 'packages': ('openassessment',),
} }
urlpatterns += patterns('', urlpatterns += patterns(
'',
# Serve catalog of localized strings to be rendered by Javascript # Serve catalog of localized strings to be rendered by Javascript
url(r'^i18n.js$', 'django.views.i18n.javascript_catalog', js_info_dict), url(r'^i18n.js$', 'django.views.i18n.javascript_catalog', js_info_dict),
) )
if settings.FEATURES.get('ENABLE_EXPORT_GIT'): if settings.FEATURES.get('ENABLE_EXPORT_GIT'):
urlpatterns += (url(r'^export_git/{}$'.format(settings.COURSE_KEY_PATTERN), urlpatterns += (url(
'contentstore.views.export_git', name='export_git'),) r'^export_git/{}$'.format(
settings.COURSE_KEY_PATTERN,
),
'contentstore.views.export_git',
name='export_git',
),)
if settings.FEATURES.get('ENABLE_SERVICE_STATUS'): if settings.FEATURES.get('ENABLE_SERVICE_STATUS'):
urlpatterns += patterns('', urlpatterns += patterns(
'',
url(r'^status/', include('service_status.urls')), url(r'^status/', include('service_status.urls')),
) )
......
...@@ -170,12 +170,14 @@ class TestPasswordPolicy(TestCase): ...@@ -170,12 +170,14 @@ class TestPasswordPolicy(TestCase):
response = self.client.post(self.url, self.url_params) response = self.client.post(self.url, self.url_params)
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
obj = json.loads(response.content) obj = json.loads(response.content)
errstring = ("Password: Must be more complex (" errstring = (
"Password: Must be more complex ("
"must contain 3 or more uppercase characters, " "must contain 3 or more uppercase characters, "
"must contain 3 or more digits, " "must contain 3 or more digits, "
"must contain 3 or more punctuation characters, " "must contain 3 or more punctuation characters, "
"must contain 3 or more unique words" "must contain 3 or more unique words"
")") ")"
)
self.assertEqual(obj['value'], errstring) self.assertEqual(obj['value'], errstring)
@patch.dict("django.conf.settings.PASSWORD_COMPLEXITY", { @patch.dict("django.conf.settings.PASSWORD_COMPLEXITY", {
......
...@@ -187,7 +187,8 @@ class StubOraServiceTest(unittest.TestCase): ...@@ -187,7 +187,8 @@ class StubOraServiceTest(unittest.TestCase):
params={'course_id': 'test course'} params={'course_id': 'test course'}
) )
self._assert_response(response, self._assert_response(
response,
{'version': 1, 'success': True, 'problem_list': []} {'version': 1, 'success': True, 'problem_list': []}
) )
......
...@@ -156,7 +156,8 @@ def sanitize_html(html_code): ...@@ -156,7 +156,8 @@ def sanitize_html(html_code):
'audio': ['controls', 'autobuffer', 'autoplay', 'src'], 'audio': ['controls', 'autobuffer', 'autoplay', 'src'],
'img': ['src', 'width', 'height', 'class'] 'img': ['src', 'width', 'height', 'class']
}) })
output = bleach.clean(html_code, output = bleach.clean(
html_code,
tags=bleach.ALLOWED_TAGS + ['div', 'p', 'audio', 'pre', 'img', 'span'], tags=bleach.ALLOWED_TAGS + ['div', 'p', 'audio', 'pre', 'img', 'span'],
styles=['white-space'], styles=['white-space'],
attributes=attributes attributes=attributes
......
...@@ -2,8 +2,12 @@ import codecs ...@@ -2,8 +2,12 @@ import codecs
from fractions import Fraction from fractions import Fraction
import unittest import unittest
from .chemcalc import (compare_chemical_expression, divide_chemical_expression, from .chemcalc import (
render_to_html, chemical_equations_equal) compare_chemical_expression,
divide_chemical_expression,
render_to_html,
chemical_equations_equal,
)
import miller import miller
...@@ -36,8 +40,12 @@ class Test_Compare_Equations(unittest.TestCase): ...@@ -36,8 +40,12 @@ class Test_Compare_Equations(unittest.TestCase):
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2', self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
'2O2 + 2H2 -> 2H2O2')) '2O2 + 2H2 -> 2H2O2'))
self.assertFalse(chemical_equations_equal('2H2 + O2 -> H2O2', self.assertFalse(
'2O2 + 2H2 -> 2H2O2')) chemical_equations_equal(
'2H2 + O2 -> H2O2',
'2O2 + 2H2 -> 2H2O2',
)
)
def test_different_arrows(self): def test_different_arrows(self):
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2', self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
...@@ -50,8 +58,13 @@ class Test_Compare_Equations(unittest.TestCase): ...@@ -50,8 +58,13 @@ class Test_Compare_Equations(unittest.TestCase):
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2', self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
'2O2 + 2H2 -> 2H2O2')) '2O2 + 2H2 -> 2H2O2'))
self.assertFalse(chemical_equations_equal('H2 + O2 -> H2O2', self.assertFalse(
'2O2 + 2H2 -> 2H2O2', exact=True)) chemical_equations_equal(
'H2 + O2 -> H2O2',
'2O2 + 2H2 -> 2H2O2',
exact=True,
)
)
# order still doesn't matter # order still doesn't matter
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2', self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
......
...@@ -352,8 +352,10 @@ class DragAndDrop(object): ...@@ -352,8 +352,10 @@ class DragAndDrop(object):
# correct_answer entries. If the draggable is mentioned in at least one # correct_answer entries. If the draggable is mentioned in at least one
# correct_answer entry, the value is False. # correct_answer entry, the value is False.
# default to consider every user answer excess until proven otherwise. # default to consider every user answer excess until proven otherwise.
self.excess_draggables = dict((users_draggable.keys()[0], True) self.excess_draggables = dict(
for users_draggable in user_answer) (users_draggable.keys()[0], True)
for users_draggable in user_answer
)
# Convert nested `user_answer` to flat format. # Convert nested `user_answer` to flat format.
user_answer = flat_user_answer(user_answer) user_answer = flat_user_answer(user_answer)
......
...@@ -34,7 +34,8 @@ class AnnotatableFields(object): ...@@ -34,7 +34,8 @@ class AnnotatableFields(object):
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <annotation title="My title" body="My comment" highlight="yellow" problem="0">Ut sodales laoreet est, egestas gravida felis egestas nec.</annotation> Aenean at volutpat erat. Cras commodo viverra nibh in aliquam.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <annotation title="My title" body="My comment" highlight="yellow" problem="0">Ut sodales laoreet est, egestas gravida felis egestas nec.</annotation> Aenean at volutpat erat. Cras commodo viverra nibh in aliquam.</p>
<p>Nulla facilisi. <annotation body="Basic annotation example." problem="1">Pellentesque id vestibulum libero.</annotation> Suspendisse potenti. Morbi scelerisque nisi vitae felis dictum mattis. Nam sit amet magna elit. Nullam volutpat cursus est, sit amet sagittis odio vulputate et. Curabitur euismod, orci in vulputate imperdiet, augue lorem tempor purus, id aliquet augue turpis a est. Aenean a sagittis libero. Praesent fringilla pretium magna, non condimentum risus elementum nec. Pellentesque faucibus elementum pharetra. Pellentesque vitae metus eros.</p> <p>Nulla facilisi. <annotation body="Basic annotation example." problem="1">Pellentesque id vestibulum libero.</annotation> Suspendisse potenti. Morbi scelerisque nisi vitae felis dictum mattis. Nam sit amet magna elit. Nullam volutpat cursus est, sit amet sagittis odio vulputate et. Curabitur euismod, orci in vulputate imperdiet, augue lorem tempor purus, id aliquet augue turpis a est. Aenean a sagittis libero. Praesent fringilla pretium magna, non condimentum risus elementum nec. Pellentesque faucibus elementum pharetra. Pellentesque vitae metus eros.</p>
</annotatable> </annotatable>
""")) """)
)
display_name = String( display_name = String(
display_name=_("Display Name"), display_name=_("Display Name"),
help=_("Display name for this module"), help=_("Display name for this module"),
......
...@@ -259,10 +259,12 @@ class CombinedOpenEndedFields(object): ...@@ -259,10 +259,12 @@ class CombinedOpenEndedFields(object):
scope=Scope.settings scope=Scope.settings
) )
extended_due = Date( extended_due = Date(
help=_("Date that this problem is due by for a particular student. This " help=_(
"can be set by an instructor, and will override the global due " "Date that this problem is due by for a particular student. This "
"date if it is set to a date that is later than the global due " "can be set by an instructor, and will override the global due "
"date."), "date if it is set to a date that is later than the global due "
"date."
),
default=None, default=None,
scope=Scope.user_state, scope=Scope.user_state,
) )
...@@ -315,9 +317,11 @@ class CombinedOpenEndedFields(object): ...@@ -315,9 +317,11 @@ class CombinedOpenEndedFields(object):
) )
peer_grade_finished_submissions_when_none_pending = Boolean( peer_grade_finished_submissions_when_none_pending = Boolean(
display_name=_('Allow "overgrading" of peer submissions'), display_name=_('Allow "overgrading" of peer submissions'),
help=_("EXPERIMENTAL FEATURE. Allow students to peer grade submissions that already have the requisite number of graders, " help=_(
"but ONLY WHEN all submissions they are eligible to grade already have enough graders. " "EXPERIMENTAL FEATURE. Allow students to peer grade submissions that already have the requisite number of graders, "
"This is intended for use when settings for `Required Peer Grading` > `Peer Graders per Response`"), "but ONLY WHEN all submissions they are eligible to grade already have enough graders. "
"This is intended for use when settings for `Required Peer Grading` > `Peer Graders per Response`"
),
default=False, default=False,
scope=Scope.settings, scope=Scope.settings,
) )
......
...@@ -359,8 +359,10 @@ class AssignmentFormatGrader(CourseGrader): ...@@ -359,8 +359,10 @@ class AssignmentFormatGrader(CourseGrader):
# if there is only one entry in a section, suppress the existing individual entry and the average, # if there is only one entry in a section, suppress the existing individual entry and the average,
# and just display a single entry for the section. That way it acts automatically like a # and just display a single entry for the section. That way it acts automatically like a
# SingleSectionGrader. # SingleSectionGrader.
total_detail = u"{section_type} = {percent:.0%}".format(percent=total_percent, total_detail = u"{section_type} = {percent:.0%}".format(
section_type=self.section_type) percent=total_percent,
section_type=self.section_type,
)
total_label = u"{short_label}".format(short_label=self.short_label) total_label = u"{short_label}".format(short_label=self.short_label)
breakdown = [{'percent': total_percent, 'label': total_label, breakdown = [{'percent': total_percent, 'label': total_label,
'detail': total_detail, 'category': self.category, 'prominent': True}, ] 'detail': total_detail, 'category': self.category, 'prominent': True}, ]
......
...@@ -19,7 +19,8 @@ _ = lambda text: text ...@@ -19,7 +19,8 @@ _ = lambda text: text
class AnnotatableFields(object): class AnnotatableFields(object):
""" Fields for `ImageModule` and `ImageDescriptor`. """ """ Fields for `ImageModule` and `ImageDescriptor`. """
data = String(help=_("XML data for the annotation"), data = String(
help=_("XML data for the annotation"),
scope=Scope.content, scope=Scope.content,
default=textwrap.dedent("""\ default=textwrap.dedent("""\
<annotatable> <annotatable>
......
...@@ -75,9 +75,16 @@ def get_dummy_course(start, announcement=None, is_new=None, advertised_start=Non ...@@ -75,9 +75,16 @@ def get_dummy_course(start, announcement=None, is_new=None, advertised_start=Non
<html url_name="h" display_name="H">Two houses, ...</html> <html url_name="h" display_name="H">Two houses, ...</html>
</chapter> </chapter>
</course> </course>
'''.format(org=ORG, course=COURSE, start=start, is_new=is_new, '''.format(
announcement=announcement, advertised_start=advertised_start, end=end, org=ORG,
certs=certs) course=COURSE,
start=start,
is_new=is_new,
announcement=announcement,
advertised_start=advertised_start,
end=end,
certs=certs,
)
return system.process_xml(start_xml) return system.process_xml(start_xml)
......
...@@ -17,7 +17,8 @@ _ = lambda text: text ...@@ -17,7 +17,8 @@ _ = lambda text: text
class AnnotatableFields(object): class AnnotatableFields(object):
"""Fields for `TextModule` and `TextDescriptor`.""" """Fields for `TextModule` and `TextDescriptor`."""
data = String(help=_("XML data for the annotation"), data = String(
help=_("XML data for the annotation"),
scope=Scope.content, scope=Scope.content,
default=textwrap.dedent("""\ default=textwrap.dedent("""\
<annotatable> <annotatable>
......
...@@ -19,7 +19,8 @@ _ = lambda text: text ...@@ -19,7 +19,8 @@ _ = lambda text: text
class AnnotatableFields(object): class AnnotatableFields(object):
""" Fields for `VideoModule` and `VideoDescriptor`. """ """ Fields for `VideoModule` and `VideoDescriptor`. """
data = String(help=_("XML data for the annotation"), data = String(
help=_("XML data for the annotation"),
scope=Scope.content, scope=Scope.content,
default=textwrap.dedent("""\ default=textwrap.dedent("""\
<annotatable> <annotatable>
......
...@@ -68,14 +68,32 @@ class OpenResponseTest(UniqueCourseTest): ...@@ -68,14 +68,32 @@ class OpenResponseTest(UniqueCourseTest):
XBlockFixtureDesc('chapter', 'Test Section').add_children( XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection').add_children( XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
XBlockFixtureDesc('combinedopenended', 'Self-Assessed', XBlockFixtureDesc(
data=load_data_str('ora_self_problem.xml'), metadata={'graded': True}), 'combinedopenended',
'Self-Assessed',
XBlockFixtureDesc('combinedopenended', 'AI-Assessed', data=load_data_str('ora_self_problem.xml'),
data=load_data_str('ora_ai_problem.xml'), metadata={'graded': True}), metadata={
'graded': True,
XBlockFixtureDesc('combinedopenended', self.peer_problem_name, },
data=load_data_str('ora_peer_problem.xml'), metadata={'graded': True}), ),
XBlockFixtureDesc(
'combinedopenended',
'AI-Assessed',
data=load_data_str('ora_ai_problem.xml'),
metadata={
'graded': True,
},
),
XBlockFixtureDesc(
'combinedopenended',
self.peer_problem_name,
data=load_data_str('ora_peer_problem.xml'),
metadata={
'graded': True,
},
),
# This is the interface a student can use to grade his/her peers # This is the interface a student can use to grade his/her peers
XBlockFixtureDesc('peergrading', 'Peer Module'), XBlockFixtureDesc('peergrading', 'Peer Module'),
......
...@@ -47,8 +47,14 @@ sys.path.append(root / "lms/djangoapps") ...@@ -47,8 +47,14 @@ sys.path.append(root / "lms/djangoapps")
sys.path.append(root / "lms/lib") sys.path.append(root / "lms/lib")
sys.path.append(root / "cms/djangoapps") sys.path.append(root / "cms/djangoapps")
sys.path.append(root / "cms/lib") sys.path.append(root / "cms/lib")
sys.path.insert(0, os.path.abspath(os.path.normpath(os.path.dirname(__file__) sys.path.insert(
+ '/../../../'))) 0,
os.path.abspath(
os.path.normpath(
os.path.dirname(__file__) + '/../../../'
)
)
)
sys.path.append('.') sys.path.append('.')
# django configuration - careful here # django configuration - careful here
......
...@@ -39,8 +39,14 @@ sys.path.append(root / "lms/djangoapps/mobile_api/course_info") ...@@ -39,8 +39,14 @@ sys.path.append(root / "lms/djangoapps/mobile_api/course_info")
sys.path.append(root / "lms/djangoapps/mobile_api/users") sys.path.append(root / "lms/djangoapps/mobile_api/users")
sys.path.append(root / "lms/djangoapps/mobile_api/video_outlines") sys.path.append(root / "lms/djangoapps/mobile_api/video_outlines")
sys.path.insert(0, os.path.abspath(os.path.normpath(os.path.dirname(__file__) sys.path.insert(
+ '/../../../'))) 0,
os.path.abspath(
os.path.normpath(
os.path.dirname(__file__) + '/../../../'
)
)
)
sys.path.append('.') sys.path.append('.')
# django configuration - careful here # django configuration - careful here
......
...@@ -34,8 +34,11 @@ class LoginEnrollmentTestCase(TestCase): ...@@ -34,8 +34,11 @@ class LoginEnrollmentTestCase(TestCase):
self.email = 'foo@test.com' self.email = 'foo@test.com'
self.password = 'bar' self.password = 'bar'
self.username = 'test' self.username = 'test'
self.user = self.create_account(self.username, self.user = self.create_account(
self.email, self.password) self.username,
self.email,
self.password,
)
self.activate_user(self.email) self.activate_user(self.email)
self.login(self.email, self.password) self.login(self.email, self.password)
......
...@@ -50,8 +50,10 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -50,8 +50,10 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.tabssection = ItemFactory.create(parent=self.chapterchrome, self.tabssection = ItemFactory.create(parent=self.chapterchrome,
display_name='tabs', display_name='tabs',
chrome='tabs') chrome='tabs')
self.defaultchromesection = ItemFactory.create(parent=self.chapterchrome, self.defaultchromesection = ItemFactory.create(
display_name='defaultchrome') parent=self.chapterchrome,
display_name='defaultchrome',
)
self.fullchromesection = ItemFactory.create(parent=self.chapterchrome, self.fullchromesection = ItemFactory.create(parent=self.chapterchrome,
display_name='fullchrome', display_name='fullchrome',
chrome='accordion,tabs') chrome='accordion,tabs')
......
...@@ -6,45 +6,55 @@ from mock import MagicMock ...@@ -6,45 +6,55 @@ from mock import MagicMock
class ProgessTests(TestCase): class ProgessTests(TestCase):
def setUp(self): def setUp(self):
self.d = dict({'duration_total': 0, self.d = dict({
'duration_watched': 0, 'duration_total': 0,
'done': True, 'duration_watched': 0,
'questions_correct': 4, 'done': True,
'questions_incorrect': 0, 'questions_correct': 4,
'questions_total': 0}) 'questions_incorrect': 0,
'questions_total': 0,
})
self.c = progress.completion() self.c = progress.completion()
self.c2 = progress.completion() self.c2 = progress.completion()
self.c2.dict = dict({'duration_total': 0, self.c2.dict = dict({
'duration_watched': 0, 'duration_total': 0,
'done': True, 'duration_watched': 0,
'questions_correct': 2, 'done': True,
'questions_incorrect': 1, 'questions_correct': 2,
'questions_total': 0}) 'questions_incorrect': 1,
'questions_total': 0,
self.cplusc2 = dict({'duration_total': 0, })
'duration_watched': 0,
'done': True, self.cplusc2 = dict({
'questions_correct': 2, 'duration_total': 0,
'questions_incorrect': 1, 'duration_watched': 0,
'questions_total': 0}) 'done': True,
'questions_correct': 2,
self.oth = dict({'duration_total': 0, 'questions_incorrect': 1,
'duration_watched': 0, 'questions_total': 0,
'done': True, })
'questions_correct': 4,
'questions_incorrect': 0, self.oth = dict({
'questions_total': 7}) 'duration_total': 0,
'duration_watched': 0,
'done': True,
'questions_correct': 4,
'questions_incorrect': 0,
'questions_total': 7,
})
self.x = MagicMock() self.x = MagicMock()
self.x.dict = self.oth self.x.dict = self.oth
self.d_oth = {'duration_total': 0, self.d_oth = {
'duration_watched': 0, 'duration_total': 0,
'done': True, 'duration_watched': 0,
'questions_correct': 4, 'done': True,
'questions_incorrect': 0, 'questions_correct': 4,
'questions_total': 7} 'questions_incorrect': 0,
'questions_total': 7,
}
def test_getitem(self): def test_getitem(self):
self.assertEqual(self.c.__getitem__('duration_watched'), 0) self.assertEqual(self.c.__getitem__('duration_watched'), 0)
......
...@@ -301,8 +301,13 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys ...@@ -301,8 +301,13 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys
subtask_id_list = [str(uuid4()) for _ in range(total_num_subtasks)] subtask_id_list = [str(uuid4()) for _ in range(total_num_subtasks)]
# Update the InstructorTask with information about the subtasks we've defined. # Update the InstructorTask with information about the subtasks we've defined.
TASK_LOG.info("Task %s: updating InstructorTask %s with subtask info for %s subtasks to process %s items.", TASK_LOG.info(
task_id, entry.id, total_num_subtasks, total_num_items) # pylint: disable=E1101 "Task %s: updating InstructorTask %s with subtask info for %s subtasks to process %s items.",
task_id,
entry.id,
total_num_subtasks,
total_num_items,
) # pylint: disable=E1101
progress = initialize_subtask_info(entry, action_name, total_num_items, subtask_id_list) progress = initialize_subtask_info(entry, action_name, total_num_items, subtask_id_list)
# Construct a generator that will return the recipients to use for each subtask. # Construct a generator that will return the recipients to use for each subtask.
...@@ -317,8 +322,12 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys ...@@ -317,8 +322,12 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys
) )
# Now create the subtasks, and start them running. # Now create the subtasks, and start them running.
TASK_LOG.info("Task %s: creating %s subtasks to process %s items.", TASK_LOG.info(
task_id, total_num_subtasks, total_num_items) "Task %s: creating %s subtasks to process %s items.",
task_id,
total_num_subtasks,
total_num_items,
)
num_subtasks = 0 num_subtasks = 0
for item_list in item_list_generator: for item_list in item_list_generator:
subtask_id = subtask_id_list[num_subtasks] subtask_id = subtask_id_list[num_subtasks]
......
...@@ -198,8 +198,12 @@ def set_value_in_cache(student_id, course_id, notification_type, value): ...@@ -198,8 +198,12 @@ def set_value_in_cache(student_id, course_id, notification_type, value):
def create_key_name(student_id, course_id, notification_type): def create_key_name(student_id, course_id, notification_type):
key_name = u"{prefix}{type}_{course}_{student}".format(prefix=KEY_PREFIX, type=notification_type, course=course_id, key_name = u"{prefix}{type}_{course}_{student}".format(
student=student_id) prefix=KEY_PREFIX,
type=notification_type,
course=course_id,
student=student_id,
)
return key_name return key_name
......
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