diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py
index e3929cf94d..6a83fd35eb 100644
--- a/cms/djangoapps/contentstore/features/common.py
+++ b/cms/djangoapps/contentstore/features/common.py
@@ -286,8 +286,15 @@ def _do_studio_prompt_action(intent, action):
Wait for a studio prompt to appear and press the specified action button
See cms/static/js/views/feedback_prompt.js for implementation
"""
- assert intent in ['warning', 'error', 'confirmation', 'announcement',
- 'step-required', 'help', 'mini']
+ assert intent in [
+ 'warning',
+ 'error',
+ 'confirmation',
+ 'announcement',
+ 'step-required',
+ 'help',
+ 'mini',
+ ]
assert action in ['primary', 'secondary']
world.wait_for_present('div.wrapper-prompt.is-shown#prompt-{}'.format(intent))
diff --git a/cms/djangoapps/contentstore/features/component.py b/cms/djangoapps/contentstore/features/component.py
index ea1cee8d62..bc37e8fd41 100644
--- a/cms/djangoapps/contentstore/features/component.py
+++ b/cms/djangoapps/contentstore/features/component.py
@@ -52,19 +52,13 @@ def see_a_multi_step_component(step, category):
world.wait_for(lambda _: len(world.css_find(selector)) == len(step.hashes))
for idx, step_hash in enumerate(step.hashes):
-
if category == 'HTML':
html_matcher = {
- 'Text':
- '\n \n',
- 'Announcement':
- '
Words of encouragement! This is a short note that most students will read.
',
- 'Zooming Image':
- 'ZOOMING DIAGRAMS
',
- 'E-text Written in LaTeX':
- 'Example: E-text page
',
- 'Raw HTML':
- 'This template is similar to the Text template. The only difference is',
+ 'Text': '\n \n',
+ 'Announcement': '
Words of encouragement! This is a short note that most students will read.
',
+ 'Zooming Image': 'ZOOMING DIAGRAMS
',
+ 'E-text Written in LaTeX': 'Example: E-text page
',
+ 'Raw HTML': 'This template is similar to the Text template. The only difference is',
}
actual_html = world.css_html(selector, index=idx)
assert_in(html_matcher[step_hash['Component']], actual_html)
diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
index 9e9ed9cc7f..749f611469 100644
--- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
@@ -93,8 +93,10 @@ def click_component_from_menu(category, component_type, is_advanced):
"""
if is_advanced:
# Sometimes this click does not work if you go too fast.
- world.retry_on_exception(_click_advanced,
- ignored_exceptions=AssertionError)
+ world.retry_on_exception(
+ _click_advanced,
+ ignored_exceptions=AssertionError,
+ )
# Retry this in case the list is empty because you tried too fast.
link = world.retry_on_exception(
diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py
index b30c79ecb7..d8ab58a6d5 100644
--- a/cms/djangoapps/contentstore/features/course-export.py
+++ b/cms/djangoapps/contentstore/features/course-export.py
@@ -24,7 +24,8 @@ def i_export_the_course(step):
@step('I edit and enter bad XML$')
def i_enter_bad_xml(step):
- enter_xml_in_advanced_problem(step,
+ enter_xml_in_advanced_problem(
+ step,
"""Smallest Canvas
You want to make the smallest canvas you can.
diff --git a/cms/djangoapps/contentstore/tests/test_i18n.py b/cms/djangoapps/contentstore/tests/test_i18n.py
index d9843cb621..e9e1739488 100644
--- a/cms/djangoapps/contentstore/tests/test_i18n.py
+++ b/cms/djangoapps/contentstore/tests/test_i18n.py
@@ -55,10 +55,11 @@ class InternationalizationTest(ModuleStoreTestCase):
self.client = AjaxEnabledTestClient()
self.client.login(username=self.uname, password=self.password)
- resp = self.client.get_html('/course/',
- {},
- HTTP_ACCEPT_LANGUAGE='en'
- )
+ resp = self.client.get_html(
+ '/course/',
+ {},
+ HTTP_ACCEPT_LANGUAGE='en',
+ )
self.assertContains(resp,
'',
diff --git a/cms/djangoapps/contentstore/tests/test_permissions.py b/cms/djangoapps/contentstore/tests/test_permissions.py
index 0e08f1eb17..6e71d1a418 100644
--- a/cms/djangoapps/contentstore/tests/test_permissions.py
+++ b/cms/djangoapps/contentstore/tests/test_permissions.py
@@ -32,13 +32,14 @@ class TestCourseAccess(ModuleStoreTestCase):
# 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')
course_url = reverse_url('course_handler')
- self.client.ajax_post(course_url,
+ self.client.ajax_post(
+ course_url,
{
'org': self.course_key.org,
'number': self.course_key.course,
'display_name': 'My favorite course',
'run': self.course_key.run,
- }
+ },
)
self.users = self._create_users()
diff --git a/cms/djangoapps/contentstore/views/assets.py b/cms/djangoapps/contentstore/views/assets.py
index e8924fe7c9..95baa62747 100644
--- a/cms/djangoapps/contentstore/views/assets.py
+++ b/cms/djangoapps/contentstore/views/assets.py
@@ -190,8 +190,8 @@ def _upload_asset(request, course_key):
# first let's see if a thumbnail can be created
(thumbnail_content, thumbnail_location) = contentstore().generate_thumbnail(
- content,
- tempfile_path=tempfile_path
+ content,
+ tempfile_path=tempfile_path,
)
# delete cached thumbnail even if one couldn't be created this time (else
diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py
index 5d5529aaf3..69440fe1d8 100644
--- a/cms/djangoapps/contentstore/views/course.py
+++ b/cms/djangoapps/contentstore/views/course.py
@@ -387,10 +387,13 @@ def course_listing(request):
'run': uca.course_key.run,
'is_failed': True if uca.state == CourseRerunUIStateManager.State.FAILED else False,
'is_in_progress': True if uca.state == CourseRerunUIStateManager.State.IN_PROGRESS else False,
- 'dismiss_link':
- reverse_course_url('course_notifications_handler', uca.course_key, kwargs={
+ 'dismiss_link': reverse_course_url(
+ 'course_notifications_handler',
+ uca.course_key,
+ kwargs={
'action_state_id': uca.id,
- }) if uca.state == CourseRerunUIStateManager.State.FAILED else ''
+ },
+ ) if uca.state == CourseRerunUIStateManager.State.FAILED else ''
}
# remove any courses in courses that are also in the in_process_course_actions list
@@ -456,10 +459,13 @@ def course_index(request, course_key):
'rerun_notification_id': current_action.id if current_action else None,
'course_release_date': course_release_date,
'settings_url': settings_url,
- 'notification_dismiss_url':
- reverse_course_url('course_notifications_handler', current_action.course_key, kwargs={
+ 'notification_dismiss_url': reverse_course_url(
+ 'course_notifications_handler',
+ current_action.course_key,
+ kwargs={
'action_state_id': current_action.id,
- }) if current_action else None,
+ },
+ ) if current_action else None,
})
diff --git a/cms/djangoapps/models/settings/course_metadata.py b/cms/djangoapps/models/settings/course_metadata.py
index 9aeb1cb1a9..d1b0ebacf1 100644
--- a/cms/djangoapps/models/settings/course_metadata.py
+++ b/cms/djangoapps/models/settings/course_metadata.py
@@ -14,23 +14,24 @@ class CourseMetadata(object):
# The list of fields that wouldn't be shown in Advanced Settings.
# Should not be used directly. Instead the filtered_list method should be used if the field needs to be filtered
# depending on the feature flag.
- FILTERED_LIST = ['xml_attributes',
- 'start',
- 'end',
- 'enrollment_start',
- 'enrollment_end',
- 'tabs',
- 'graceperiod',
- 'checklists',
- 'show_timezone',
- 'format',
- 'graded',
- 'hide_from_toc',
- 'pdf_textbooks',
- 'user_partitions',
- 'name', # from xblock
- 'tags', # from xblock
- 'visible_to_staff_only'
+ FILTERED_LIST = [
+ 'xml_attributes',
+ 'start',
+ 'end',
+ 'enrollment_start',
+ 'enrollment_end',
+ 'tabs',
+ 'graceperiod',
+ 'checklists',
+ 'show_timezone',
+ 'format',
+ 'graded',
+ 'hide_from_toc',
+ 'pdf_textbooks',
+ 'user_partitions',
+ 'name', # from xblock
+ 'tags', # from xblock
+ 'visible_to_staff_only',
]
@classmethod
diff --git a/cms/urls.py b/cms/urls.py
index bd99ae6c7e..6548044b96 100644
--- a/cms/urls.py
+++ b/cms/urls.py
@@ -104,18 +104,25 @@ js_info_dict = {
'packages': ('openassessment',),
}
-urlpatterns += patterns('',
+urlpatterns += patterns(
+ '',
# Serve catalog of localized strings to be rendered by Javascript
url(r'^i18n.js$', 'django.views.i18n.javascript_catalog', js_info_dict),
)
if settings.FEATURES.get('ENABLE_EXPORT_GIT'):
- urlpatterns += (url(r'^export_git/{}$'.format(settings.COURSE_KEY_PATTERN),
- 'contentstore.views.export_git', name='export_git'),)
+ urlpatterns += (url(
+ r'^export_git/{}$'.format(
+ settings.COURSE_KEY_PATTERN,
+ ),
+ 'contentstore.views.export_git',
+ name='export_git',
+ ),)
if settings.FEATURES.get('ENABLE_SERVICE_STATUS'):
- urlpatterns += patterns('',
+ urlpatterns += patterns(
+ '',
url(r'^status/', include('service_status.urls')),
)
diff --git a/common/djangoapps/course_groups/cohorts.py b/common/djangoapps/course_groups/cohorts.py
index 37c0abf959..d10c6309dc 100644
--- a/common/djangoapps/course_groups/cohorts.py
+++ b/common/djangoapps/course_groups/cohorts.py
@@ -219,9 +219,11 @@ def get_cohort(user, course_key):
return None
try:
- return CourseUserGroup.objects.get(course_id=course_key,
- group_type=CourseUserGroup.COHORT,
- users__id=user.id)
+ return CourseUserGroup.objects.get(
+ course_id=course_key,
+ group_type=CourseUserGroup.COHORT,
+ users__id=user.id,
+ )
except CourseUserGroup.DoesNotExist:
# Didn't find the group. We'll go on to create one if needed.
pass
diff --git a/common/djangoapps/course_groups/models.py b/common/djangoapps/course_groups/models.py
index 7c17898899..aae9f40604 100644
--- a/common/djangoapps/course_groups/models.py
+++ b/common/djangoapps/course_groups/models.py
@@ -24,8 +24,11 @@ class CourseUserGroup(models.Model):
# Note: groups associated with particular runs of a course. E.g. Fall 2012 and Spring
# 2013 versions of 6.00x will have separate groups.
- course_id = CourseKeyField(max_length=255, db_index=True,
- help_text="Which course is this group associated with?")
+ course_id = CourseKeyField(
+ max_length=255,
+ db_index=True,
+ help_text="Which course is this group associated with?",
+ )
# For now, only have group type 'cohort', but adding a type field to support
# things like 'question_discussion', 'friends', 'off-line-class', etc
diff --git a/common/djangoapps/django_comment_common/models.py b/common/djangoapps/django_comment_common/models.py
index e5ec9c3f20..fdce8fe993 100644
--- a/common/djangoapps/django_comment_common/models.py
+++ b/common/djangoapps/django_comment_common/models.py
@@ -67,7 +67,7 @@ class Role(models.Model):
def inherit_permissions(self, role): # TODO the name of this method is a little bit confusing,
# since it's one-off and doesn't handle inheritance later
if role.course_id and role.course_id != self.course_id:
- logging.warning("%s cannot inherit permissions from %s due to course_id inconsistency", \
+ logging.warning("%s cannot inherit permissions from %s due to course_id inconsistency",
self, role)
for per in role.permissions.all():
self.add_permission(per)
diff --git a/common/djangoapps/geoinfo/tests/test_middleware.py b/common/djangoapps/geoinfo/tests/test_middleware.py
index 2ef8e9fc6a..3e6b7159ac 100644
--- a/common/djangoapps/geoinfo/tests/test_middleware.py
+++ b/common/djangoapps/geoinfo/tests/test_middleware.py
@@ -46,8 +46,10 @@ class CountryMiddlewareTests(TestCase):
return ip_dict.get(ip_addr, 'US')
def test_country_code_added(self):
- request = self.request_factory.get('/somewhere',
- HTTP_X_FORWARDED_FOR='117.79.83.1')
+ request = self.request_factory.get(
+ '/somewhere',
+ HTTP_X_FORWARDED_FOR='117.79.83.1',
+ )
request.user = self.authenticated_user
self.session_middleware.process_request(request)
# No country code exists before request.
@@ -59,8 +61,10 @@ class CountryMiddlewareTests(TestCase):
self.assertEqual('117.79.83.1', request.session.get('ip_address'))
def test_ip_address_changed(self):
- request = self.request_factory.get('/somewhere',
- HTTP_X_FORWARDED_FOR='4.0.0.0')
+ request = self.request_factory.get(
+ '/somewhere',
+ HTTP_X_FORWARDED_FOR='4.0.0.0',
+ )
request.user = self.anonymous_user
self.session_middleware.process_request(request)
request.session['country_code'] = 'CN'
@@ -71,8 +75,10 @@ class CountryMiddlewareTests(TestCase):
self.assertEqual('4.0.0.0', request.session.get('ip_address'))
def test_ip_address_is_not_changed(self):
- request = self.request_factory.get('/somewhere',
- HTTP_X_FORWARDED_FOR='117.79.83.1')
+ request = self.request_factory.get(
+ '/somewhere',
+ HTTP_X_FORWARDED_FOR='117.79.83.1',
+ )
request.user = self.anonymous_user
self.session_middleware.process_request(request)
request.session['country_code'] = 'CN'
@@ -83,8 +89,10 @@ class CountryMiddlewareTests(TestCase):
self.assertEqual('117.79.83.1', request.session.get('ip_address'))
def test_same_country_different_ip(self):
- request = self.request_factory.get('/somewhere',
- HTTP_X_FORWARDED_FOR='117.79.83.100')
+ request = self.request_factory.get(
+ '/somewhere',
+ HTTP_X_FORWARDED_FOR='117.79.83.100',
+ )
request.user = self.anonymous_user
self.session_middleware.process_request(request)
request.session['country_code'] = 'CN'
diff --git a/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py b/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py
index 60b7c58047..076204c31e 100644
--- a/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py
+++ b/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py
@@ -7,8 +7,7 @@ from django.core.cache import get_cache
class Command(NoArgsCommand):
- help = \
-'''Import the specified data directory into the default ModuleStore'''
+ help = 'Import the specified data directory into the default ModuleStore'
def handle_noargs(self, **options):
staticfiles_cache = get_cache('staticfiles')
diff --git a/common/djangoapps/status/tests.py b/common/djangoapps/status/tests.py
index e4f750d8c1..20787e1ed6 100644
--- a/common/djangoapps/status/tests.py
+++ b/common/djangoapps/status/tests.py
@@ -47,7 +47,7 @@ class TestStatus(TestCase):
(global_only, "Hello, Globe", "Hello, Globe", "Hello, Globe"),
(toy_only, None, "A toy story", None),
(global_and_toy, "Hello, Globe", "Hello, Globe
A toy story", "Hello, Globe"),
- ]
+ ]
def setUp(self):
"""
diff --git a/common/djangoapps/student/management/commands/6002exportusers.py b/common/djangoapps/student/management/commands/6002exportusers.py
index a36d6e84c6..0cb2b2ffee 100644
--- a/common/djangoapps/student/management/commands/6002exportusers.py
+++ b/common/djangoapps/student/management/commands/6002exportusers.py
@@ -18,14 +18,13 @@ from student.models import UserProfile
class Command(BaseCommand):
- help = \
-'''Exports all users and user profiles.
+ help = """Exports all users and user profiles.
Caveat: Should be looked over before any run
for schema changes.
Current version grabs user_keys from
django.contrib.auth.models.User and up_keys
-from student.userprofile. '''
+from student.userprofile."""
def handle(self, *args, **options):
users = list(User.objects.all())
diff --git a/common/djangoapps/student/management/commands/6002importusers.py b/common/djangoapps/student/management/commands/6002importusers.py
index 93d86dfc05..17b4c2069b 100644
--- a/common/djangoapps/student/management/commands/6002importusers.py
+++ b/common/djangoapps/student/management/commands/6002importusers.py
@@ -39,14 +39,13 @@ def import_user(u):
class Command(BaseCommand):
- help = \
-'''Exports all users and user profiles.
+ help = """Exports all users and user profiles.
Caveat: Should be looked over before any run
for schema changes.
Current version grabs user_keys from
django.contrib.auth.models.User and up_keys
-from student.userprofile. '''
+from student.userprofile."""
def handle(self, *args, **options):
extracted = json.load(open('transfer_users.txt'))
diff --git a/common/djangoapps/student/management/commands/add_to_group.py b/common/djangoapps/student/management/commands/add_to_group.py
index bdbb4027f7..66f0f4eaca 100644
--- a/common/djangoapps/student/management/commands/add_to_group.py
+++ b/common/djangoapps/student/management/commands/add_to_group.py
@@ -21,7 +21,7 @@ class Command(BaseCommand):
dest='remove',
default=False,
help='Remove the user from the group instead of adding it'),
- )
+ )
args = ' '
help = 'Add a user to a group'
diff --git a/common/djangoapps/student/management/commands/assigngroups.py b/common/djangoapps/student/management/commands/assigngroups.py
index cbd5cfad22..3c6df5b3ba 100644
--- a/common/djangoapps/student/management/commands/assigngroups.py
+++ b/common/djangoapps/student/management/commands/assigngroups.py
@@ -6,6 +6,7 @@ from student.models import UserTestGroup
import random
import sys
import datetime
+from textwrap import dedent
import json
from pytz import UTC
@@ -25,16 +26,15 @@ def group_from_value(groups, v):
class Command(BaseCommand):
- help = \
-''' Assign users to test groups. Takes a list
-of groups:
-a:0.3,b:0.4,c:0.3 file.txt "Testing something"
-Will assign each user to group a, b, or c with
-probability 0.3, 0.4, 0.3. Probabilities must
-add up to 1.
+ help = dedent("""\
+ Assign users to test groups. Takes a list of groups:
+ a:0.3,b:0.4,c:0.3 file.txt "Testing something"
+ Will assign each user to group a, b, or c with
+ probability 0.3, 0.4, 0.3. Probabilities must
+ add up to 1.
-Will log what happened to file.txt.
-'''
+ Will log what happened to file.txt.
+ """)
def handle(self, *args, **options):
if len(args) != 3:
diff --git a/common/djangoapps/student/management/commands/emaillist.py b/common/djangoapps/student/management/commands/emaillist.py
index e69b072db2..8a74aafbcf 100644
--- a/common/djangoapps/student/management/commands/emaillist.py
+++ b/common/djangoapps/student/management/commands/emaillist.py
@@ -3,8 +3,7 @@ from django.contrib.auth.models import User
class Command(BaseCommand):
- help = \
-''' Extract an e-mail list of all active students. '''
+ help = 'Extract an e-mail list of all active students.'
def handle(self, *args, **options):
#text = open(args[0]).read()
diff --git a/common/djangoapps/student/management/commands/set_staff.py b/common/djangoapps/student/management/commands/set_staff.py
index 869e37f13b..1556923253 100644
--- a/common/djangoapps/student/management/commands/set_staff.py
+++ b/common/djangoapps/student/management/commands/set_staff.py
@@ -12,7 +12,7 @@ class Command(BaseCommand):
dest='unset',
default=False,
help='Set is_staff to False instead of True'),
- )
+ )
args = ' [user|email ...]>'
help = """
diff --git a/common/djangoapps/student/management/commands/sync_user_info.py b/common/djangoapps/student/management/commands/sync_user_info.py
index d7fdd3323f..7d239b2e09 100644
--- a/common/djangoapps/student/management/commands/sync_user_info.py
+++ b/common/djangoapps/student/management/commands/sync_user_info.py
@@ -8,10 +8,7 @@ import lms.lib.comment_client as cc
class Command(BaseCommand):
- help = \
-'''
-Sync all user ids, usernames, and emails to the discussion
-service'''
+ help = 'Sync all user ids, usernames, and emails to the discussion service'
def handle(self, *args, **options):
for user in User.objects.all().iterator():
diff --git a/common/djangoapps/student/management/commands/userinfo.py b/common/djangoapps/student/management/commands/userinfo.py
index 8656fb9183..bb6ef108a3 100644
--- a/common/djangoapps/student/management/commands/userinfo.py
+++ b/common/djangoapps/student/management/commands/userinfo.py
@@ -7,26 +7,25 @@ from student.models import UserProfile
class Command(BaseCommand):
- help = \
-''' Extract full user information into a JSON file.
-Pass a single filename.'''
+ help = """Extract full user information into a JSON file.
+Pass a single filename."""
def handle(self, *args, **options):
- f = open(args[0], 'w')
- #text = open(args[0]).read()
- #subject = open(args[1]).read()
+ file_output = open(args[0], 'w')
users = User.objects.all()
- l = []
+ data_list = []
for user in users:
- up = UserProfile.objects.get(user=user)
- d = {'username': user.username,
- 'email': user.email,
- 'is_active': user.is_active,
- 'joined': user.date_joined.isoformat(),
- 'name': up.name,
- 'language': up.language,
- 'location': up.location}
- l.append(d)
- json.dump(l, f)
- f.close()
+ profile = UserProfile.objects.get(user=user)
+ data = {
+ 'username': user.username,
+ 'email': user.email,
+ 'is_active': user.is_active,
+ 'joined': user.date_joined.isoformat(),
+ 'name': profile.name,
+ 'language': profile.language,
+ 'location': profile.location,
+ }
+ data_list.append(data)
+ json.dump(data_list, file_output)
+ file_output.close()
diff --git a/common/djangoapps/student/middleware.py b/common/djangoapps/student/middleware.py
index ccffbb1659..055a76309f 100644
--- a/common/djangoapps/student/middleware.py
+++ b/common/djangoapps/student/middleware.py
@@ -24,15 +24,13 @@ class UserStandingMiddleware(object):
else:
if user_account.account_status == UserStanding.ACCOUNT_DISABLED:
msg = _(
- 'Your account has been disabled. If you believe '
- 'this was done in error, please contact us at '
- '{link_start}{support_email}{link_end}'
- ).format(
- support_email=settings.DEFAULT_FEEDBACK_EMAIL,
- link_start=u''.format(
- address=settings.DEFAULT_FEEDBACK_EMAIL,
- subject_line=_('Disabled Account'),
- ),
- link_end=u''
- )
+ 'Your account has been disabled. If you believe '
+ 'this was done in error, please contact us at '
+ '{support_email}'
+ ).format(
+ support_email=u'{address}'.format(
+ address=settings.DEFAULT_FEEDBACK_EMAIL,
+ subject_line=_('Disabled Account'),
+ ),
+ )
return HttpResponseForbidden(msg)
diff --git a/common/djangoapps/student/tests/test_auto_auth.py b/common/djangoapps/student/tests/test_auto_auth.py
index f6123d89c3..fd6a8b4092 100644
--- a/common/djangoapps/student/tests/test_auto_auth.py
+++ b/common/djangoapps/student/tests/test_auto_auth.py
@@ -25,7 +25,7 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
(COURSE_ID_SPLIT, SlashSeparatedCourseKey.from_deprecated_string(COURSE_ID_SPLIT)),
(COURSE_ID_MONGO, CourseLocator.from_string(COURSE_ID_MONGO)),
(COURSE_ID_SPLIT, CourseLocator.from_string(COURSE_ID_SPLIT)),
- )
+ )
@patch.dict("django.conf.settings.FEATURES", {"AUTOMATIC_AUTH_FOR_TESTING": True})
def setUp(self):
diff --git a/common/djangoapps/student/tests/test_password_policy.py b/common/djangoapps/student/tests/test_password_policy.py
index 75ad3ce3ac..194de075f3 100644
--- a/common/djangoapps/student/tests/test_password_policy.py
+++ b/common/djangoapps/student/tests/test_password_policy.py
@@ -170,12 +170,14 @@ class TestPasswordPolicy(TestCase):
response = self.client.post(self.url, self.url_params)
self.assertEqual(response.status_code, 400)
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 digits, "
"must contain 3 or more punctuation characters, "
"must contain 3 or more unique words"
- ")")
+ ")"
+ )
self.assertEqual(obj['value'], errstring)
@patch.dict("django.conf.settings.PASSWORD_COMPLEXITY", {
diff --git a/common/djangoapps/terrain/stubs/comments.py b/common/djangoapps/terrain/stubs/comments.py
index 9d8e247a72..b2a072fb37 100644
--- a/common/djangoapps/terrain/stubs/comments.py
+++ b/common/djangoapps/terrain/stubs/comments.py
@@ -81,7 +81,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
"collection": user_threads,
"page": page,
"num_pages": num_pages
- })
+ })
else:
self.send_response(404, content="404 Not Found")
diff --git a/common/djangoapps/terrain/stubs/lti.py b/common/djangoapps/terrain/stubs/lti.py
index b3dbcbafd5..7bcf2b9c73 100644
--- a/common/djangoapps/terrain/stubs/lti.py
+++ b/common/djangoapps/terrain/stubs/lti.py
@@ -124,7 +124,7 @@ class StubLtiHandler(StubHttpRequestHandler):
'Content-Type': 'application/xml',
'X-Requested-With': 'XMLHttpRequest',
'Authorization': self._oauth_sign(url, data)
- }
+ }
# Send request ignoring verifirecation of SSL certificate
response = requests.post(url, data=data, headers=headers, verify=False)
diff --git a/common/djangoapps/terrain/stubs/ora.py b/common/djangoapps/terrain/stubs/ora.py
index 8efc5be4aa..b25c021a25 100644
--- a/common/djangoapps/terrain/stubs/ora.py
+++ b/common/djangoapps/terrain/stubs/ora.py
@@ -526,8 +526,7 @@ class StubOraService(StubHttpService):
'num_graded': self.DUMMY_DATA['problem_list_num_graded'],
'num_pending': self.DUMMY_DATA['problem_list_num_pending'],
'num_required': self.DUMMY_DATA['problem_list_num_required']
- } for location, name in self.problems.items()
- ]
+ } for location, name in self.problems.items()]
def register_problem(self, location, name):
"""
diff --git a/common/djangoapps/terrain/stubs/tests/test_ora.py b/common/djangoapps/terrain/stubs/tests/test_ora.py
index 7b11944ed6..ffa4416311 100644
--- a/common/djangoapps/terrain/stubs/tests/test_ora.py
+++ b/common/djangoapps/terrain/stubs/tests/test_ora.py
@@ -187,7 +187,8 @@ class StubOraServiceTest(unittest.TestCase):
params={'course_id': 'test course'}
)
- self._assert_response(response,
+ self._assert_response(
+ response,
{'version': 1, 'success': True, 'problem_list': []}
)
diff --git a/common/djangoapps/track/middleware.py b/common/djangoapps/track/middleware.py
index 242e819a5f..4a6507b0ac 100644
--- a/common/djangoapps/track/middleware.py
+++ b/common/djangoapps/track/middleware.py
@@ -59,8 +59,10 @@ class TrackMiddleware(object):
if string in get_dict:
get_dict[string] = '*' * 8
- event = {'GET': dict(get_dict),
- 'POST': dict(post_dict)}
+ event = {
+ 'GET': dict(get_dict),
+ 'POST': dict(post_dict),
+ }
# TODO: Confirm no large file uploads
event = json.dumps(event)
diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py
index a854e1109f..7b3dbbe79f 100644
--- a/common/lib/capa/capa/capa_problem.py
+++ b/common/lib/capa/capa/capa_problem.py
@@ -694,7 +694,7 @@ class LoncapaProblem(object):
return
if (problemtree.tag == 'script' and problemtree.get('type')
- and 'javascript' in problemtree.get('type')):
+ and 'javascript' in problemtree.get('type')):
# leave javascript intact.
return deepcopy(problemtree)
diff --git a/common/lib/capa/capa/registry.py b/common/lib/capa/capa/registry.py
index fedb029fe2..af2156a686 100644
--- a/common/lib/capa/capa/registry.py
+++ b/common/lib/capa/capa/registry.py
@@ -24,15 +24,20 @@ class TagRegistry(object):
if len(cls.tags) == 0:
raise ValueError("No tags specified for class {0}".format(cls.__name__))
- for t in cls.tags:
- if t in self._mapping:
- other_cls = self._mapping[t]
+ for tag in cls.tags:
+ if tag in self._mapping:
+ other_cls = self._mapping[tag]
if cls == other_cls:
# registering the same class multiple times seems silly, but ok
continue
- raise ValueError("Tag {0} already registered by class {1}."
- " Can't register for class {2}"
- .format(t, other_cls.__name__, cls.__name__))
+ raise ValueError(
+ "Tag {0} already registered by class {1}."
+ " Can't register for class {2}".format(
+ tag,
+ other_cls.__name__,
+ cls.__name__,
+ )
+ )
# Ok, should be good to change state now.
for t in cls.tags:
diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py
index 00600573e7..87137039ea 100644
--- a/common/lib/capa/capa/responsetypes.py
+++ b/common/lib/capa/capa/responsetypes.py
@@ -2120,8 +2120,11 @@ class CodeResponse(LoncapaResponse):
parsed = False
if not parsed:
- log.error("Unable to parse external grader message as valid"
- " XML: score_msg['msg']=%s", msg)
+ log.error(
+ "Unable to parse external grader message as valid"
+ " XML: score_msg['msg']=%s",
+ msg,
+ )
return fail
return (True, score_result['correct'], score_result['score'], msg)
diff --git a/common/lib/capa/capa/util.py b/common/lib/capa/capa/util.py
index 2db5024b32..e9197ad19e 100644
--- a/common/lib/capa/capa/util.py
+++ b/common/lib/capa/capa/util.py
@@ -156,7 +156,8 @@ def sanitize_html(html_code):
'audio': ['controls', 'autobuffer', 'autoplay', 'src'],
'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'],
styles=['white-space'],
attributes=attributes
diff --git a/common/lib/chem/chem/chemcalc.py b/common/lib/chem/chem/chemcalc.py
index 930c5818f4..119b558fe4 100644
--- a/common/lib/chem/chem/chemcalc.py
+++ b/common/lib/chem/chem/chemcalc.py
@@ -339,8 +339,12 @@ def divide_chemical_expression(s1, s2, ignore_state=False):
if treedic['1 phases'] != treedic['2 phases']:
return False
- if any(map(lambda x, y: x / y - treedic['1 factors'][0] / treedic['2 factors'][0],
- treedic['1 factors'], treedic['2 factors'])):
+ if any(
+ [
+ x / y - treedic['1 factors'][0] / treedic['2 factors'][0]
+ for (x, y) in zip(treedic['1 factors'], treedic['2 factors'])
+ ]
+ ):
# factors are not proportional
return False
else:
diff --git a/common/lib/chem/chem/tests.py b/common/lib/chem/chem/tests.py
index 4f000eb3f2..4087016e41 100644
--- a/common/lib/chem/chem/tests.py
+++ b/common/lib/chem/chem/tests.py
@@ -2,8 +2,12 @@ import codecs
from fractions import Fraction
import unittest
-from .chemcalc import (compare_chemical_expression, divide_chemical_expression,
- render_to_html, chemical_equations_equal)
+from .chemcalc import (
+ compare_chemical_expression,
+ divide_chemical_expression,
+ render_to_html,
+ chemical_equations_equal,
+)
import miller
@@ -36,8 +40,12 @@ class Test_Compare_Equations(unittest.TestCase):
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
'2O2 + 2H2 -> 2H2O2'))
- self.assertFalse(chemical_equations_equal('2H2 + O2 -> H2O2',
- '2O2 + 2H2 -> 2H2O2'))
+ self.assertFalse(
+ chemical_equations_equal(
+ '2H2 + O2 -> H2O2',
+ '2O2 + 2H2 -> 2H2O2',
+ )
+ )
def test_different_arrows(self):
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
@@ -50,8 +58,13 @@ class Test_Compare_Equations(unittest.TestCase):
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
'2O2 + 2H2 -> 2H2O2'))
- self.assertFalse(chemical_equations_equal('H2 + O2 -> H2O2',
- '2O2 + 2H2 -> 2H2O2', exact=True))
+ self.assertFalse(
+ chemical_equations_equal(
+ 'H2 + O2 -> H2O2',
+ '2O2 + 2H2 -> 2H2O2',
+ exact=True,
+ )
+ )
# order still doesn't matter
self.assertTrue(chemical_equations_equal('H2 + O2 -> H2O2',
diff --git a/common/lib/sandbox-packages/verifiers/draganddrop.py b/common/lib/sandbox-packages/verifiers/draganddrop.py
index 28ac146d4f..3a00478a7d 100644
--- a/common/lib/sandbox-packages/verifiers/draganddrop.py
+++ b/common/lib/sandbox-packages/verifiers/draganddrop.py
@@ -98,7 +98,7 @@ class PositionsCompare(list):
return False
if (isinstance(self[0], (list, int, float)) and
- isinstance(other[0], (list, int, float))):
+ isinstance(other[0], (list, int, float))):
return self.coordinate_positions_compare(other)
elif (isinstance(self[0], (unicode, str)) and
@@ -352,8 +352,10 @@ class DragAndDrop(object):
# correct_answer entries. If the draggable is mentioned in at least one
# correct_answer entry, the value is False.
# default to consider every user answer excess until proven otherwise.
- self.excess_draggables = dict((users_draggable.keys()[0], True)
- for users_draggable in user_answer)
+ self.excess_draggables = dict(
+ (users_draggable.keys()[0], True)
+ for users_draggable in user_answer
+ )
# Convert nested `user_answer` to flat format.
user_answer = flat_user_answer(user_answer)
@@ -368,7 +370,8 @@ class DragAndDrop(object):
if draggable_name in answer['draggables']:
user_groups_data.append(draggable_name)
user_positions_data.append(
- draggable_dict[draggable_name])
+ draggable_dict[draggable_name]
+ )
# proved that this is not excess
self.excess_draggables[draggable_name] = False
diff --git a/common/lib/xmodule/xmodule/annotatable_module.py b/common/lib/xmodule/xmodule/annotatable_module.py
index 471b00bc8c..5eacfad07e 100644
--- a/common/lib/xmodule/xmodule/annotatable_module.py
+++ b/common/lib/xmodule/xmodule/annotatable_module.py
@@ -15,9 +15,10 @@ _ = lambda text: text
class AnnotatableFields(object):
- data = String(help=_("XML data for the annotation"), scope=Scope.content,
- default=textwrap.dedent(
- """\
+ data = String(
+ help=_("XML data for the annotation"),
+ scope=Scope.content,
+ default=textwrap.dedent("""
Enter your (optional) instructions for the exercise in HTML format.
@@ -33,7 +34,8 @@ class AnnotatableFields(object):
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sodales laoreet est, egestas gravida felis egestas nec. Aenean at volutpat erat. Cras commodo viverra nibh in aliquam.
Nulla facilisi. Pellentesque id vestibulum libero. 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.
- """))
+ """)
+ )
display_name = String(
display_name=_("Display Name"),
help=_("Display name for this module"),
diff --git a/common/lib/xmodule/xmodule/combined_open_ended_module.py b/common/lib/xmodule/xmodule/combined_open_ended_module.py
index a6e8d5bf36..03b1f217d5 100644
--- a/common/lib/xmodule/xmodule/combined_open_ended_module.py
+++ b/common/lib/xmodule/xmodule/combined_open_ended_module.py
@@ -259,10 +259,12 @@ class CombinedOpenEndedFields(object):
scope=Scope.settings
)
extended_due = Date(
- help=_("Date that this problem is due by for a particular student. This "
- "can be set by an instructor, and will override the global due "
- "date if it is set to a date that is later than the global due "
- "date."),
+ help=_(
+ "Date that this problem is due by for a particular student. This "
+ "can be set by an instructor, and will override the global due "
+ "date if it is set to a date that is later than the global due "
+ "date."
+ ),
default=None,
scope=Scope.user_state,
)
@@ -315,9 +317,11 @@ class CombinedOpenEndedFields(object):
)
peer_grade_finished_submissions_when_none_pending = Boolean(
display_name=_('Allow "overgrading" of peer submissions'),
- help=_("EXPERIMENTAL FEATURE. Allow students to peer grade submissions that already have the requisite number of graders, "
- "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`"),
+ help=_(
+ "EXPERIMENTAL FEATURE. Allow students to peer grade submissions that already have the requisite number of graders, "
+ "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,
scope=Scope.settings,
)
diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py
index 54f9d0dfa1..48b3b89227 100644
--- a/common/lib/xmodule/xmodule/course_module.py
+++ b/common/lib/xmodule/xmodule/course_module.py
@@ -328,121 +328,175 @@ class CourseFields(object):
scope=Scope.settings
)
has_children = True
- checklists = List(scope=Scope.settings,
- default=[
- {"short_description": _("Getting Started With Studio"),
- "items": [{"short_description": _("Add Course Team Members"),
- "long_description": _("Grant your collaborators permission to edit your course so you can work together."),
- "is_checked": False,
- "action_url": "ManageUsers",
- "action_text": _("Edit Course Team"),
- "action_external": False},
- {"short_description": _("Set Important Dates for Your Course"),
- "long_description": _("Establish your course's student enrollment and launch dates on the Schedule and Details page."),
- "is_checked": False,
- "action_url": "SettingsDetails",
- "action_text": _("Edit Course Details & Schedule"),
- "action_external": False},
- {"short_description": _("Draft Your Course's Grading Policy"),
- "long_description": _("Set up your assignment types and grading policy even if you haven't created all your assignments."),
- "is_checked": False,
- "action_url": "SettingsGrading",
- "action_text": _("Edit Grading Settings"),
- "action_external": False},
- {"short_description": _("Explore the Other Studio Checklists"),
- "long_description": _("Discover other available course authoring tools, and find help when you need it."),
- "is_checked": False,
- "action_url": "",
- "action_text": "",
- "action_external": False}]},
- {"short_description": _("Draft a Rough Course Outline"),
- "items": [{"short_description": _("Create Your First Section and Subsection"),
- "long_description": _("Use your course outline to build your first Section and Subsection."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False},
- {"short_description": _("Set Section Release Dates"),
- "long_description": _("Specify the release dates for each Section in your course. Sections become visible to students on their release dates."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False},
- {"short_description": _("Designate a Subsection as Graded"),
- "long_description": _("Set a Subsection to be graded as a specific assignment type. Assignments within graded Subsections count toward a student's final grade."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False},
- {"short_description": _("Reordering Course Content"),
- "long_description": _("Use drag and drop to reorder the content in your course."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False},
- {"short_description": _("Renaming Sections"),
- "long_description": _("Rename Sections by clicking the Section name from the Course Outline."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False},
- {"short_description": _("Deleting Course Content"),
- "long_description": _("Delete Sections, Subsections, or Units you don't need anymore. Be careful, as there is no Undo function."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False},
- {"short_description": _("Add an Instructor-Only Section to Your Outline"),
- "long_description": _("Some course authors find using a section for unsorted, in-progress work useful. To do this, create a section and set the release date to the distant future."),
- "is_checked": False,
- "action_url": "CourseOutline",
- "action_text": _("Edit Course Outline"),
- "action_external": False}]},
- {"short_description": _("Explore edX's Support Tools"),
- "items": [{"short_description": _("Explore the Studio Help Forum"),
- "long_description": _("Access the Studio Help forum from the menu that appears when you click your user name in the top right corner of Studio."),
- "is_checked": False,
- "action_url": "http://help.edge.edx.org/",
- "action_text": _("Visit Studio Help"),
- "action_external": True},
- {"short_description": _("Enroll in edX 101"),
- "long_description": _("Register for edX 101, edX's primer for course creation."),
- "is_checked": False,
- "action_url": "https://edge.edx.org/courses/edX/edX101/How_to_Create_an_edX_Course/about",
- "action_text": _("Register for edX 101"),
- "action_external": True},
- {"short_description": _("Download the Studio Documentation"),
- "long_description": _("Download the searchable Studio reference documentation in PDF form."),
- "is_checked": False,
- "action_url": "http://files.edx.org/Getting_Started_with_Studio.pdf",
- "action_text": _("Download Documentation"),
- "action_external": True}]},
- {"short_description": _("Draft Your Course About Page"),
- "items": [{"short_description": _("Draft a Course Description"),
- "long_description": _("Courses on edX have an About page that includes a course video, description, and more. Draft the text students will read before deciding to enroll in your course."),
- "is_checked": False,
- "action_url": "SettingsDetails",
- "action_text": _("Edit Course Schedule & Details"),
- "action_external": False},
- {"short_description": _("Add Staff Bios"),
- "long_description": _("Showing prospective students who their instructor will be is helpful. Include staff bios on the course About page."),
- "is_checked": False,
- "action_url": "SettingsDetails",
- "action_text": _("Edit Course Schedule & Details"),
- "action_external": False},
- {"short_description": _("Add Course FAQs"),
- "long_description": _("Include a short list of frequently asked questions about your course."),
- "is_checked": False,
- "action_url": "SettingsDetails",
- "action_text": _("Edit Course Schedule & Details"),
- "action_external": False},
- {"short_description": _("Add Course Prerequisites"),
- "long_description": _("Let students know what knowledge and/or skills they should have before they enroll in your course."),
- "is_checked": False,
- "action_url": "SettingsDetails",
- "action_text": _("Edit Course Schedule & Details"),
- "action_external": False}]}
- ])
+ checklists = List(
+ scope=Scope.settings,
+ default=[
+ {
+ "short_description": _("Getting Started With Studio"),
+ "items": [
+ {
+ "short_description": _("Add Course Team Members"),
+ "long_description": _("Grant your collaborators permission to edit your course so you can work together."),
+ "is_checked": False,
+ "action_url": "ManageUsers",
+ "action_text": _("Edit Course Team"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Set Important Dates for Your Course"),
+ "long_description": _("Establish your course's student enrollment and launch dates on the Schedule and Details page."),
+ "is_checked": False,
+ "action_url": "SettingsDetails",
+ "action_text": _("Edit Course Details & Schedule"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Draft Your Course's Grading Policy"),
+ "long_description": _("Set up your assignment types and grading policy even if you haven't created all your assignments."),
+ "is_checked": False,
+ "action_url": "SettingsGrading",
+ "action_text": _("Edit Grading Settings"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Explore the Other Studio Checklists"),
+ "long_description": _("Discover other available course authoring tools, and find help when you need it."),
+ "is_checked": False,
+ "action_url": "",
+ "action_text": "",
+ "action_external": False,
+ },
+ ],
+ },
+ {
+ "short_description": _("Draft a Rough Course Outline"),
+ "items": [
+ {
+ "short_description": _("Create Your First Section and Subsection"),
+ "long_description": _("Use your course outline to build your first Section and Subsection."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Set Section Release Dates"),
+ "long_description": _("Specify the release dates for each Section in your course. Sections become visible to students on their release dates."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Designate a Subsection as Graded"),
+ "long_description": _("Set a Subsection to be graded as a specific assignment type. Assignments within graded Subsections count toward a student's final grade."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Reordering Course Content"),
+ "long_description": _("Use drag and drop to reorder the content in your course."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Renaming Sections"),
+ "long_description": _("Rename Sections by clicking the Section name from the Course Outline."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Deleting Course Content"),
+ "long_description": _("Delete Sections, Subsections, or Units you don't need anymore. Be careful, as there is no Undo function."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Add an Instructor-Only Section to Your Outline"),
+ "long_description": _("Some course authors find using a section for unsorted, in-progress work useful. To do this, create a section and set the release date to the distant future."),
+ "is_checked": False,
+ "action_url": "CourseOutline",
+ "action_text": _("Edit Course Outline"),
+ "action_external": False,
+ },
+ ],
+ },
+ {
+ "short_description": _("Explore edX's Support Tools"),
+ "items": [
+ {
+ "short_description": _("Explore the Studio Help Forum"),
+ "long_description": _("Access the Studio Help forum from the menu that appears when you click your user name in the top right corner of Studio."),
+ "is_checked": False,
+ "action_url": "http://help.edge.edx.org/",
+ "action_text": _("Visit Studio Help"),
+ "action_external": True,
+ },
+ {
+ "short_description": _("Enroll in edX 101"),
+ "long_description": _("Register for edX 101, edX's primer for course creation."),
+ "is_checked": False,
+ "action_url": "https://edge.edx.org/courses/edX/edX101/How_to_Create_an_edX_Course/about",
+ "action_text": _("Register for edX 101"),
+ "action_external": True,
+ },
+ {
+ "short_description": _("Download the Studio Documentation"),
+ "long_description": _("Download the searchable Studio reference documentation in PDF form."),
+ "is_checked": False,
+ "action_url": "http://files.edx.org/Getting_Started_with_Studio.pdf",
+ "action_text": _("Download Documentation"),
+ "action_external": True,
+ },
+ ],
+ },
+ {
+ "short_description": _("Draft Your Course About Page"),
+ "items": [
+ {
+ "short_description": _("Draft a Course Description"),
+ "long_description": _("Courses on edX have an About page that includes a course video, description, and more. Draft the text students will read before deciding to enroll in your course."),
+ "is_checked": False,
+ "action_url": "SettingsDetails",
+ "action_text": _("Edit Course Schedule & Details"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Add Staff Bios"),
+ "long_description": _("Showing prospective students who their instructor will be is helpful. Include staff bios on the course About page."),
+ "is_checked": False,
+ "action_url": "SettingsDetails",
+ "action_text": _("Edit Course Schedule & Details"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Add Course FAQs"),
+ "long_description": _("Include a short list of frequently asked questions about your course."),
+ "is_checked": False,
+ "action_url": "SettingsDetails",
+ "action_text": _("Edit Course Schedule & Details"),
+ "action_external": False,
+ },
+ {
+ "short_description": _("Add Course Prerequisites"),
+ "long_description": _("Let students know what knowledge and/or skills they should have before they enroll in your course."),
+ "is_checked": False,
+ "action_url": "SettingsDetails",
+ "action_text": _("Edit Course Schedule & Details"),
+ "action_external": False,
+ },
+ ],
+ },
+ ],
+ )
info_sidebar_name = String(
display_name=_("Course Info Sidebar Name"),
help=_("Enter the heading that you want students to see above your course handouts on the Course Info page. Your course handouts appear in the right panel of the page."),
diff --git a/common/lib/xmodule/xmodule/errortracker.py b/common/lib/xmodule/xmodule/errortracker.py
index 80e6d288f8..e39604805a 100644
--- a/common/lib/xmodule/xmodule/errortracker.py
+++ b/common/lib/xmodule/xmodule/errortracker.py
@@ -39,7 +39,7 @@ def make_error_tracker():
# don't display irrelevant gunicorn sync error
if (('python2.7/site-packages/gunicorn/workers/sync.py' in exc_str) and
- ('[Errno 11] Resource temporarily unavailable' in exc_str)):
+ ('[Errno 11] Resource temporarily unavailable' in exc_str)):
exc_str = ''
errors.append((msg, exc_str))
diff --git a/common/lib/xmodule/xmodule/graders.py b/common/lib/xmodule/xmodule/graders.py
index c1339c2009..b5e0e1ba9f 100644
--- a/common/lib/xmodule/xmodule/graders.py
+++ b/common/lib/xmodule/xmodule/graders.py
@@ -359,8 +359,10 @@ class AssignmentFormatGrader(CourseGrader):
# 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
# SingleSectionGrader.
- total_detail = u"{section_type} = {percent:.0%}".format(percent=total_percent,
- section_type=self.section_type)
+ total_detail = u"{section_type} = {percent:.0%}".format(
+ percent=total_percent,
+ section_type=self.section_type,
+ )
total_label = u"{short_label}".format(short_label=self.short_label)
breakdown = [{'percent': total_percent, 'label': total_label,
'detail': total_detail, 'category': self.category, 'prominent': True}, ]
diff --git a/common/lib/xmodule/xmodule/imageannotation_module.py b/common/lib/xmodule/xmodule/imageannotation_module.py
index 60d31fcfe4..013d5c405a 100644
--- a/common/lib/xmodule/xmodule/imageannotation_module.py
+++ b/common/lib/xmodule/xmodule/imageannotation_module.py
@@ -19,7 +19,8 @@ _ = lambda text: text
class AnnotatableFields(object):
""" Fields for `ImageModule` and `ImageDescriptor`. """
- data = String(help=_("XML data for the annotation"),
+ data = String(
+ help=_("XML data for the annotation"),
scope=Scope.content,
default=textwrap.dedent("""\
diff --git a/common/lib/xmodule/xmodule/mako_module.py b/common/lib/xmodule/xmodule/mako_module.py
index ecbac28d86..7718cb341e 100644
--- a/common/lib/xmodule/xmodule/mako_module.py
+++ b/common/lib/xmodule/xmodule/mako_module.py
@@ -23,9 +23,12 @@ class MakoModuleDescriptor(XModuleDescriptor):
def __init__(self, *args, **kwargs):
super(MakoModuleDescriptor, self).__init__(*args, **kwargs)
if getattr(self.runtime, 'render_template', None) is None:
- raise TypeError('{runtime} must have a render_template function'
- ' in order to use a MakoDescriptor'.format(
- runtime=self.runtime))
+ raise TypeError(
+ '{runtime} must have a render_template function'
+ ' in order to use a MakoDescriptor'.format(
+ runtime=self.runtime,
+ )
+ )
def get_context(self):
"""
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
index 7203e39b7d..015ecdd164 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
@@ -152,16 +152,21 @@ class MongoConnection(object):
original_version (str or ObjectID): The id of a structure
block_key (BlockKey): The id of the block in question
"""
- return [structure_from_mongo(structure) for structure in self.structures.find({
- 'original_version': original_version,
- 'blocks': {
- '$elemMatch': {
- 'block_id': block_key.id,
- 'block_type': block_key.type,
- 'edit_info.update_version': {'$exists': True},
- }
- }
- })]
+ return [
+ structure_from_mongo(structure)
+ for structure in self.structures.find({
+ 'original_version': original_version,
+ 'blocks': {
+ '$elemMatch': {
+ 'block_id': block_key.id,
+ 'block_type': block_key.type,
+ 'edit_info.update_version': {
+ '$exists': True,
+ },
+ },
+ },
+ })
+ ]
def insert_structure(self, structure):
"""
diff --git a/common/lib/xmodule/xmodule/tests/test_course_module.py b/common/lib/xmodule/xmodule/tests/test_course_module.py
index ab15eb3a17..5083c79845 100644
--- a/common/lib/xmodule/xmodule/tests/test_course_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_course_module.py
@@ -75,9 +75,16 @@ def get_dummy_course(start, announcement=None, is_new=None, advertised_start=Non
Two houses, ...
- '''.format(org=ORG, course=COURSE, start=start, is_new=is_new,
- announcement=announcement, advertised_start=advertised_start, end=end,
- certs=certs)
+ '''.format(
+ org=ORG,
+ course=COURSE,
+ start=start,
+ is_new=is_new,
+ announcement=announcement,
+ advertised_start=advertised_start,
+ end=end,
+ certs=certs,
+ )
return system.process_xml(start_xml)
diff --git a/common/lib/xmodule/xmodule/tests/test_peer_grading.py b/common/lib/xmodule/xmodule/tests/test_peer_grading.py
index 5267bb53d8..6242893d29 100644
--- a/common/lib/xmodule/xmodule/tests/test_peer_grading.py
+++ b/common/lib/xmodule/xmodule/tests/test_peer_grading.py
@@ -319,7 +319,7 @@ class PeerGradingModuleLinkedTest(unittest.TestCase, DummyModulestore):
'use_for_single_location': True,
'link_to_location': self.coe_location.to_deprecated_string(),
'graded': True,
- })
+ })
@property
def scope_ids(self):
diff --git a/common/lib/xmodule/xmodule/textannotation_module.py b/common/lib/xmodule/xmodule/textannotation_module.py
index 662637f7c3..8006006b4e 100644
--- a/common/lib/xmodule/xmodule/textannotation_module.py
+++ b/common/lib/xmodule/xmodule/textannotation_module.py
@@ -17,7 +17,8 @@ _ = lambda text: text
class AnnotatableFields(object):
"""Fields for `TextModule` and `TextDescriptor`."""
- data = String(help=_("XML data for the annotation"),
+ data = String(
+ help=_("XML data for the annotation"),
scope=Scope.content,
default=textwrap.dedent("""\
diff --git a/common/lib/xmodule/xmodule/videoannotation_module.py b/common/lib/xmodule/xmodule/videoannotation_module.py
index 78ac023af4..9e84c0711e 100644
--- a/common/lib/xmodule/xmodule/videoannotation_module.py
+++ b/common/lib/xmodule/xmodule/videoannotation_module.py
@@ -19,7 +19,8 @@ _ = lambda text: text
class AnnotatableFields(object):
""" Fields for `VideoModule` and `VideoDescriptor`. """
- data = String(help=_("XML data for the annotation"),
+ data = String(
+ help=_("XML data for the annotation"),
scope=Scope.content,
default=textwrap.dedent("""\
diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py
index 3a7d5699d1..5332296e15 100644
--- a/common/lib/xmodule/xmodule/x_module.py
+++ b/common/lib/xmodule/xmodule/x_module.py
@@ -202,7 +202,7 @@ class XModuleMixin(XBlockMixin):
# an XModule context, not an XModuleDescriptor context,
# so we should use the xmodule_runtime (ModuleSystem) as the runtime.
if (not isinstance(self, (XModule, XModuleDescriptor)) and
- self.xmodule_runtime is not None):
+ self.xmodule_runtime is not None):
return PureSystem(self.xmodule_runtime, self._runtime)
else:
return self._runtime
diff --git a/common/static/js/vendor/mathjax-MathJax-c9db6ac/docs/source/conf.py b/common/static/js/vendor/mathjax-MathJax-c9db6ac/docs/source/conf.py
index 819bff31aa..961ce6aa8e 100644
--- a/common/static/js/vendor/mathjax-MathJax-c9db6ac/docs/source/conf.py
+++ b/common/static/js/vendor/mathjax-MathJax-c9db6ac/docs/source/conf.py
@@ -176,8 +176,13 @@ htmlhelp_basename = 'MathJaxdoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'MathJax.tex', u'MathJax Documentation',
- u'Davide Cervone, Casey Stark, Robert Miner, Paul Topping', 'manual'),
+ (
+ 'index',
+ 'MathJax.tex',
+ u'MathJax Documentation',
+ u'Davide Cervone, Casey Stark, Robert Miner, Paul Topping',
+ 'manual',
+ ),
]
# The name of an image file (relative to this directory) to place at the top of
diff --git a/common/test/acceptance/pages/lms/course_nav.py b/common/test/acceptance/pages/lms/course_nav.py
index 84da21d6a7..a7bde281a7 100644
--- a/common/test/acceptance/pages/lms/course_nav.py
+++ b/common/test/acceptance/pages/lms/course_nav.py
@@ -147,7 +147,8 @@ class CourseNavPage(PageObject):
# It *would* make sense to always get the HTML, but unfortunately
# the open tab has some child tags that we don't want.
return self.q(
- css=subsection_css).map(
+ css=subsection_css
+ ).map(
lambda el: el.text.strip().split('\n')[0] if el.is_displayed() else el.get_attribute('innerHTML').strip()
).results
diff --git a/common/test/acceptance/tests/studio/test_studio_with_ora_component.py b/common/test/acceptance/tests/studio/test_studio_with_ora_component.py
index 6d0a6f7ac6..18f3e81cfa 100644
--- a/common/test/acceptance/tests/studio/test_studio_with_ora_component.py
+++ b/common/test/acceptance/tests/studio/test_studio_with_ora_component.py
@@ -33,8 +33,14 @@ class ORAComponentTest(StudioCourseTest):
XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
XBlockFixtureDesc('vertical', 'Test Unit').add_children(
- XBlockFixtureDesc('combinedopenended', "Peer Problem",
- data=load_data_str('ora_peer_problem.xml'), metadata={'graded': True}),
+ XBlockFixtureDesc(
+ 'combinedopenended',
+ "Peer Problem",
+ data=load_data_str('ora_peer_problem.xml'),
+ metadata={
+ 'graded': True,
+ },
+ ),
XBlockFixtureDesc('peergrading', 'Peer Module'),
)
)
diff --git a/common/test/acceptance/tests/test_ora.py b/common/test/acceptance/tests/test_ora.py
index 6d8770de1b..149a23f511 100644
--- a/common/test/acceptance/tests/test_ora.py
+++ b/common/test/acceptance/tests/test_ora.py
@@ -68,19 +68,39 @@ class OpenResponseTest(UniqueCourseTest):
XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
- XBlockFixtureDesc('combinedopenended', 'Self-Assessed',
- data=load_data_str('ora_self_problem.xml'), metadata={'graded': True}),
+ XBlockFixtureDesc(
+ 'combinedopenended',
+ 'Self-Assessed',
+ data=load_data_str('ora_self_problem.xml'),
+ metadata={
+ 'graded': True,
+ },
+ ),
- XBlockFixtureDesc('combinedopenended', 'AI-Assessed',
- data=load_data_str('ora_ai_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}),
+ 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
XBlockFixtureDesc('peergrading', 'Peer Module'),
- ))).install()
+ )
+ )
+ ).install()
# Configure the XQueue stub's response for the text we will submit
# The submission text is unique so we can associate each response with a particular test case.
diff --git a/common/xml_cleanup.py b/common/xml_cleanup.py
index 9fc8fd00f6..050189a7a3 100755
--- a/common/xml_cleanup.py
+++ b/common/xml_cleanup.py
@@ -76,7 +76,7 @@ def cleanup(filepath, remove_meta):
print "WARNING: {0} has both slug and url_name".format(node)
if ('url_name' in attrs and 'filename' in attrs and
- len(attrs) == 2 and attrs['url_name'] == attrs['filename']):
+ len(attrs) == 2 and attrs['url_name'] == attrs['filename']):
# This is a pointer tag in disguise. Get rid of the filename.
print 'turning {0}.{1} into a pointer tag'.format(node.tag, attrs['url_name'])
del attrs['filename']
diff --git a/docs/en_us/developers/source/conf.py b/docs/en_us/developers/source/conf.py
index 724bee93f2..5ddf43fc2a 100644
--- a/docs/en_us/developers/source/conf.py
+++ b/docs/en_us/developers/source/conf.py
@@ -47,8 +47,14 @@ sys.path.append(root / "lms/djangoapps")
sys.path.append(root / "lms/lib")
sys.path.append(root / "cms/djangoapps")
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('.')
# django configuration - careful here
@@ -134,7 +140,7 @@ MOCK_MODULES = [
'yaml',
'webob',
'webob.multidict',
- ]
+]
if on_rtd:
for mod_name in MOCK_MODULES:
diff --git a/docs/en_us/platform_api/source/conf.py b/docs/en_us/platform_api/source/conf.py
index 204089f741..f26bc95ef5 100644
--- a/docs/en_us/platform_api/source/conf.py
+++ b/docs/en_us/platform_api/source/conf.py
@@ -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/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('.')
# django configuration - careful here
@@ -126,7 +132,7 @@ MOCK_MODULES = [
'yaml',
'webob',
'webob.multidict',
- ]
+]
if on_rtd:
for mod_name in MOCK_MODULES:
diff --git a/docs/shared/conf.py b/docs/shared/conf.py
index f020c247cd..3a7960b20b 100644
--- a/docs/shared/conf.py
+++ b/docs/shared/conf.py
@@ -196,21 +196,26 @@ htmlhelp_basename = 'edxdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
+ # The paper size ('letterpaper' or 'a4paper').
+ #'papersize': 'letterpaper',
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
+ # The font size ('10pt', '11pt' or '12pt').
+ #'pointsize': '10pt',
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
+ # Additional stuff for the LaTeX preamble.
+ #'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'getting_started.tex', u'edX Studio Documentation',
- u'EdX Doc Team', 'manual'),
+ (
+ 'index',
+ 'getting_started.tex',
+ u'edX Studio Documentation',
+ u'EdX Doc Team',
+ 'manual',
+ ),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -253,9 +258,15 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'getting_started', u'getting_started Documentation',
- u'EdX Doc Team', 'getting_started', 'One line description of project.',
- 'Miscellaneous'),
+ (
+ 'index',
+ 'getting_started',
+ u'getting_started Documentation',
+ u'EdX Doc Team',
+ 'getting_started',
+ 'One line description of project.',
+ 'Miscellaneous',
+ ),
]
# Documents to append as an appendix to all manuals.
diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py
index 93bcbf7c1f..4dae9f3161 100644
--- a/lms/djangoapps/courseware/access.py
+++ b/lms/djangoapps/courseware/access.py
@@ -154,7 +154,7 @@ def _has_access_course_desc(user, action, course):
# if using registration method to restrict (say shibboleth)
if settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
if user is not None and user.is_authenticated() and \
- ExternalAuthMap.objects.filter(user=user, external_domain=course.enrollment_domain):
+ ExternalAuthMap.objects.filter(user=user, external_domain=course.enrollment_domain):
debug("Allow: external_auth of " + course.enrollment_domain)
reg_method_ok = True
else:
diff --git a/lms/djangoapps/courseware/features/certificates.py b/lms/djangoapps/courseware/features/certificates.py
index 3192d7999b..ed283587cf 100644
--- a/lms/djangoapps/courseware/features/certificates.py
+++ b/lms/djangoapps/courseware/features/certificates.py
@@ -32,7 +32,7 @@ def create_cert_course():
min_price=16,
suggested_prices='32,64,128',
currency='usd',
- )
+ )
def register():
diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py
index 48e30837ed..9134b14872 100644
--- a/lms/djangoapps/courseware/grades.py
+++ b/lms/djangoapps/courseware/grades.py
@@ -260,8 +260,10 @@ def _grade(student, request, course, keep_raw_scores):
if graded_total.possible > 0:
format_scores.append(graded_total)
else:
- log.info("Unable to grade a section with a total possible score of zero. " +
- str(section_descriptor.location))
+ log.info(
+ "Unable to grade a section with a total possible score of zero. " +
+ str(section_descriptor.location)
+ )
totaled_scores[section_format] = format_scores
diff --git a/lms/djangoapps/courseware/models.py b/lms/djangoapps/courseware/models.py
index cb471dd79c..c6f5565251 100644
--- a/lms/djangoapps/courseware/models.py
+++ b/lms/djangoapps/courseware/models.py
@@ -54,10 +54,11 @@ class StudentModule(models.Model):
## Grade, and are we done?
grade = models.FloatField(null=True, blank=True, db_index=True)
max_grade = models.FloatField(null=True, blank=True)
- DONE_TYPES = (('na', 'NOT_APPLICABLE'),
- ('f', 'FINISHED'),
- ('i', 'INCOMPLETE'),
- )
+ DONE_TYPES = (
+ ('na', 'NOT_APPLICABLE'),
+ ('f', 'FINISHED'),
+ ('i', 'INCOMPLETE'),
+ )
done = models.CharField(max_length=8, choices=DONE_TYPES, default='na', db_index=True)
created = models.DateTimeField(auto_now_add=True, db_index=True)
diff --git a/lms/djangoapps/courseware/progress.py b/lms/djangoapps/courseware/progress.py
deleted file mode 100644
index b9dd3fa781..0000000000
--- a/lms/djangoapps/courseware/progress.py
+++ /dev/null
@@ -1,38 +0,0 @@
-class completion(object):
- def __init__(self, **d):
- self.dict = dict({'duration_total': 0,
- 'duration_watched': 0,
- 'done': True,
- 'questions_correct': 0,
- 'questions_incorrect': 0,
- 'questions_total': 0})
- if d:
- self.dict.update(d)
-
- def __getitem__(self, key):
- return self.dict[key]
-
- def __setitem__(self, key, value):
- self.dict[key] = value
-
- def __add__(self, other):
- result = dict(self.dict)
- for item in ['duration_total',
- 'duration_watched',
- 'done',
- 'questions_correct',
- 'questions_incorrect',
- 'questions_total']:
- result[item] = result[item] + other.dict[item]
- return completion(**result)
-
- def __contains__(self, key):
- return key in dict
-
- def __repr__(self):
- return repr(self.dict)
-
-if __name__ == '__main__':
- dict1 = completion(duration_total=5)
- dict2 = completion(duration_total=7)
- print dict1 + dict2
diff --git a/lms/djangoapps/courseware/tests/helpers.py b/lms/djangoapps/courseware/tests/helpers.py
index d0bf1bc45c..1aee349cd5 100644
--- a/lms/djangoapps/courseware/tests/helpers.py
+++ b/lms/djangoapps/courseware/tests/helpers.py
@@ -27,6 +27,8 @@ class LoginEnrollmentTestCase(TestCase):
Provides support for user creation,
activation, login, and course enrollment.
"""
+ user = None
+
def setup_user(self):
"""
Create a user account, activate, and log in.
@@ -34,8 +36,11 @@ class LoginEnrollmentTestCase(TestCase):
self.email = 'foo@test.com'
self.password = 'bar'
self.username = 'test'
- self.user = self.create_account(self.username,
- self.email, self.password)
+ self.user = self.create_account(
+ self.username,
+ self.email,
+ self.password,
+ )
self.activate_user(self.email)
self.login(self.email, self.password)
diff --git a/lms/djangoapps/courseware/tests/test_navigation.py b/lms/djangoapps/courseware/tests/test_navigation.py
index 6b5dbe41a3..d9b36ebd01 100644
--- a/lms/djangoapps/courseware/tests/test_navigation.py
+++ b/lms/djangoapps/courseware/tests/test_navigation.py
@@ -50,8 +50,10 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.tabssection = ItemFactory.create(parent=self.chapterchrome,
display_name='tabs',
chrome='tabs')
- self.defaultchromesection = ItemFactory.create(parent=self.chapterchrome,
- display_name='defaultchrome')
+ self.defaultchromesection = ItemFactory.create(
+ parent=self.chapterchrome,
+ display_name='defaultchrome',
+ )
self.fullchromesection = ItemFactory.create(parent=self.chapterchrome,
display_name='fullchrome',
chrome='accordion,tabs')
diff --git a/lms/djangoapps/courseware/tests/test_progress.py b/lms/djangoapps/courseware/tests/test_progress.py
deleted file mode 100644
index a70cbe4b9a..0000000000
--- a/lms/djangoapps/courseware/tests/test_progress.py
+++ /dev/null
@@ -1,57 +0,0 @@
-from django.test import TestCase
-from courseware import progress
-from mock import MagicMock
-
-
-class ProgessTests(TestCase):
- def setUp(self):
-
- self.d = dict({'duration_total': 0,
- 'duration_watched': 0,
- 'done': True,
- 'questions_correct': 4,
- 'questions_incorrect': 0,
- 'questions_total': 0})
-
- self.c = progress.completion()
- self.c2 = progress.completion()
- self.c2.dict = dict({'duration_total': 0,
- 'duration_watched': 0,
- 'done': True,
- 'questions_correct': 2,
- 'questions_incorrect': 1,
- 'questions_total': 0})
-
- self.cplusc2 = dict({'duration_total': 0,
- 'duration_watched': 0,
- 'done': True,
- 'questions_correct': 2,
- 'questions_incorrect': 1,
- 'questions_total': 0})
-
- self.oth = dict({'duration_total': 0,
- 'duration_watched': 0,
- 'done': True,
- 'questions_correct': 4,
- 'questions_incorrect': 0,
- 'questions_total': 7})
-
- self.x = MagicMock()
- self.x.dict = self.oth
-
- self.d_oth = {'duration_total': 0,
- 'duration_watched': 0,
- 'done': True,
- 'questions_correct': 4,
- 'questions_incorrect': 0,
- 'questions_total': 7}
-
- def test_getitem(self):
- self.assertEqual(self.c.__getitem__('duration_watched'), 0)
-
- def test_setitem(self):
- self.c.__setitem__('questions_correct', 4)
- self.assertEqual(str(self.c), str(self.d))
-
- def test_repr(self):
- self.assertEqual(self.c.__repr__(), str(progress.completion()))
diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py
index 54936d972b..d5b6c4c737 100644
--- a/lms/djangoapps/courseware/views.py
+++ b/lms/djangoapps/courseware/views.py
@@ -773,8 +773,8 @@ def course_about(request, course_id):
'invitation_only': invitation_only,
'active_reg_button': active_reg_button,
'is_shib_course': is_shib_course,
- # We do not want to display the internal courseware header, which is used when the course is found in the
- # context. This value is therefor explicitly set to render the appropriate header.
+ # We do not want to display the internal courseware header, which is used when the course is found in the
+ # context. This value is therefor explicitly set to render the appropriate header.
'disable_courseware_header': True,
'is_shopping_cart_enabled': _is_shopping_cart_enabled,
'cart_link': reverse('shoppingcart.views.show_cart'),
diff --git a/lms/djangoapps/instructor_task/subtasks.py b/lms/djangoapps/instructor_task/subtasks.py
index 6280213e76..32c0b06f2d 100644
--- a/lms/djangoapps/instructor_task/subtasks.py
+++ b/lms/djangoapps/instructor_task/subtasks.py
@@ -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)]
# 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_id, entry.id, total_num_subtasks, total_num_items) # pylint: disable=E1101
+ TASK_LOG.info(
+ "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)
# 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
)
# Now create the subtasks, and start them running.
- TASK_LOG.info("Task %s: creating %s subtasks to process %s items.",
- task_id, total_num_subtasks, total_num_items)
+ TASK_LOG.info(
+ "Task %s: creating %s subtasks to process %s items.",
+ task_id,
+ total_num_subtasks,
+ total_num_items,
+ )
num_subtasks = 0
for item_list in item_list_generator:
subtask_id = subtask_id_list[num_subtasks]
diff --git a/lms/djangoapps/lms_migration/management/commands/create_user.py b/lms/djangoapps/lms_migration/management/commands/create_user.py
index 10051b349c..327a597166 100644
--- a/lms/djangoapps/lms_migration/management/commands/create_user.py
+++ b/lms/djangoapps/lms_migration/management/commands/create_user.py
@@ -28,8 +28,11 @@ class MyCompleter(object): # Custom completer
def complete(self, text, state):
if state == 0: # on first trigger, build possible matches
if text: # cache matches (entries that start with entered text)
- self.matches = [s for s in self.options
- if s and s.startswith(text)]
+ self.matches = [
+ option
+ for option in self.options
+ if option and option.startswith(text)
+ ]
else: # no text entered, all matches possible
self.matches = self.options[:]
@@ -115,13 +118,14 @@ class Command(BaseCommand):
if make_eamap:
credentials = "/C=US/ST=Massachusetts/O=Massachusetts Institute of Technology/OU=Client CA v1/CN=%s/emailAddress=%s" % (name, email)
- eamap = ExternalAuthMap(external_id=email,
- external_email=email,
- external_domain=mit_domain,
- external_name=name,
- internal_password=password,
- external_credentials=json.dumps(credentials),
- )
+ eamap = ExternalAuthMap(
+ external_id=email,
+ external_email=email,
+ external_domain=mit_domain,
+ external_name=name,
+ internal_password=password,
+ external_credentials=json.dumps(credentials),
+ )
eamap.user = user
eamap.dtsignup = datetime.datetime.now(UTC)
eamap.save()
diff --git a/lms/djangoapps/open_ended_grading/open_ended_notifications.py b/lms/djangoapps/open_ended_grading/open_ended_notifications.py
index 11993e15be..01267d8b9c 100644
--- a/lms/djangoapps/open_ended_grading/open_ended_notifications.py
+++ b/lms/djangoapps/open_ended_grading/open_ended_notifications.py
@@ -158,11 +158,15 @@ def combined_notifications(course, user):
try:
#Get the notifications from the grading controller
- notifications = controller_qs.check_combined_notifications(course.id, student_id, user_is_staff,
- last_time_viewed)
+ notifications = controller_qs.check_combined_notifications(
+ course.id,
+ student_id,
+ user_is_staff,
+ last_time_viewed,
+ )
if notifications.get('success'):
if (notifications.get('staff_needs_to_grade') or
- notifications.get('student_needs_to_peer_grade')):
+ notifications.get('student_needs_to_peer_grade')):
pending_grading = True
except:
#Non catastrophic error, so no real action
@@ -194,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):
- key_name = u"{prefix}{type}_{course}_{student}".format(prefix=KEY_PREFIX, type=notification_type, course=course_id,
- student=student_id)
+ key_name = u"{prefix}{type}_{course}_{student}".format(
+ prefix=KEY_PREFIX,
+ type=notification_type,
+ course=course_id,
+ student=student_id,
+ )
return key_name
diff --git a/lms/djangoapps/open_ended_grading/staff_grading_service.py b/lms/djangoapps/open_ended_grading/staff_grading_service.py
index 81baf721c2..0aeed52da2 100644
--- a/lms/djangoapps/open_ended_grading/staff_grading_service.py
+++ b/lms/djangoapps/open_ended_grading/staff_grading_service.py
@@ -57,15 +57,25 @@ class MockStaffGradingService(object):
def get_problem_list(self, course_id, grader_id):
self.cnt += 1
- return {'success': True,
- 'problem_list': [
- json.dumps({'location': 'i4x://MITx/3.091x/problem/open_ended_demo1',
- 'problem_name': "Problem 1", 'num_graded': 3, 'num_pending': 5,
- 'min_for_ml': 10}),
- json.dumps({'location': 'i4x://MITx/3.091x/problem/open_ended_demo2',
- 'problem_name': "Problem 2", 'num_graded': 1, 'num_pending': 5,
- 'min_for_ml': 10})
- ]}
+ return {
+ 'success': True,
+ 'problem_list': [
+ json.dumps({
+ 'location': 'i4x://MITx/3.091x/problem/open_ended_demo1',
+ 'problem_name': "Problem 1",
+ 'num_graded': 3,
+ 'num_pending': 5,
+ 'min_for_ml': 10,
+ }),
+ json.dumps({
+ 'location': 'i4x://MITx/3.091x/problem/open_ended_demo2',
+ 'problem_name': "Problem 2",
+ 'num_graded': 1,
+ 'num_pending': 5,
+ 'min_for_ml': 10,
+ }),
+ ],
+ }
def save_grade(self, course_id, grader_id, submission_id, score, feedback, skipped, rubric_scores,
submission_flagged):
diff --git a/pavelib/paver_tests/test_paver_bok_choy_cmds.py b/pavelib/paver_tests/test_paver_bok_choy_cmds.py
index fbddd16ae4..4685930c7c 100644
--- a/pavelib/paver_tests/test_paver_bok_choy_cmds.py
+++ b/pavelib/paver_tests/test_paver_bok_choy_cmds.py
@@ -14,14 +14,18 @@ class TestPaverBokChoy(unittest.TestCase):
def _expected_command(self, expected_text_append):
if expected_text_append:
expected_text_append = "/" + expected_text_append
- expected_statement = ("DEFAULT_STORE=None SCREENSHOT_DIR='{repo_dir}/test_root/log' "
- "BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log/hars' "
- "SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
- "nosetests {repo_dir}/common/test/acceptance/tests{exp_text} "
- "--with-xunit "
- "--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
- "--verbosity=2 ".format(repo_dir=REPO_DIR,
- exp_text=expected_text_append))
+ expected_statement = (
+ "DEFAULT_STORE=None SCREENSHOT_DIR='{repo_dir}/test_root/log' "
+ "BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log/hars' "
+ "SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
+ "nosetests {repo_dir}/common/test/acceptance/tests{exp_text} "
+ "--with-xunit "
+ "--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
+ "--verbosity=2 ".format(
+ repo_dir=REPO_DIR,
+ exp_text=expected_text_append,
+ )
+ )
return expected_statement
def test_default_bokchoy(self):
diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh
index 52cab28a02..421aac36be 100755
--- a/scripts/all-tests.sh
+++ b/scripts/all-tests.sh
@@ -56,8 +56,8 @@ set -e
###############################################################################
# Violations thresholds for failing the build
-PYLINT_THRESHOLD=4725
-PEP8_THRESHOLD=150
+PYLINT_THRESHOLD=4600
+PEP8_THRESHOLD=15
source $HOME/jenkins_env