Commit 0bf0d11a by Sarina Canelake

Merge pull request #5906 from stvstnfrd/pep8/newline

Fix newline-related PEP8 issues
parents 6774d1c0 fe1c7d62
...@@ -333,7 +333,6 @@ def get_codemirror_value(index=0, find_prefix="$"): ...@@ -333,7 +333,6 @@ def get_codemirror_value(index=0, find_prefix="$"):
) )
def attach_file(filename, sub_path): def attach_file(filename, sub_path):
path = os.path.join(TEST_ROOT, sub_path, filename) path = os.path.join(TEST_ROOT, sub_path, filename)
world.browser.execute_script("$('input.file-input').css('display', 'block')") world.browser.execute_script("$('input.file-input').css('display', 'block')")
...@@ -388,4 +387,3 @@ def create_other_user(_step, name, has_extra_perms, role_name): ...@@ -388,4 +387,3 @@ def create_other_user(_step, name, has_extra_perms, role_name):
@step('I log out') @step('I log out')
def log_out(_step): def log_out(_step):
world.visit('logout') world.visit('logout')
...@@ -9,6 +9,7 @@ from opaque_keys import InvalidKeyError ...@@ -9,6 +9,7 @@ from opaque_keys import InvalidKeyError
from opaque_keys.edx.locations import SlashSeparatedCourseKey from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
class Command(BaseCommand): class Command(BaseCommand):
help = '''Delete a MongoDB backed course''' help = '''Delete a MongoDB backed course'''
......
...@@ -11,6 +11,8 @@ from django.db.utils import IntegrityError ...@@ -11,6 +11,8 @@ from django.db.utils import IntegrityError
from student.roles import CourseInstructorRole, CourseStaffRole from student.roles import CourseInstructorRole, CourseStaffRole
#------------ to run: ./manage.py cms populate_creators --settings=dev #------------ to run: ./manage.py cms populate_creators --settings=dev
class Command(BaseCommand): class Command(BaseCommand):
""" """
Script for granting existing course instructors course creator privileges. Script for granting existing course instructors course creator privileges.
......
...@@ -10,4 +10,3 @@ class Command(BaseCommand): ...@@ -10,4 +10,3 @@ class Command(BaseCommand):
raise CommandError("restore_asset_from_trashcan requires one argument: <location>") raise CommandError("restore_asset_from_trashcan requires one argument: <location>")
restore_asset_from_trashcan(args[0]) restore_asset_from_trashcan(args[0])
...@@ -161,7 +161,6 @@ class TestDownloadYoutubeSubs(ModuleStoreTestCase): ...@@ -161,7 +161,6 @@ class TestDownloadYoutubeSubs(ModuleStoreTestCase):
number = '999' number = '999'
display_name = 'Test course' display_name = 'Test course'
def clear_sub_content(self, subs_id): def clear_sub_content(self, subs_id):
""" """
Remove, if subtitle content exists. Remove, if subtitle content exists.
...@@ -472,6 +471,7 @@ class TestYoutubeTranscripts(unittest.TestCase): ...@@ -472,6 +471,7 @@ class TestYoutubeTranscripts(unittest.TestCase):
self.assertEqual(transcripts, expected_transcripts) self.assertEqual(transcripts, expected_transcripts)
mock_get.assert_called_with('http://video.google.com/timedtext', params={'lang': 'en', 'v': 'good_youtube_id'}) mock_get.assert_called_with('http://video.google.com/timedtext', params={'lang': 'en', 'v': 'good_youtube_id'})
class TestTranscript(unittest.TestCase): class TestTranscript(unittest.TestCase):
""" """
Tests for Transcript class e.g. different transcript conversions. Tests for Transcript class e.g. different transcript conversions.
...@@ -489,7 +489,6 @@ class TestTranscript(unittest.TestCase): ...@@ -489,7 +489,6 @@ class TestTranscript(unittest.TestCase):
""") """)
self.sjson_transcript = textwrap.dedent("""\ self.sjson_transcript = textwrap.dedent("""\
{ {
"start": [ "start": [
......
...@@ -86,6 +86,7 @@ class LMSLinksTestCase(TestCase): ...@@ -86,6 +86,7 @@ class LMSLinksTestCase(TestCase):
link = utils.get_lms_link_for_item(location) link = utils.get_lms_link_for_item(location)
self.assertEquals(link, "//localhost:8000/courses/mitX/101/test/jump_to/i4x://mitX/101/course/test") self.assertEquals(link, "//localhost:8000/courses/mitX/101/test/jump_to/i4x://mitX/101/course/test")
class ExtraPanelTabTestCase(TestCase): class ExtraPanelTabTestCase(TestCase):
""" Tests adding and removing extra course tabs. """ """ Tests adding and removing extra course tabs. """
......
...@@ -124,6 +124,7 @@ def expand_checklist_action_url(course_module, checklist): ...@@ -124,6 +124,7 @@ def expand_checklist_action_url(course_module, checklist):
return expanded_checklist return expanded_checklist
def localize_checklist_text(checklist): def localize_checklist_text(checklist):
""" """
Localize texts for a given checklist and returns the modified version. Localize texts for a given checklist and returns the modified version.
......
...@@ -261,6 +261,7 @@ def course_rerun_handler(request, course_key_string): ...@@ -261,6 +261,7 @@ def course_rerun_handler(request, course_key_string):
'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False) 'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False)
}) })
def _course_outline_json(request, course_module): def _course_outline_json(request, course_module):
""" """
Returns a JSON representation of the course module and recursively all of its children. Returns a JSON representation of the course module and recursively all of its children.
......
...@@ -20,6 +20,7 @@ from ..utils import get_lms_link_for_item ...@@ -20,6 +20,7 @@ from ..utils import get_lms_link_for_item
__all__ = ['tabs_handler'] __all__ = ['tabs_handler']
@expect_json @expect_json
@login_required @login_required
@ensure_csrf_cookie @ensure_csrf_cookie
...@@ -203,4 +204,3 @@ def primitive_insert(course, num, tab_type, name): ...@@ -203,4 +204,3 @@ def primitive_insert(course, num, tab_type, name):
tabs = course.tabs tabs = course.tabs
tabs.insert(num, new_tab) tabs.insert(num, new_tab)
modulestore().update_item(course, ModuleStoreEnum.UserID.primitive_command) modulestore().update_item(course, ModuleStoreEnum.UserID.primitive_command)
...@@ -100,7 +100,6 @@ def _course_team_user(request, course_key, email): ...@@ -100,7 +100,6 @@ def _course_team_user(request, course_key, email):
} }
return JsonResponse(msg, 400) return JsonResponse(msg, 400)
try: try:
user = User.objects.get(email=email) user = User.objects.get(email=email)
except Exception: except Exception:
......
...@@ -11,6 +11,7 @@ from models.settings import course_grading ...@@ -11,6 +11,7 @@ from models.settings import course_grading
from xmodule.fields import Date from xmodule.fields import Date
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
class CourseDetails(object): class CourseDetails(object):
def __init__(self, org, course_id, run): def __init__(self, org, course_id, run):
# still need these for now b/c the client's screen shows these 3 fields # still need these for now b/c the client's screen shows these 3 fields
......
...@@ -17,4 +17,3 @@ startup.run() ...@@ -17,4 +17,3 @@ startup.run()
# as well as any WSGI server configured to use this file. # as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
application = get_wsgi_application() application = get_wsgi_application()
...@@ -22,6 +22,7 @@ from xmodule.exceptions import NotFoundError ...@@ -22,6 +22,7 @@ from xmodule.exceptions import NotFoundError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class StaticContentServer(object): class StaticContentServer(object):
def process_request(self, request): def process_request(self, request):
# look to see if the request is prefixed with an asset prefix tag # look to see if the request is prefixed with an asset prefix tag
......
...@@ -322,6 +322,7 @@ def add_cohort(course_key, name): ...@@ -322,6 +322,7 @@ def add_cohort(course_key, name):
) )
return cohort return cohort
def add_user_to_cohort(cohort, username_or_email): def add_user_to_cohort(cohort, username_or_email):
""" """
Look up the given user, and if successful, add them to the specified cohort. Look up the given user, and if successful, add them to the specified cohort.
......
...@@ -209,6 +209,7 @@ class ListCohortsTestCase(CohortViewsTestCase): ...@@ -209,6 +209,7 @@ class ListCohortsTestCase(CohortViewsTestCase):
actual_cohorts, actual_cohorts,
) )
class AddCohortTestCase(CohortViewsTestCase): class AddCohortTestCase(CohortViewsTestCase):
""" """
Tests the `add_cohort` view. Tests the `add_cohort` view.
......
...@@ -150,7 +150,6 @@ class CourseModeViewTest(ModuleStoreTestCase): ...@@ -150,7 +150,6 @@ class CourseModeViewTest(ModuleStoreTestCase):
response = self.client.get(choose_track_url) response = self.client.get(choose_track_url)
self.assertRedirects(response, reverse('dashboard')) self.assertRedirects(response, reverse('dashboard'))
# Mapping of course modes to the POST parameters sent # Mapping of course modes to the POST parameters sent
# when the user chooses that mode. # when the user chooses that mode.
POST_PARAMS_FOR_COURSE_MODE = { POST_PARAMS_FOR_COURSE_MODE = {
......
...@@ -144,7 +144,6 @@ class DarkLangMiddlewareTests(TestCase): ...@@ -144,7 +144,6 @@ class DarkLangMiddlewareTests(TestCase):
self.process_request(accept='rel-ter;q=1.0, rel;q=0.5') self.process_request(accept='rel-ter;q=1.0, rel;q=0.5')
) )
def assertSessionLangEquals(self, value, request): def assertSessionLangEquals(self, value, request):
""" """
Assert that the 'django_language' set in request.session is equal to value Assert that the 'django_language' set in request.session is equal to value
......
...@@ -4,6 +4,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey ...@@ -4,6 +4,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from django_comment_common.models import Role from django_comment_common.models import Role
from student.models import CourseEnrollment, User from student.models import CourseEnrollment, User
class RoleAssignmentTest(TestCase): class RoleAssignmentTest(TestCase):
""" """
Basic checks to make sure our Roles get assigned and unassigned as students Basic checks to make sure our Roles get assigned and unassigned as students
......
...@@ -34,7 +34,6 @@ class MakoLoader(object): ...@@ -34,7 +34,6 @@ class MakoLoader(object):
self.module_directory = module_directory self.module_directory = module_directory
def __call__(self, template_name, template_dirs=None): def __call__(self, template_name, template_dirs=None):
return self.load_template(template_name, template_dirs) return self.load_template(template_name, template_dirs)
......
...@@ -32,6 +32,7 @@ def clear_lookups(namespace): ...@@ -32,6 +32,7 @@ def clear_lookups(namespace):
if namespace in LOOKUP: if namespace in LOOKUP:
del LOOKUP[namespace] del LOOKUP[namespace]
def add_lookup(namespace, directory, package=None, prepend=False): def add_lookup(namespace, directory, package=None, prepend=False):
""" """
Adds a new mako template lookup directory to the given namespace. Adds a new mako template lookup directory to the given namespace.
......
...@@ -76,6 +76,7 @@ def marketing_link_context_processor(request): ...@@ -76,6 +76,7 @@ def marketing_link_context_processor(request):
] ]
) )
def open_source_footer_context_processor(request): def open_source_footer_context_processor(request):
""" """
Checks the site name to determine whether to use the edX.org footer or the Open Source Footer. Checks the site name to determine whether to use the edX.org footer or the Open Source Footer.
...@@ -97,6 +98,7 @@ def microsite_footer_context_processor(request): ...@@ -97,6 +98,7 @@ def microsite_footer_context_processor(request):
] ]
) )
def render_to_string(template_name, dictionary, context=None, namespace='main'): def render_to_string(template_name, dictionary, context=None, namespace='main'):
# see if there is an override template defined in the microsite # see if there is an override template defined in the microsite
......
...@@ -19,6 +19,7 @@ from edxmako.shortcuts import ( ...@@ -19,6 +19,7 @@ from edxmako.shortcuts import (
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from util.testing import UrlResetMixin from util.testing import UrlResetMixin
@ddt.ddt @ddt.ddt
class ShortcutsTests(UrlResetMixin, TestCase): class ShortcutsTests(UrlResetMixin, TestCase):
""" """
......
...@@ -28,6 +28,7 @@ from embargo.models import EmbargoedCourse, EmbargoedState, IPFilter ...@@ -28,6 +28,7 @@ from embargo.models import EmbargoedCourse, EmbargoedState, IPFilter
# that disables the XML modulestore. # that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False) MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt @ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG) @override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
......
...@@ -37,6 +37,7 @@ FEATURES_WITHOUT_SSL_AUTH['AUTH_USE_CERTIFICATES'] = False ...@@ -37,6 +37,7 @@ FEATURES_WITHOUT_SSL_AUTH['AUTH_USE_CERTIFICATES'] = False
TEST_DATA_MIXED_MODULESTORE = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}) TEST_DATA_MIXED_MODULESTORE = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {})
@override_settings(FEATURES=FEATURES_WITH_SSL_AUTH) @override_settings(FEATURES=FEATURES_WITH_SSL_AUTH)
class SSLClientTest(ModuleStoreTestCase): class SSLClientTest(ModuleStoreTestCase):
""" """
......
...@@ -8,6 +8,7 @@ from django.db.utils import DatabaseError ...@@ -8,6 +8,7 @@ from django.db.utils import DatabaseError
import mock import mock
from django.test.testcases import TestCase from django.test.testcases import TestCase
class HeartbeatTestCase(TestCase): class HeartbeatTestCase(TestCase):
""" """
Test the heartbeat Test the heartbeat
......
...@@ -23,6 +23,7 @@ def page_title_breadcrumbs(*crumbs, **kwargs): ...@@ -23,6 +23,7 @@ def page_title_breadcrumbs(*crumbs, **kwargs):
else: else:
return platform_name() return platform_name()
@register.simple_tag(name="page_title_breadcrumbs", takes_context=True) @register.simple_tag(name="page_title_breadcrumbs", takes_context=True)
def page_title_breadcrumbs_tag(context, *crumbs): def page_title_breadcrumbs_tag(context, *crumbs):
""" """
......
...@@ -78,6 +78,7 @@ def post_save_metrics(sender, **kwargs): ...@@ -78,6 +78,7 @@ def post_save_metrics(sender, **kwargs):
tags = _database_tags(action, sender, kwargs) tags = _database_tags(action, sender, kwargs)
dog_stats_api.increment('edxapp.db.model', tags=tags) dog_stats_api.increment('edxapp.db.model', tags=tags)
@receiver(post_delete, dispatch_uid='edxapp.monitoring.post_delete_metrics') @receiver(post_delete, dispatch_uid='edxapp.monitoring.post_delete_metrics')
def post_delete_metrics(sender, **kwargs): def post_delete_metrics(sender, **kwargs):
""" """
......
# Register signal handlers # Register signal handlers
import signals import signals
import exceptions import exceptions
\ No newline at end of file
...@@ -3,11 +3,12 @@ import threading ...@@ -3,11 +3,12 @@ import threading
_request_cache_threadlocal = threading.local() _request_cache_threadlocal = threading.local()
_request_cache_threadlocal.data = {} _request_cache_threadlocal.data = {}
class RequestCache(object): class RequestCache(object):
@classmethod @classmethod
def get_request_cache(cls): def get_request_cache(cls):
return _request_cache_threadlocal return _request_cache_threadlocal
def clear_request_cache(self): def clear_request_cache(self):
_request_cache_threadlocal.data = {} _request_cache_threadlocal.data = {}
...@@ -17,4 +18,4 @@ class RequestCache(object): ...@@ -17,4 +18,4 @@ class RequestCache(object):
def process_response(self, request, response): def process_response(self, request, response):
self.clear_request_cache() self.clear_request_cache()
return response return response
\ No newline at end of file
...@@ -36,7 +36,6 @@ class TestStatus(TestCase): ...@@ -36,7 +36,6 @@ class TestStatus(TestCase):
"edX/toy/2012_Fall" : "A toy story" "edX/toy/2012_Fall" : "A toy story"
}""" }"""
# json to use, expected results for course=None (e.g. homepage), # json to use, expected results for course=None (e.g. homepage),
# for toy course, for full course. Note that get_site_status_msg # for toy course, for full course. Note that get_site_status_msg
# is supposed to return global message even if course=None. The # is supposed to return global message even if course=None. The
......
...@@ -83,4 +83,3 @@ def _check_caller_authority(caller, role): ...@@ -83,4 +83,3 @@ def _check_caller_authority(caller, role):
elif isinstance(role, CourseRole): # instructors can change the roles w/in their course elif isinstance(role, CourseRole): # instructors can change the roles w/in their course
if not has_access(caller, CourseInstructorRole(role.course_key)): if not has_access(caller, CourseInstructorRole(role.course_key)):
raise PermissionDenied raise PermissionDenied
...@@ -22,4 +22,4 @@ class PasswordResetFormNoActive(PasswordResetForm): ...@@ -22,4 +22,4 @@ class PasswordResetFormNoActive(PasswordResetForm):
if any((user.password == UNUSABLE_PASSWORD) if any((user.password == UNUSABLE_PASSWORD)
for user in self.users_cache): for user in self.users_cache):
raise forms.ValidationError(self.error_messages['unusable']) raise forms.ValidationError(self.error_messages['unusable'])
return email return email
\ No newline at end of file
...@@ -65,4 +65,3 @@ class Command(BaseCommand): ...@@ -65,4 +65,3 @@ class Command(BaseCommand):
)) ))
except IOError: except IOError:
raise CommandError("Error writing to file: %s" % output_filename) raise CommandError("Error writing to file: %s" % output_filename)
...@@ -7,6 +7,7 @@ from django.utils.translation import ugettext as _ ...@@ -7,6 +7,7 @@ from django.utils.translation import ugettext as _
from django.conf import settings from django.conf import settings
from student.models import UserStanding from student.models import UserStanding
class UserStandingMiddleware(object): class UserStandingMiddleware(object):
""" """
Checks a user's standing on request. Returns a 403 if the user's Checks a user's standing on request. Returns a 403 if the user's
......
...@@ -18,12 +18,10 @@ class Migration(SchemaMigration): ...@@ -18,12 +18,10 @@ class Migration(SchemaMigration):
)) ))
db.send_create_signal('student', ['DashboardConfiguration']) db.send_create_signal('student', ['DashboardConfiguration'])
def backwards(self, orm): def backwards(self, orm):
# Deleting model 'DashboardConfiguration' # Deleting model 'DashboardConfiguration'
db.delete_table('student_dashboardconfiguration') db.delete_table('student_dashboardconfiguration')
models = { models = {
'auth.group': { 'auth.group': {
'Meta': {'object_name': 'Group'}, 'Meta': {'object_name': 'Group'},
...@@ -176,4 +174,4 @@ class Migration(SchemaMigration): ...@@ -176,4 +174,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['student'] complete_apps = ['student']
\ No newline at end of file
...@@ -665,15 +665,19 @@ class LoginFailures(models.Model): ...@@ -665,15 +665,19 @@ class LoginFailures(models.Model):
class CourseEnrollmentException(Exception): class CourseEnrollmentException(Exception):
pass pass
class NonExistentCourseError(CourseEnrollmentException): class NonExistentCourseError(CourseEnrollmentException):
pass pass
class EnrollmentClosedError(CourseEnrollmentException): class EnrollmentClosedError(CourseEnrollmentException):
pass pass
class CourseFullError(CourseEnrollmentException): class CourseFullError(CourseEnrollmentException):
pass pass
class AlreadyEnrolledError(CourseEnrollmentException): class AlreadyEnrolledError(CourseEnrollmentException):
pass pass
......
...@@ -210,6 +210,7 @@ class CourseFinanceAdminRole(CourseRole): ...@@ -210,6 +210,7 @@ class CourseFinanceAdminRole(CourseRole):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(CourseFinanceAdminRole, self).__init__(self.ROLE, *args, **kwargs) super(CourseFinanceAdminRole, self).__init__(self.ROLE, *args, **kwargs)
class CourseBetaTesterRole(CourseRole): class CourseBetaTesterRole(CourseRole):
"""A course Beta Tester""" """A course Beta Tester"""
ROLE = 'beta_testers' ROLE = 'beta_testers'
......
...@@ -11,6 +11,7 @@ from opaque_keys.edx.locator import CourseLocator ...@@ -11,6 +11,7 @@ from opaque_keys.edx.locator import CourseLocator
from mock import patch from mock import patch
import ddt import ddt
@ddt.ddt @ddt.ddt
class AutoAuthEnabledTestCase(UrlResetMixin, TestCase): class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
""" """
......
...@@ -25,6 +25,7 @@ FAKE_MICROSITE = { ...@@ -25,6 +25,7 @@ FAKE_MICROSITE = {
] ]
} }
def fake_site_name(name, default=None): # pylint: disable=W0613 def fake_site_name(name, default=None): # pylint: disable=W0613
""" """
create a fake microsite site name create a fake microsite site name
...@@ -34,12 +35,14 @@ def fake_site_name(name, default=None): # pylint: disable=W0613 ...@@ -34,12 +35,14 @@ def fake_site_name(name, default=None): # pylint: disable=W0613
else: else:
return default return default
def fake_microsite_get_value(name, default=None): # pylint: disable=W0613 def fake_microsite_get_value(name, default=None): # pylint: disable=W0613
""" """
create a fake microsite site name create a fake microsite site name
""" """
return FAKE_MICROSITE.get(name, default) return FAKE_MICROSITE.get(name, default)
class TestMicrosite(TestCase): class TestMicrosite(TestCase):
"""Test for Account Creation from a white labeled Micro-Sites""" """Test for Account Creation from a white labeled Micro-Sites"""
def setUp(self): def setUp(self):
......
...@@ -15,6 +15,7 @@ from edxmako.tests import mako_middleware_process_request ...@@ -15,6 +15,7 @@ from edxmako.tests import mako_middleware_process_request
from external_auth.models import ExternalAuthMap from external_auth.models import ExternalAuthMap
from student.views import create_account from student.views import create_account
@patch.dict("django.conf.settings.FEATURES", {'ENFORCE_PASSWORD_POLICY': True}) @patch.dict("django.conf.settings.FEATURES", {'ENFORCE_PASSWORD_POLICY': True})
class TestPasswordPolicy(TestCase): class TestPasswordPolicy(TestCase):
""" """
......
...@@ -6,6 +6,7 @@ import re ...@@ -6,6 +6,7 @@ import re
import urlparse import urlparse
from .http import StubHttpRequestHandler, StubHttpService from .http import StubHttpRequestHandler, StubHttpService
class StubCommentsServiceHandler(StubHttpRequestHandler): class StubCommentsServiceHandler(StubHttpRequestHandler):
@property @property
......
...@@ -21,6 +21,7 @@ import mock ...@@ -21,6 +21,7 @@ import mock
import requests import requests
from http import StubHttpRequestHandler, StubHttpService from http import StubHttpRequestHandler, StubHttpService
class StubLtiHandler(StubHttpRequestHandler): class StubLtiHandler(StubHttpRequestHandler):
""" """
A handler for LTI POST and GET requests. A handler for LTI POST and GET requests.
......
...@@ -300,7 +300,6 @@ class StubOraHandler(StubHttpRequestHandler): ...@@ -300,7 +300,6 @@ class StubOraHandler(StubHttpRequestHandler):
""" """
self._success_response({'problem_list': self.server.problem_list}) self._success_response({'problem_list': self.server.problem_list})
@require_params('POST', 'grader_id', 'location', 'submission_id', 'score', 'feedback', 'submission_key') @require_params('POST', 'grader_id', 'location', 'submission_id', 'score', 'feedback', 'submission_key')
def _save_grade(self): def _save_grade(self):
""" """
...@@ -421,7 +420,6 @@ class StubOraHandler(StubHttpRequestHandler): ...@@ -421,7 +420,6 @@ class StubOraHandler(StubHttpRequestHandler):
) )
self.send_response(400) self.send_response(400)
def _student(self, method, key='student_id'): def _student(self, method, key='student_id'):
""" """
Return the `StudentState` instance for the student ID given Return the `StudentState` instance for the student ID given
......
...@@ -7,6 +7,7 @@ import urllib2 ...@@ -7,6 +7,7 @@ import urllib2
import requests import requests
from terrain.stubs.lti import StubLtiService from terrain.stubs.lti import StubLtiService
class StubLtiServiceTest(unittest.TestCase): class StubLtiServiceTest(unittest.TestCase):
""" """
A stub of the LTI provider that listens on a local A stub of the LTI provider that listens on a local
......
...@@ -9,6 +9,7 @@ import os ...@@ -9,6 +9,7 @@ import os
from logging import getLogger from logging import getLogger
LOGGER = getLogger(__name__) LOGGER = getLogger(__name__)
class VideoSourceRequestHandler(SimpleHTTPRequestHandler): class VideoSourceRequestHandler(SimpleHTTPRequestHandler):
""" """
Request handler for serving video sources locally. Request handler for serving video sources locally.
......
...@@ -5,6 +5,7 @@ from student.tests.factories import UserFactory ...@@ -5,6 +5,7 @@ from student.tests.factories import UserFactory
from user_api.models import UserPreference, UserCourseTag from user_api.models import UserPreference, UserCourseTag
from opaque_keys.edx.locations import SlashSeparatedCourseKey from opaque_keys.edx.locations import SlashSeparatedCourseKey
# Factories don't have __init__ methods, and are self documenting # Factories don't have __init__ methods, and are self documenting
# pylint: disable=W0232, C0111 # pylint: disable=W0232, C0111
class UserPreferenceFactory(DjangoModelFactory): class UserPreferenceFactory(DjangoModelFactory):
......
...@@ -298,7 +298,7 @@ class AccountApiTest(TestCase): ...@@ -298,7 +298,7 @@ class AccountApiTest(TestCase):
if create_inactive_account: if create_inactive_account:
# Create an account, but do not activate it # Create an account, but do not activate it
account_api.create_account(self.USERNAME, self.PASSWORD, self.EMAIL) account_api.create_account(self.USERNAME, self.PASSWORD, self.EMAIL)
account_api.request_password_change(self.EMAIL, self.ORIG_HOST, self.IS_SECURE) account_api.request_password_change(self.EMAIL, self.ORIG_HOST, self.IS_SECURE)
# Verify that no email messages have been sent # Verify that no email messages have been sent
......
...@@ -4,6 +4,7 @@ which can be used for rate limiting ...@@ -4,6 +4,7 @@ which can be used for rate limiting
""" """
from ratelimitbackend.backends import RateLimitMixin from ratelimitbackend.backends import RateLimitMixin
class BadRequestRateLimiter(RateLimitMixin): class BadRequestRateLimiter(RateLimitMixin):
""" """
Use the 3rd party RateLimitMixin to help do rate limiting on the Password Reset flows Use the 3rd party RateLimitMixin to help do rate limiting on the Password Reset flows
......
# Create your models here. # Create your models here.
...@@ -6,4 +6,4 @@ def use_read_replica_if_available(queryset): ...@@ -6,4 +6,4 @@ def use_read_replica_if_available(queryset):
""" """
If there is a database called 'read_replica', use that database for the queryset. If there is a database called 'read_replica', use that database for the queryset.
""" """
return queryset.using("read_replica") if "read_replica" in settings.DATABASES else queryset return queryset.using("read_replica") if "read_replica" in settings.DATABASES else queryset
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Utilities for string manipulation. Utilities for string manipulation.
""" """
def str_to_bool(str): def str_to_bool(str):
""" """
Converts "true" (case-insensitive) to the boolean True. Converts "true" (case-insensitive) to the boolean True.
......
...@@ -5,6 +5,7 @@ Tests for string_utils.py ...@@ -5,6 +5,7 @@ Tests for string_utils.py
from django.test import TestCase from django.test import TestCase
from util.string_utils import str_to_bool from util.string_utils import str_to_bool
class StringUtilsTest(TestCase): class StringUtilsTest(TestCase):
""" """
Tests for str_to_bool. Tests for str_to_bool.
......
...@@ -14,6 +14,7 @@ from pyparsing import ParseException ...@@ -14,6 +14,7 @@ from pyparsing import ParseException
# See http://docs.scipy.org/doc/numpy/reference/generated/numpy.seterr.html # See http://docs.scipy.org/doc/numpy/reference/generated/numpy.seterr.html
numpy.seterr(all='ignore') # Also: 'ignore', 'warn' (default), 'raise' numpy.seterr(all='ignore') # Also: 'ignore', 'warn' (default), 'raise'
class EvaluatorTest(unittest.TestCase): class EvaluatorTest(unittest.TestCase):
""" """
Run tests for calc.evaluator Run tests for calc.evaluator
......
...@@ -165,7 +165,6 @@ class CorrectMap(object): ...@@ -165,7 +165,6 @@ class CorrectMap(object):
self.cmap.update(other_cmap.get_dict()) self.cmap.update(other_cmap.get_dict())
self.set_overall_message(other_cmap.get_overall_message()) self.set_overall_message(other_cmap.get_overall_message())
def set_overall_message(self, message_str): def set_overall_message(self, message_str):
""" Set a message that applies to the question as a whole, """ Set a message that applies to the question as a whole,
rather than to individual inputs. """ rather than to individual inputs. """
......
...@@ -50,7 +50,6 @@ class MathRenderer(object): ...@@ -50,7 +50,6 @@ class MathRenderer(object):
mathstr = mathstr.replace(r'\displaystyle', '') mathstr = mathstr.replace(r'\displaystyle', '')
self.mathstr = mathstr.replace('mathjaxinline]', '%s]' % mtag) self.mathstr = mathstr.replace('mathjaxinline]', '%s]' % mtag)
def get_html(self): def get_html(self):
""" """
Return the contents of this tag, rendered to html, as an etree element. Return the contents of this tag, rendered to html, as an etree element.
......
...@@ -839,7 +839,6 @@ class MatlabInput(CodeInput): ...@@ -839,7 +839,6 @@ class MatlabInput(CodeInput):
'No response from Xqueue within {xqueue_timeout} seconds. Aborted.' 'No response from Xqueue within {xqueue_timeout} seconds. Aborted.'
).format(xqueue_timeout=XQUEUE_TIMEOUT) ).format(xqueue_timeout=XQUEUE_TIMEOUT)
def handle_ajax(self, dispatch, data): def handle_ajax(self, dispatch, data):
""" """
Handle AJAX calls directed to this input Handle AJAX calls directed to this input
......
"""A registry for finding classes based on tags in the class.""" """A registry for finding classes based on tags in the class."""
class TagRegistry(object): class TagRegistry(object):
""" """
A registry mapping tags to handlers. A registry mapping tags to handlers.
......
...@@ -7,6 +7,7 @@ in the public domain. ...@@ -7,6 +7,7 @@ in the public domain.
import sys import sys
class LazyModule(object): class LazyModule(object):
"""A lazy module proxy.""" """A lazy module proxy."""
......
...@@ -11,6 +11,7 @@ from mako.template import Template as MakoTemplate ...@@ -11,6 +11,7 @@ from mako.template import Template as MakoTemplate
from mako import exceptions from mako import exceptions
from capa.inputtypes import Status from capa.inputtypes import Status
class TemplateError(Exception): class TemplateError(Exception):
""" """
Error occurred while rendering a Mako template. Error occurred while rendering a Mako template.
...@@ -497,6 +498,7 @@ class FormulaEquationInputTemplateTest(TemplateTestCase): ...@@ -497,6 +498,7 @@ class FormulaEquationInputTemplateTest(TemplateTestCase):
self.assert_has_xpath(xml, "//input[@size='40']", self.context) self.assert_has_xpath(xml, "//input[@size='40']", self.context)
class AnnotationInputTemplateTest(TemplateTestCase): class AnnotationInputTemplateTest(TemplateTestCase):
""" """
Test mako template for `<annotationinput>` input. Test mako template for `<annotationinput>` input.
......
...@@ -604,7 +604,6 @@ class MatlabTest(unittest.TestCase): ...@@ -604,7 +604,6 @@ class MatlabTest(unittest.TestCase):
the_input = self.input_class(test_capa_system(), elt, state) the_input = self.input_class(test_capa_system(), elt, state)
self.assertEqual(the_input.status, 'queued') self.assertEqual(the_input.status, 'queued')
@patch('capa.inputtypes.time.time', return_value=45) @patch('capa.inputtypes.time.time', return_value=45)
def test_matlab_response_timeout_exceeded(self, time): def test_matlab_response_timeout_exceeded(self, time):
......
...@@ -606,7 +606,6 @@ class StringResponseTest(ResponseTest): ...@@ -606,7 +606,6 @@ class StringResponseTest(ResponseTest):
self.assert_grade(problem, u"î", "incorrect") self.assert_grade(problem, u"î", "incorrect")
self.assert_grade(problem, u"o", "incorrect") self.assert_grade(problem, u"o", "incorrect")
def test_backslash_and_unicode_regexps(self): def test_backslash_and_unicode_regexps(self):
""" """
Test some special cases of [unicode] regexps. Test some special cases of [unicode] regexps.
...@@ -1042,8 +1041,6 @@ class CodeResponseTest(ResponseTest): ...@@ -1042,8 +1041,6 @@ class CodeResponseTest(ResponseTest):
self.assertEquals(output[answer_id]['msg'], u'Invalid grader reply. Please contact the course staff.') self.assertEquals(output[answer_id]['msg'], u'Invalid grader reply. Please contact the course staff.')
class ChoiceResponseTest(ResponseTest): class ChoiceResponseTest(ResponseTest):
from capa.tests.response_xml_factory import ChoiceResponseXMLFactory from capa.tests.response_xml_factory import ChoiceResponseXMLFactory
xml_factory_class = ChoiceResponseXMLFactory xml_factory_class = ChoiceResponseXMLFactory
......
...@@ -82,7 +82,6 @@ class UtilTest(unittest.TestCase): ...@@ -82,7 +82,6 @@ class UtilTest(unittest.TestCase):
result = compare_with_tolerance(infinity, infinity, '1.0', False) result = compare_with_tolerance(infinity, infinity, '1.0', False)
self.assertTrue(result) self.assertTrue(result)
def test_sanitize_html(self): def test_sanitize_html(self):
""" """
Test for html sanitization with bleach. Test for html sanitization with bleach.
......
...@@ -192,7 +192,6 @@ def _render_to_html(tree): ...@@ -192,7 +192,6 @@ def _render_to_html(tree):
return children.replace(' ', '') return children.replace(' ', '')
def render_to_html(eq): def render_to_html(eq):
''' '''
Render a chemical equation string to html. Render a chemical equation string to html.
...@@ -231,7 +230,6 @@ def render_to_html(eq): ...@@ -231,7 +230,6 @@ def render_to_html(eq):
# only one side # only one side
return spanify(render_expression(left)) return spanify(render_expression(left))
return spanify(render_expression(left) + render_arrow(arrow) + render_expression(right)) return spanify(render_expression(left) + render_arrow(arrow) + render_expression(right))
......
...@@ -64,7 +64,6 @@ class Test_Compare_Equations(unittest.TestCase): ...@@ -64,7 +64,6 @@ class Test_Compare_Equations(unittest.TestCase):
self.assertFalse(chemical_equations_equal('H2O( -> H2O2', self.assertFalse(chemical_equations_equal('H2O( -> H2O2',
'H2O -> H2O2')) 'H2O -> H2O2'))
self.assertFalse(chemical_equations_equal('H2 + O2 ==> H2O2', # strange arrow self.assertFalse(chemical_equations_equal('H2 + O2 ==> H2O2', # strange arrow
'2O2 + 2H2 -> 2H2O2')) '2O2 + 2H2 -> 2H2O2'))
......
...@@ -5,6 +5,7 @@ Automatic execution of startup modules in Django apps. ...@@ -5,6 +5,7 @@ Automatic execution of startup modules in Django apps.
from importlib import import_module from importlib import import_module
from django.conf import settings from django.conf import settings
def autostartup(): def autostartup():
""" """
Execute app.startup:run() for all installed django apps Execute app.startup:run() for all installed django apps
......
...@@ -257,7 +257,6 @@ class formula(object): ...@@ -257,7 +257,6 @@ class formula(object):
fix_pmathml(xml) fix_pmathml(xml)
def fix_hat(xml): def fix_hat(xml):
""" """
hat i is turned into <mover><mi>i</mi><mo>^</mo></mover> ; mangle hat i is turned into <mover><mi>i</mi><mo>^</mo></mover> ; mangle
......
from unittest import TestCase from unittest import TestCase
from .symmath_check import symmath_check from .symmath_check import symmath_check
class SymmathCheckTest(TestCase): class SymmathCheckTest(TestCase):
def test_symmath_check_integers(self): def test_symmath_check_integers(self):
number_list = [i for i in range(-100, 100)] number_list = [i for i in range(-100, 100)]
......
...@@ -5,12 +5,14 @@ import os.path ...@@ -5,12 +5,14 @@ import os.path
import shutil import shutil
import tempfile import tempfile
def mkdtemp_clean(suffix="", prefix="tmp", dir=None): def mkdtemp_clean(suffix="", prefix="tmp", dir=None):
"""Just like mkdtemp, but the directory will be deleted when the process ends.""" """Just like mkdtemp, but the directory will be deleted when the process ends."""
the_dir = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir) the_dir = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir)
atexit.register(cleanup_tempdir, the_dir) atexit.register(cleanup_tempdir, the_dir)
return the_dir return the_dir
def cleanup_tempdir(the_dir): def cleanup_tempdir(the_dir):
"""Called on process exit to remove a temp directory.""" """Called on process exit to remove a temp directory."""
if os.path.exists(the_dir): if os.path.exists(the_dir):
......
...@@ -7,6 +7,7 @@ from urlparse import urlparse ...@@ -7,6 +7,7 @@ from urlparse import urlparse
from os.path import splitext, basename from os.path import splitext, basename
from HTMLParser import HTMLParser from HTMLParser import HTMLParser
def get_instructions(xmltree): def get_instructions(xmltree):
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """ """ Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
instructions = xmltree.find('instructions') instructions = xmltree.find('instructions')
......
...@@ -28,6 +28,7 @@ CATALOG_VISIBILITY_CATALOG_AND_ABOUT = "both" ...@@ -28,6 +28,7 @@ CATALOG_VISIBILITY_CATALOG_AND_ABOUT = "both"
CATALOG_VISIBILITY_ABOUT = "about" CATALOG_VISIBILITY_ABOUT = "about"
CATALOG_VISIBILITY_NONE = "none" CATALOG_VISIBILITY_NONE = "none"
class StringOrDate(Date): class StringOrDate(Date):
def from_json(self, value): def from_json(self, value):
""" """
...@@ -589,6 +590,7 @@ class CourseFields(object): ...@@ -589,6 +590,7 @@ class CourseFields(object):
{"display_name": _("None"), "value": CATALOG_VISIBILITY_NONE}] {"display_name": _("None"), "value": CATALOG_VISIBILITY_NONE}]
) )
class CourseDescriptor(CourseFields, SequenceDescriptor): class CourseDescriptor(CourseFields, SequenceDescriptor):
module_class = SequenceModule module_class = SequenceModule
......
...@@ -48,7 +48,6 @@ class HeartbeatFailure(Exception): ...@@ -48,7 +48,6 @@ class HeartbeatFailure(Exception):
def __unicode__(self, *args, **kwargs): def __unicode__(self, *args, **kwargs):
return self.message return self.message
def __init__(self, msg, service): def __init__(self, msg, service):
""" """
In addition to a msg, provide the name of the service. In addition to a msg, provide the name of the service.
......
...@@ -752,7 +752,6 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'} ...@@ -752,7 +752,6 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
log.debug("[LTI]: Incorrect action.") log.debug("[LTI]: Incorrect action.")
return Response(response_xml_template.format(**unsupported_values), content_type='application/xml') return Response(response_xml_template.format(**unsupported_values), content_type='application/xml')
@classmethod @classmethod
def parse_grade_xml_body(cls, body): def parse_grade_xml_body(cls, body):
""" """
...@@ -842,6 +841,7 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'} ...@@ -842,6 +841,7 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
return key, secret return key, secret
return '', '' return '', ''
class LTIDescriptor(LTIFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescriptor): class LTIDescriptor(LTIFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescriptor):
""" """
Descriptor for LTI Xmodule. Descriptor for LTI Xmodule.
......
...@@ -39,4 +39,3 @@ class MakoModuleDescriptor(XModuleDescriptor): ...@@ -39,4 +39,3 @@ class MakoModuleDescriptor(XModuleDescriptor):
def get_html(self): def get_html(self):
return self.system.render_template( return self.system.render_template(
self.mako_template, self.get_context()) self.mako_template, self.get_context())
...@@ -14,7 +14,6 @@ class BlockKey(namedtuple('BlockKey', 'type id')): ...@@ -14,7 +14,6 @@ class BlockKey(namedtuple('BlockKey', 'type id')):
def __new__(cls, type, id): def __new__(cls, type, id):
return super(BlockKey, cls).__new__(cls, type, id) return super(BlockKey, cls).__new__(cls, type, id)
@classmethod @classmethod
@contract(usage_key=BlockUsageLocator) @contract(usage_key=BlockUsageLocator)
def from_usage_key(cls, usage_key): def from_usage_key(cls, usage_key):
......
...@@ -1442,6 +1442,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase): ...@@ -1442,6 +1442,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return new_course return new_course
DEFAULT_ROOT_BLOCK_ID = 'course' DEFAULT_ROOT_BLOCK_ID = 'course'
def create_course( def create_course(
self, org, course, run, user_id, master_branch=None, fields=None, self, org, course, run, user_id, master_branch=None, fields=None,
versions_dict=None, search_targets=None, root_category='course', versions_dict=None, search_targets=None, root_category='course',
...@@ -2689,6 +2690,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase): ...@@ -2689,6 +2690,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
""" """
self.db_connection.ensure_indexes() self.db_connection.ensure_indexes()
class SparseList(list): class SparseList(list):
""" """
Enable inserting items into a list in arbitrary order and then retrieving them. Enable inserting items into a list in arbitrary order and then retrieving them.
......
...@@ -38,7 +38,6 @@ class SplitMongoKVS(InheritanceKeyValueStore): ...@@ -38,7 +38,6 @@ class SplitMongoKVS(InheritanceKeyValueStore):
self.parent = parent self.parent = parent
def get(self, key): def get(self, key):
# load the field, if needed # load the field, if needed
if key.field_name not in self._fields: if key.field_name not in self._fields:
......
...@@ -8,6 +8,7 @@ from opaque_keys.edx.keys import UsageKey ...@@ -8,6 +8,7 @@ from opaque_keys.edx.keys import UsageKey
# Factories don't have __init__ methods, and are self documenting # Factories don't have __init__ methods, and are self documenting
# pylint: disable=W0232, C0111 # pylint: disable=W0232, C0111
class SplitFactory(factory.Factory): class SplitFactory(factory.Factory):
""" """
Abstracted superclass which defines modulestore so that there's no dependency on django Abstracted superclass which defines modulestore so that there's no dependency on django
......
...@@ -12,6 +12,7 @@ from xmodule.modulestore.modulestore_settings import ( ...@@ -12,6 +12,7 @@ from xmodule.modulestore.modulestore_settings import (
get_mixed_stores, get_mixed_stores,
) )
@ddt.ddt @ddt.ddt
class ModuleStoreSettingsMigration(TestCase): class ModuleStoreSettingsMigration(TestCase):
""" """
...@@ -114,7 +115,6 @@ class ModuleStoreSettingsMigration(TestCase): ...@@ -114,7 +115,6 @@ class ModuleStoreSettingsMigration(TestCase):
} }
} }
def assertStoreValuesEqual(self, store_setting1, store_setting2): def assertStoreValuesEqual(self, store_setting1, store_setting2):
""" """
Tests whether the fields in the given store_settings are equal. Tests whether the fields in the given store_settings are equal.
......
...@@ -439,6 +439,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin): ...@@ -439,6 +439,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin):
def db_structure(_id): def db_structure(_id):
previous, _, current = _id.partition('.') previous, _, current = _id.partition('.')
return {'db': 'structure', 'previous_version': previous, '_id': current} return {'db': 'structure', 'previous_version': previous, '_id': current}
def active_structure(_id): def active_structure(_id):
previous, _, current = _id.partition('.') previous, _, current = _id.partition('.')
return {'active': 'structure', 'previous_version': previous, '_id': current} return {'active': 'structure', 'previous_version': previous, '_id': current}
......
...@@ -188,7 +188,6 @@ def adapt_references(subtree, destination_course_key, export_fs): ...@@ -188,7 +188,6 @@ def adapt_references(subtree, destination_course_key, export_fs):
) )
def _export_field_content(xblock_item, item_dir): def _export_field_content(xblock_item, item_dir):
""" """
Export all fields related to 'xblock_item' other than 'metadata' and 'data' to json file in provided directory Export all fields related to 'xblock_item' other than 'metadata' and 'data' to json file in provided directory
......
...@@ -390,6 +390,7 @@ def _import_static_content_wrapper(static_content_store, do_import_static, cours ...@@ -390,6 +390,7 @@ def _import_static_content_wrapper(static_content_store, do_import_static, cours
dest_course_id, subpath=simport, verbose=verbose dest_course_id, subpath=simport, verbose=verbose
) )
def _import_module_and_update_references( def _import_module_and_update_references(
module, store, user_id, module, store, user_id,
source_course_id, dest_course_id, source_course_id, dest_course_id,
......
...@@ -168,6 +168,7 @@ class MockControllerQueryService(object): ...@@ -168,6 +168,7 @@ class MockControllerQueryService(object):
""" """
pass pass
def convert_seconds_to_human_readable(seconds): def convert_seconds_to_human_readable(seconds):
if seconds < 60: if seconds < 60:
human_string = "{0} seconds".format(seconds) human_string = "{0} seconds".format(seconds)
......
...@@ -77,7 +77,6 @@ class RandomizeModule(RandomizeFields, XModule): ...@@ -77,7 +77,6 @@ class RandomizeModule(RandomizeFields, XModule):
return [self.child_descriptor] return [self.child_descriptor]
def student_view(self, context): def student_view(self, context):
if self.child is None: if self.child is None:
# raise error instead? In fact, could complain on descriptor load... # raise error instead? In fact, could complain on descriptor load...
...@@ -95,7 +94,6 @@ class RandomizeDescriptor(RandomizeFields, SequenceDescriptor): ...@@ -95,7 +94,6 @@ class RandomizeDescriptor(RandomizeFields, SequenceDescriptor):
filename_extension = "xml" filename_extension = "xml"
def definition_to_xml(self, resource_fs): def definition_to_xml(self, resource_fs):
xml_object = etree.Element('randomize') xml_object = etree.Element('randomize')
......
...@@ -357,6 +357,7 @@ class SplitTestModule(SplitTestFields, XModule, StudioEditableModule): ...@@ -357,6 +357,7 @@ class SplitTestModule(SplitTestFields, XModule, StudioEditableModule):
""" """
return self.descriptor.validate() return self.descriptor.validate()
@XBlock.needs('user_tags') # pylint: disable=abstract-method @XBlock.needs('user_tags') # pylint: disable=abstract-method
@XBlock.wants('partitions') @XBlock.wants('partitions')
@XBlock.wants('user') @XBlock.wants('user')
......
...@@ -225,6 +225,7 @@ class StaffTab(AuthenticatedCourseTab): ...@@ -225,6 +225,7 @@ class StaffTab(AuthenticatedCourseTab):
def can_display(self, course, settings, is_user_authenticated, is_user_staff, is_user_enrolled): # pylint: disable=unused-argument def can_display(self, course, settings, is_user_authenticated, is_user_staff, is_user_enrolled): # pylint: disable=unused-argument
return is_user_staff return is_user_staff
class EnrolledOrStaffTab(CourseTab): class EnrolledOrStaffTab(CourseTab):
""" """
Abstract class for tabs that can be accessed by only users with staff access Abstract class for tabs that can be accessed by only users with staff access
......
...@@ -60,7 +60,6 @@ class CustomTagDescriptor(RawDescriptor): ...@@ -60,7 +60,6 @@ class CustomTagDescriptor(RawDescriptor):
template = Template(template_module_data) template = Template(template_module_data)
return template.render(**params) return template.render(**params)
@property @property
def rendered_html(self): def rendered_html(self):
return self.render_template(self.system, self.data) return self.render_template(self.system, self.data)
......
...@@ -40,6 +40,7 @@ import lxml.etree ...@@ -40,6 +40,7 @@ import lxml.etree
from singledispatch import singledispatch from singledispatch import singledispatch
@singledispatch @singledispatch
def assert_student_view_valid_html(block, html): def assert_student_view_valid_html(block, html):
""" """
......
import ddt import ddt
from xmodule.tests import BulkAssertionTest from xmodule.tests import BulkAssertionTest
@ddt.ddt @ddt.ddt
class TestBulkAssertionTestCase(BulkAssertionTest): class TestBulkAssertionTestCase(BulkAssertionTest):
...@@ -21,7 +22,6 @@ class TestBulkAssertionTestCase(BulkAssertionTest): ...@@ -21,7 +22,6 @@ class TestBulkAssertionTestCase(BulkAssertionTest):
def test_passing_asserts_passthrough(self, assertion, *args): def test_passing_asserts_passthrough(self, assertion, *args):
getattr(self, assertion)(*args) getattr(self, assertion)(*args)
@ddt.data( @ddt.data(
('assertTrue', False), ('assertTrue', False),
('assertFalse', True), ('assertFalse', True),
......
...@@ -142,6 +142,7 @@ class CapaFactory(object): ...@@ -142,6 +142,7 @@ class CapaFactory(object):
return module return module
class CapaFactoryWithFiles(CapaFactory): class CapaFactoryWithFiles(CapaFactory):
""" """
A factory for creating a Capa problem with files attached. A factory for creating a Capa problem with files attached.
...@@ -1394,7 +1395,6 @@ class CapaModuleTest(unittest.TestCase): ...@@ -1394,7 +1395,6 @@ class CapaModuleTest(unittest.TestCase):
Run the test for each possible rerandomize value Run the test for each possible rerandomize value
""" """
def _reset_and_get_seed(module): def _reset_and_get_seed(module):
""" """
Reset the XModule and return the module's seed Reset the XModule and return the module's seed
......
...@@ -44,6 +44,7 @@ Various versions have evolved over the years, sometimes by accident, sometimes o ...@@ -44,6 +44,7 @@ Various versions have evolved over the years, sometimes by accident, sometimes o
injected humour and the like). injected humour and the like).
""" """
class Content: class Content:
def __init__(self, location, content_type): def __init__(self, location, content_type):
self.location = location self.location = location
......
...@@ -65,4 +65,3 @@ class TabsEditingDescriptorTestCase(unittest.TestCase): ...@@ -65,4 +65,3 @@ class TabsEditingDescriptorTestCase(unittest.TestCase):
""""test get_context""" """"test get_context"""
rendered_context = self.descriptor.get_context() rendered_context = self.descriptor.get_context()
self.assertListEqual(rendered_context['tabs'], self.tabs) self.assertListEqual(rendered_context['tabs'], self.tabs)
...@@ -150,7 +150,6 @@ class ImportTestCase(BaseCourseTestCase): ...@@ -150,7 +150,6 @@ class ImportTestCase(BaseCourseTestCase):
self.assertNotEqual(descriptor1.location, descriptor2.location) self.assertNotEqual(descriptor1.location, descriptor2.location)
def test_reimport(self): def test_reimport(self):
'''Make sure an already-exported error xml tag loads properly''' '''Make sure an already-exported error xml tag loads properly'''
......
...@@ -3,6 +3,7 @@ from xmodule.util.django import get_current_request, get_current_request_hostnam ...@@ -3,6 +3,7 @@ from xmodule.util.django import get_current_request, get_current_request_hostnam
from nose.tools import assert_is_none from nose.tools import assert_is_none
from unittest import TestCase from unittest import TestCase
class UtilDjangoTests(TestCase): class UtilDjangoTests(TestCase):
""" """
Tests for methods exposed in util/django Tests for methods exposed in util/django
......
...@@ -46,4 +46,3 @@ class WordCloudModuleTest(LogicTest): ...@@ -46,4 +46,3 @@ class WordCloudModuleTest(LogicTest):
self.assertEqual( self.assertEqual(
100.0, 100.0,
sum(i['percent'] for i in response['top_words'])) sum(i['percent'] for i in response['top_words']))
...@@ -2,6 +2,7 @@ import logging ...@@ -2,6 +2,7 @@ import logging
from xmodule.fields import Timedelta from xmodule.fields import Timedelta
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class TimeInfo(object): class TimeInfo(object):
""" """
This is a simple object that calculates and stores datetime information for an XModule This is a simple object that calculates and stores datetime information for an XModule
...@@ -14,6 +15,7 @@ class TimeInfo(object): ...@@ -14,6 +15,7 @@ class TimeInfo(object):
""" """
_delta_standin = Timedelta() _delta_standin = Timedelta()
def __init__(self, due_date, grace_period_string_or_timedelta): def __init__(self, due_date, grace_period_string_or_timedelta):
if due_date is not None: if due_date is not None:
self.display_due_date = due_date self.display_due_date = due_date
......
...@@ -75,6 +75,7 @@ def save_to_store(content, name, mime_type, location): ...@@ -75,6 +75,7 @@ def save_to_store(content, name, mime_type, location):
contentstore().save(content) contentstore().save(content)
return content_location return content_location
def save_subs_to_store(subs, subs_id, item, language='en'): def save_subs_to_store(subs, subs_id, item, language='en'):
""" """
Save transcripts into `StaticContent`. Save transcripts into `StaticContent`.
...@@ -90,6 +91,7 @@ def save_subs_to_store(subs, subs_id, item, language='en'): ...@@ -90,6 +91,7 @@ def save_subs_to_store(subs, subs_id, item, language='en'):
filename = subs_filename(subs_id, language) filename = subs_filename(subs_id, language)
return save_to_store(filedata, filename, 'application/json', item.location) return save_to_store(filedata, filename, 'application/json', item.location)
def get_transcripts_from_youtube(youtube_id, settings, i18n): def get_transcripts_from_youtube(youtube_id, settings, i18n):
""" """
Gets transcripts from youtube for youtube_id. Gets transcripts from youtube for youtube_id.
...@@ -428,6 +430,7 @@ def get_or_create_sjson(item): ...@@ -428,6 +430,7 @@ def get_or_create_sjson(item):
sjson_transcript = Transcript.asset(item.location, source_subs_id, item.transcript_language).data sjson_transcript = Transcript.asset(item.location, source_subs_id, item.transcript_language).data
return sjson_transcript return sjson_transcript
class Transcript(object): class Transcript(object):
""" """
Container for transcript methods. Container for transcript methods.
......
...@@ -211,7 +211,6 @@ class XModuleMixin(XBlockMixin): ...@@ -211,7 +211,6 @@ class XModuleMixin(XBlockMixin):
def runtime(self, value): def runtime(self, value):
self._runtime = value self._runtime = value
@property @property
def system(self): def system(self):
""" """
...@@ -719,7 +718,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -719,7 +718,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
entry_point = "xmodule.v1" entry_point = "xmodule.v1"
module_class = XModule module_class = XModule
# VS[compat]. Backwards compatibility code that can go away after # VS[compat]. Backwards compatibility code that can go away after
# importing 2012 courses. # importing 2012 courses.
# A set of metadata key conversions that we want to make # A set of metadata key conversions that we want to make
...@@ -835,7 +833,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -835,7 +833,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
""" """
pass pass
# =============================== BUILTIN METHODS ========================== # =============================== BUILTIN METHODS ==========================
def __eq__(self, other): def __eq__(self, other):
return (self.scope_ids == other.scope_ids and return (self.scope_ids == other.scope_ids and
......
...@@ -42,6 +42,7 @@ class Thread(ContentFactory): ...@@ -42,6 +42,7 @@ class Thread(ContentFactory):
pinned = False pinned = False
read = False read = False
class Comment(ContentFactory): class Comment(ContentFactory):
thread_id = None thread_id = None
depth = 0 depth = 0
......
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