TE-2689 Remove useless pylint suppressions part 3
This commit is contained in:
@@ -53,14 +53,14 @@ def _context(response):
|
||||
"""
|
||||
Get a context dictionary for a serializer appropriate for the given response.
|
||||
"""
|
||||
return {'request': response.wsgi_request} # pylint: disable=no-member
|
||||
return {'request': response.wsgi_request}
|
||||
|
||||
|
||||
def _data(response):
|
||||
"""
|
||||
Get the serialized data dictionary from the given REST API test response.
|
||||
"""
|
||||
return response.data # pylint: disable=no-member
|
||||
return response.data
|
||||
|
||||
|
||||
@override_settings(BROKER_URL='memory://localhost/')
|
||||
|
||||
@@ -631,7 +631,7 @@ class CourseAboutSearchIndexer(object):
|
||||
# Broad exception handler to protect around and report problems with indexing
|
||||
try:
|
||||
searcher.index(cls.DISCOVERY_DOCUMENT_TYPE, [course_info])
|
||||
except: # pylint: disable=bare-except
|
||||
except:
|
||||
log.exception(
|
||||
"Course discovery indexing error encountered, course discovery index may be out of date %s",
|
||||
course_id,
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestArgParsing(TestCase):
|
||||
call_command("migrate_to_split", "org/course/name", "fake@example.com")
|
||||
|
||||
|
||||
# pylint: disable=no-member, protected-access
|
||||
# pylint: disable=protected-access
|
||||
class TestMigrateToSplit(ModuleStoreTestCase):
|
||||
"""
|
||||
Unit tests for migrating a course from old mongo to split mongo
|
||||
|
||||
@@ -687,7 +687,7 @@ def import_olx(self, user_id, course_key_string, archive_path, archive_name, lan
|
||||
return
|
||||
|
||||
temp_filepath = course_dir / get_valid_filename(archive_name)
|
||||
if not course_dir.isdir(): # pylint: disable=no-value-for-parameter
|
||||
if not course_dir.isdir():
|
||||
os.mkdir(course_dir)
|
||||
|
||||
LOGGER.debug(u'importing course to {0}'.format(temp_filepath))
|
||||
@@ -726,7 +726,7 @@ def import_olx(self, user_id, course_key_string, archive_path, archive_name, lan
|
||||
)
|
||||
# Send errors to client with stage at which error occurred.
|
||||
except Exception as exception: # pylint: disable=broad-except
|
||||
if course_dir.isdir(): # pylint: disable=no-value-for-parameter
|
||||
if course_dir.isdir():
|
||||
shutil.rmtree(course_dir)
|
||||
LOGGER.info(u'Course import %s: Temp data cleared', courselike_key)
|
||||
|
||||
@@ -805,7 +805,7 @@ def import_olx(self, user_id, course_key_string, archive_path, archive_name, lan
|
||||
LOGGER.exception(u'error importing course', exc_info=True)
|
||||
self.status.fail(text_type(exception))
|
||||
finally:
|
||||
if course_dir.isdir(): # pylint: disable=no-value-for-parameter
|
||||
if course_dir.isdir():
|
||||
shutil.rmtree(course_dir)
|
||||
LOGGER.info(u'Course import %s: Temp data cleared', courselike_key)
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ class TestCourseListing(ModuleStoreTestCase):
|
||||
|
||||
course_location = self.store.make_course_key('testOrg', 'doomedCourse', 'RunBabyRun')
|
||||
self._create_course_with_access_groups(course_location, self.user, store)
|
||||
self.store.delete_course(course_location, self.user.id) # pylint: disable=no-member
|
||||
self.store.delete_course(course_location, self.user.id)
|
||||
|
||||
courses_list, __ = _accessible_courses_list_from_groups(self.request)
|
||||
self.assertEqual(len(courses_list), 1, courses_list)
|
||||
|
||||
@@ -104,7 +104,7 @@ class ExportLibraryTestCase(LibraryTestCase):
|
||||
Verify that a routine library export task succeeds
|
||||
"""
|
||||
key = str(self.lib_key)
|
||||
result = export_olx.delay(self.user.id, key, u'en') # pylint: disable=no-member
|
||||
result = export_olx.delay(self.user.id, key, u'en')
|
||||
status = UserTaskStatus.objects.get(task_id=result.id)
|
||||
self.assertEqual(status.state, UserTaskStatus.SUCCEEDED)
|
||||
artifacts = UserTaskArtifact.objects.filter(status=status)
|
||||
|
||||
@@ -387,7 +387,7 @@ class GroupVisibilityTest(CourseTestCase):
|
||||
def test_no_visibility_set(self):
|
||||
""" Tests when group_access has not been set on anything. """
|
||||
|
||||
def verify_all_components_visible_to_all(): # pylint: disable=invalid-name
|
||||
def verify_all_components_visible_to_all():
|
||||
""" Verifies when group_access has not been set on anything. """
|
||||
for item in (self.sequential, self.vertical, self.html, self.problem):
|
||||
self.assertFalse(utils.has_children_visible_to_specific_partition_groups(item))
|
||||
@@ -430,7 +430,7 @@ class GetUserPartitionInfoTest(ModuleStoreTestCase):
|
||||
"""Create a dummy course. """
|
||||
super(GetUserPartitionInfoTest, self).setUp()
|
||||
self.course = CourseFactory()
|
||||
self.block = ItemFactory.create(category="problem", parent_location=self.course.location) # pylint: disable=no-member
|
||||
self.block = ItemFactory.create(category="problem", parent_location=self.course.location)
|
||||
|
||||
# Set up some default partitions
|
||||
self._set_partitions([
|
||||
|
||||
@@ -131,7 +131,6 @@ def get_lms_link_for_item(location, preview=False):
|
||||
)
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def get_lms_link_for_certificate_web_view(user_id, course_key, mode):
|
||||
"""
|
||||
Returns the url to the certificate web view.
|
||||
|
||||
@@ -294,7 +294,7 @@ def get_component_templates(courselike, library=False):
|
||||
|
||||
templates_for_category.append(
|
||||
create_template_dict(
|
||||
_(template['metadata'].get('display_name')), # pylint: disable=translation-of-non-string
|
||||
_(template['metadata'].get('display_name')),
|
||||
category,
|
||||
support_level_with_template,
|
||||
template_id,
|
||||
|
||||
@@ -6,7 +6,7 @@ import json
|
||||
import logging
|
||||
import random
|
||||
import re
|
||||
import string # pylint: disable=deprecated-module
|
||||
import string
|
||||
|
||||
import django.utils
|
||||
import six
|
||||
@@ -221,7 +221,6 @@ def _dismiss_notification(request, course_action_state_id): # pylint: disable=u
|
||||
return JsonResponse({'success': True})
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
@login_required
|
||||
def course_handler(request, course_key_string=None):
|
||||
"""
|
||||
@@ -935,7 +934,6 @@ def rerun_course(user, source_course_key, org, number, run, fields, async=True):
|
||||
return destination_course_key
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
@login_required
|
||||
@ensure_csrf_cookie
|
||||
@require_http_methods(["GET"])
|
||||
@@ -968,7 +966,6 @@ def course_info_handler(request, course_key_string):
|
||||
return HttpResponseBadRequest("Only supports html requests")
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
@login_required
|
||||
@ensure_csrf_cookie
|
||||
@require_http_methods(("GET", "POST", "PUT", "DELETE"))
|
||||
|
||||
@@ -27,7 +27,6 @@ __all__ = ['entrance_exam', ]
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def _get_default_entrance_exam_minimum_pct():
|
||||
"""
|
||||
Helper method to return the default value from configuration
|
||||
|
||||
@@ -145,7 +145,7 @@ def xblock_type_display_name(xblock, default_display_name=None):
|
||||
return _('Unit')
|
||||
component_class = XBlock.load_class(category, select=settings.XBLOCK_SELECT_FUNCTION)
|
||||
if hasattr(component_class, 'display_name') and component_class.display_name.default:
|
||||
return _(component_class.display_name.default) # pylint: disable=translation-of-non-string
|
||||
return _(component_class.display_name.default)
|
||||
else:
|
||||
return default_display_name
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ def _write_chunk(request, courselike_key):
|
||||
)
|
||||
|
||||
temp_filepath = course_dir / filename
|
||||
if not course_dir.isdir(): # pylint: disable=no-value-for-parameter
|
||||
if not course_dir.isdir():
|
||||
os.mkdir(course_dir)
|
||||
|
||||
logging.debug('importing course to {0}'.format(temp_filepath))
|
||||
@@ -208,7 +208,7 @@ def _write_chunk(request, courselike_key):
|
||||
# Send errors to client with stage at which error occurred.
|
||||
except Exception as exception: # pylint: disable=broad-except
|
||||
_save_request_status(request, courselike_string, -1)
|
||||
if course_dir.isdir(): # pylint: disable=no-value-for-parameter
|
||||
if course_dir.isdir():
|
||||
shutil.rmtree(course_dir)
|
||||
log.info("Course import %s: Temp data cleared", courselike_key)
|
||||
|
||||
|
||||
@@ -1052,7 +1052,7 @@ def _get_gating_info(course, xblock):
|
||||
if not hasattr(course, 'gating_prerequisites'):
|
||||
# Cache gating prerequisites on course module so that we are not
|
||||
# hitting the database for every xblock in the course
|
||||
setattr(course, 'gating_prerequisites', gating_api.get_prerequisites(course.id)) # pylint: disable=literal-used-as-attribute
|
||||
setattr(course, 'gating_prerequisites', gating_api.get_prerequisites(course.id))
|
||||
info["is_prereq"] = gating_api.is_prerequisite(course.id, xblock.location)
|
||||
info["prereqs"] = [
|
||||
p for p in course.gating_prerequisites if unicode(xblock.location) not in p['namespace']
|
||||
@@ -1271,7 +1271,7 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
|
||||
return xblock_info
|
||||
|
||||
|
||||
def add_container_page_publishing_info(xblock, xblock_info): # pylint: disable=invalid-name
|
||||
def add_container_page_publishing_info(xblock, xblock_info):
|
||||
"""
|
||||
Adds information about the xblock's publish state to the supplied
|
||||
xblock_info for the container page.
|
||||
@@ -1405,7 +1405,7 @@ def _create_xblock_ancestor_info(xblock, course_outline=False, include_child_inf
|
||||
|
||||
|
||||
def _create_xblock_child_info(xblock, course_outline, graders, include_children_predicate=NEVER, user=None,
|
||||
course=None, is_concise=False): # pylint: disable=line-too-long
|
||||
course=None, is_concise=False):
|
||||
"""
|
||||
Returns information about the children of an xblock, as well as about the primary category
|
||||
of xblock expected as children.
|
||||
|
||||
@@ -836,7 +836,7 @@ class TestCourseExportImport(LibraryTestCase):
|
||||
ItemFactory.create(
|
||||
category="problem",
|
||||
parent_location=self.library.location,
|
||||
user_id=self.user.id, # pylint: disable=no-member
|
||||
user_id=self.user.id,
|
||||
publish_item=False,
|
||||
display_name='Test Problem',
|
||||
data="<problem><multiplechoiceresponse></multiplechoiceresponse></problem>",
|
||||
@@ -927,7 +927,7 @@ class TestCourseExportImport(LibraryTestCase):
|
||||
# Now, import it back to dest_course.
|
||||
import_course_from_xml(
|
||||
self.store,
|
||||
self.user.id, # pylint: disable=no-member
|
||||
self.user.id,
|
||||
self.export_dir,
|
||||
['exported_source_course'],
|
||||
static_content_store=contentstore(),
|
||||
|
||||
@@ -1364,7 +1364,7 @@ class TestDuplicateItemWithAsides(ItemTest, DuplicateHelper):
|
||||
|
||||
key_store = DictKeyValueStore()
|
||||
field_data = KvsFieldData(key_store)
|
||||
runtime = TestRuntime(services={'field-data': field_data}) # pylint: disable=abstract-class-instantiated
|
||||
runtime = TestRuntime(services={'field-data': field_data})
|
||||
|
||||
def_id = runtime.id_generator.create_definition(block_type)
|
||||
usage_id = runtime.id_generator.create_usage(def_id)
|
||||
|
||||
@@ -145,7 +145,7 @@ class StatusDisplayStrings(object):
|
||||
@staticmethod
|
||||
def get(val_status):
|
||||
"""Map a VAL status string to a localized display string"""
|
||||
return _(StatusDisplayStrings._STATUS_MAP.get(val_status, StatusDisplayStrings._UNKNOWN)) # pylint: disable=translation-of-non-string
|
||||
return _(StatusDisplayStrings._STATUS_MAP.get(val_status, StatusDisplayStrings._UNKNOWN))
|
||||
|
||||
|
||||
@expect_json
|
||||
|
||||
@@ -143,7 +143,7 @@ class TestForcePublish(MaintenanceViewTestCase):
|
||||
# Add some changes to course
|
||||
chapter = ItemFactory.create(category='chapter', parent_location=course.location)
|
||||
self.store.create_child(
|
||||
self.user.id, # pylint: disable=no-member
|
||||
self.user.id,
|
||||
chapter.location,
|
||||
'html',
|
||||
block_id='html_component'
|
||||
@@ -204,7 +204,7 @@ class TestForcePublish(MaintenanceViewTestCase):
|
||||
|
||||
# publish the course
|
||||
source_store = modulestore()._get_modulestore_for_courselike(course.id) # pylint: disable=protected-access
|
||||
source_store.force_publish_course(course.id, self.user.id, commit=True) # pylint: disable=no-member
|
||||
source_store.force_publish_course(course.id, self.user.id, commit=True)
|
||||
|
||||
# now course is published, we should get `already published course` error.
|
||||
self.verify_error_message(
|
||||
|
||||
@@ -143,14 +143,14 @@ class CourseMetadata(object):
|
||||
if field.scope != Scope.settings:
|
||||
continue
|
||||
|
||||
field_help = _(field.help) # pylint: disable=translation-of-non-string
|
||||
field_help = _(field.help)
|
||||
help_args = field.runtime_options.get('help_format_args')
|
||||
if help_args is not None:
|
||||
field_help = field_help.format(**help_args)
|
||||
|
||||
result[field.name] = {
|
||||
'value': field.read_json(descriptor),
|
||||
'display_name': _(field.display_name), # pylint: disable=translation-of-non-string
|
||||
'display_name': _(field.display_name),
|
||||
'help': field_help,
|
||||
'deprecated': field.runtime_options.get('deprecated', False)
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ SELENIUM_GRID = {
|
||||
#####################################################################
|
||||
# Lastly, see if the developer has any local overrides.
|
||||
try:
|
||||
from .private import * # pylint: disable=import-error
|
||||
from .private import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
@@ -6,11 +6,6 @@ This is the default template for our main set of AWS servers.
|
||||
# want to import all variables from base settings files
|
||||
# pylint: disable=wildcard-import, unused-wildcard-import
|
||||
|
||||
# Pylint gets confused by path.py instances, which report themselves as class
|
||||
# objects. As a result, pylint applies the wrong regex in validating names,
|
||||
# and throws spurious errors. Therefore, we disable invalid-name checking.
|
||||
# pylint: disable=invalid-name
|
||||
|
||||
import json
|
||||
|
||||
from .common import *
|
||||
|
||||
@@ -162,6 +162,6 @@ VIDEO_TRANSCRIPTS_SETTINGS = dict(
|
||||
#####################################################################
|
||||
# Lastly, see if the developer has any local overrides.
|
||||
try:
|
||||
from .private import * # pylint: disable=import-error
|
||||
from .private import * # pylint: disable=wildcard-import
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@@ -25,7 +25,7 @@ import os
|
||||
if 'BOK_CHOY_HOSTNAME' in os.environ:
|
||||
from .devstack_docker import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||
else:
|
||||
from .devstack import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||
from .devstack import * # pylint: disable=wildcard-import
|
||||
|
||||
TEST_ROOT = REPO_ROOT / "test_root"
|
||||
|
||||
|
||||
@@ -13,11 +13,6 @@ sessions. Assumes structure:
|
||||
# want to import all variables from base settings files
|
||||
# pylint: disable=wildcard-import, unused-wildcard-import
|
||||
|
||||
# Pylint gets confused by path.py instances, which report themselves as class
|
||||
# objects. As a result, pylint applies the wrong regex in validating names,
|
||||
# and throws spurious errors. Therefore, we disable invalid-name checking.
|
||||
# pylint: disable=invalid-name
|
||||
|
||||
from .common import *
|
||||
import os
|
||||
from path import Path as path
|
||||
|
||||
@@ -123,7 +123,7 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
|
||||
usage_id="usage-id")
|
||||
key_store = DictKeyValueStore()
|
||||
field_data = KvsFieldData(key_store)
|
||||
runtime = TestRuntime(services={'field-data': field_data}) # pylint: disable=abstract-class-instantiated
|
||||
runtime = TestRuntime(services={'field-data': field_data})
|
||||
xblock_aside = StructuredTagsAside(scope_ids=sids, runtime=runtime)
|
||||
available_tags = xblock_aside.get_available_tags()
|
||||
self.assertEquals(len(available_tags), 2, "StructuredTagsAside should contains two tag categories")
|
||||
|
||||
@@ -680,7 +680,7 @@ def _check_fields(allowed_fields, data, message):
|
||||
raise ValidationError(non_allowed_fields)
|
||||
|
||||
|
||||
def _check_initializable_thread_fields(data, context): # pylint: disable=invalid-name
|
||||
def _check_initializable_thread_fields(data, context):
|
||||
"""
|
||||
Checks if the given data contains a thread field that is not initializable
|
||||
by the requesting user
|
||||
@@ -701,7 +701,7 @@ def _check_initializable_thread_fields(data, context): # pylint: disable=invali
|
||||
)
|
||||
|
||||
|
||||
def _check_initializable_comment_fields(data, context): # pylint: disable=invalid-name
|
||||
def _check_initializable_comment_fields(data, context):
|
||||
"""
|
||||
Checks if the given data contains a comment field that is not initializable
|
||||
by the requesting user
|
||||
|
||||
@@ -38,7 +38,7 @@ def get_initializable_thread_fields(context):
|
||||
return ret
|
||||
|
||||
|
||||
def get_initializable_comment_fields(context): # pylint: disable=invalid-name
|
||||
def get_initializable_comment_fields(context):
|
||||
"""
|
||||
Return the set of fields that the requester can initialize for a comment
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Test grading with access changes.
|
||||
"""
|
||||
# pylint: disable=protected-access
|
||||
|
||||
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
|
||||
from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin
|
||||
|
||||
@@ -250,7 +250,6 @@ class TestWeightedProblems(SharedModuleStoreTestCase):
|
||||
Verifies the computed grades are as expected.
|
||||
"""
|
||||
with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred):
|
||||
# pylint: disable=no-member
|
||||
for problem in self.problems:
|
||||
problem.weight = weight
|
||||
self.store.update_item(problem, self.user.id)
|
||||
|
||||
@@ -47,7 +47,7 @@ class TestProgramListing(ProgramsApiConfigMixin, SharedModuleStoreTestCase):
|
||||
super(TestProgramListing, cls).setUpClass()
|
||||
|
||||
cls.course = ModuleStoreCourseFactory()
|
||||
course_run = CourseRunFactory(key=unicode(cls.course.id)) # pylint: disable=no-member
|
||||
course_run = CourseRunFactory(key=unicode(cls.course.id))
|
||||
course = CourseFactory(course_runs=[course_run])
|
||||
|
||||
cls.first_program = ProgramFactory(courses=[course])
|
||||
@@ -137,7 +137,7 @@ class TestProgramListing(ProgramsApiConfigMixin, SharedModuleStoreTestCase):
|
||||
self.create_programs_config()
|
||||
mock_get_programs.return_value = self.data
|
||||
|
||||
CourseEnrollmentFactory(user=self.user, course_id=self.course.id) # pylint: disable=no-member
|
||||
CourseEnrollmentFactory(user=self.user, course_id=self.course.id)
|
||||
|
||||
response = self.client.get(self.url)
|
||||
actual = self.load_serialized_data(response, 'programsData')
|
||||
@@ -166,7 +166,7 @@ class TestProgramListing(ProgramsApiConfigMixin, SharedModuleStoreTestCase):
|
||||
self.create_programs_config()
|
||||
mock_get_programs.return_value = self.data
|
||||
|
||||
CourseEnrollmentFactory(user=self.user, course_id=self.course.id) # pylint: disable=no-member
|
||||
CourseEnrollmentFactory(user=self.user, course_id=self.course.id)
|
||||
|
||||
response = self.client.get(self.url)
|
||||
actual = self.load_serialized_data(response, 'programsData')
|
||||
|
||||
@@ -13,4 +13,4 @@ class LtiProviderConfig(AppConfig):
|
||||
|
||||
def ready(self):
|
||||
# Import the tasks module to ensure that signal handlers are registered.
|
||||
from . import signals # pylint: disable=unused-import
|
||||
from . import signals # pylint: disable=unused-variable
|
||||
|
||||
@@ -5,7 +5,7 @@ Django template context processors.
|
||||
from openedx.core.lib.mobile_utils import is_request_from_mobile_app
|
||||
|
||||
|
||||
def is_from_mobile_app(request): # pylint: disable=unused-argument
|
||||
def is_from_mobile_app(request):
|
||||
"""
|
||||
Configuration context for django templates.
|
||||
"""
|
||||
|
||||
@@ -22,7 +22,7 @@ class MobileAPIMilestonesMixin(object):
|
||||
"""
|
||||
shard = 4
|
||||
|
||||
ALLOW_ACCESS_TO_MILESTONE_COURSE = False # pylint: disable=invalid-name
|
||||
ALLOW_ACCESS_TO_MILESTONE_COURSE = False
|
||||
|
||||
@patch.dict(settings.FEATURES, {
|
||||
'ENABLE_PREREQUISITE_COURSES': True,
|
||||
@@ -85,21 +85,21 @@ class MobileAPIMilestonesMixin(object):
|
||||
with self.store.bulk_operations(self.course.id):
|
||||
self.course.entrance_exam_enabled = True
|
||||
|
||||
self.entrance_exam = ItemFactory.create( # pylint: disable=attribute-defined-outside-init
|
||||
self.entrance_exam = ItemFactory.create(
|
||||
parent=self.course,
|
||||
category="chapter",
|
||||
display_name="Entrance Exam Chapter",
|
||||
is_entrance_exam=True,
|
||||
in_entrance_exam=True,
|
||||
)
|
||||
self.subsection_1 = ItemFactory.create( # pylint: disable=attribute-defined-outside-init
|
||||
self.subsection_1 = ItemFactory.create(
|
||||
parent=self.entrance_exam,
|
||||
category='sequential',
|
||||
display_name="The Only Exam Sequential",
|
||||
graded=True,
|
||||
in_entrance_exam=True,
|
||||
)
|
||||
self.problem_1 = ItemFactory.create( # pylint: disable=attribute-defined-outside-init
|
||||
self.problem_1 = ItemFactory.create(
|
||||
parent=self.subsection_1,
|
||||
category='problem',
|
||||
display_name="The Only Exam Problem",
|
||||
@@ -115,7 +115,7 @@ class MobileAPIMilestonesMixin(object):
|
||||
|
||||
def _add_prerequisite_course(self):
|
||||
""" Helper method to set up the prerequisite course """
|
||||
self.prereq_course = CourseFactory.create() # pylint: disable=attribute-defined-outside-init
|
||||
self.prereq_course = CourseFactory.create()
|
||||
add_prerequisite_course(self.course.id, self.prereq_course.id)
|
||||
|
||||
def _pass_entrance_exam(self):
|
||||
|
||||
@@ -141,8 +141,8 @@ class MobileCourseAccessTestMixin(MobileAPIMilestonesMixin):
|
||||
Subclasses are expected to inherit from MobileAPITestCase.
|
||||
Subclasses can override verify_success, verify_failure, and init_course_access methods.
|
||||
"""
|
||||
ALLOW_ACCESS_TO_UNRELEASED_COURSE = False # pylint: disable=invalid-name
|
||||
ALLOW_ACCESS_TO_NON_VISIBLE_COURSE = False # pylint: disable=invalid-name
|
||||
ALLOW_ACCESS_TO_UNRELEASED_COURSE = False
|
||||
ALLOW_ACCESS_TO_NON_VISIBLE_COURSE = False
|
||||
|
||||
def verify_success(self, response):
|
||||
"""Base implementation of verifying a successful response."""
|
||||
@@ -175,9 +175,7 @@ class MobileCourseAccessTestMixin(MobileAPIMilestonesMixin):
|
||||
@patch.dict('django.conf.settings.FEATURES', {'DISABLE_START_DATES': False, 'ENABLE_MKTG_SITE': True})
|
||||
def test_unreleased_course(self):
|
||||
# ensure the course always starts in the future
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
self.course = CourseFactory.create(mobile_available=True, static_asset_path="needed_for_split")
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
self.course.start = timezone.now() + datetime.timedelta(days=365)
|
||||
self.init_course_access()
|
||||
self._verify_response(self.ALLOW_ACCESS_TO_UNRELEASED_COURSE, StartDateError(self.course.start))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Tests for users API
|
||||
"""
|
||||
# pylint: disable=no-member
|
||||
import datetime
|
||||
|
||||
import ddt
|
||||
|
||||
@@ -161,7 +161,7 @@ class TestVideoAPIMixin(object):
|
||||
|
||||
def _setup_course_partitions(self, scheme_id='random', is_cohorted=False):
|
||||
"""Helper method to configure the user partitions in the course."""
|
||||
self.partition_id = 0 # pylint: disable=attribute-defined-outside-init
|
||||
self.partition_id = 0
|
||||
self.course.user_partitions = [
|
||||
UserPartition(
|
||||
self.partition_id, 'first_partition', 'First Partition',
|
||||
@@ -180,7 +180,7 @@ class TestVideoAPIMixin(object):
|
||||
def _setup_split_module(self, sub_block_category):
|
||||
"""Helper method to configure a split_test unit with children of type sub_block_category."""
|
||||
self._setup_course_partitions()
|
||||
self.split_test = ItemFactory.create( # pylint: disable=attribute-defined-outside-init
|
||||
self.split_test = ItemFactory.create(
|
||||
parent=self.unit,
|
||||
category="split_test",
|
||||
display_name=u"split test unit",
|
||||
|
||||
@@ -62,7 +62,6 @@ class Note(models.Model):
|
||||
"""
|
||||
Returns the absolute url for the note object.
|
||||
"""
|
||||
# pylint: disable=no-member
|
||||
kwargs = {'course_id': text_type(self.course_id), 'note_id': str(self.pk)}
|
||||
return reverse('notes_api_note', kwargs=kwargs)
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ class UserInfoTest(BaseTestMixin, UserInfoTestCase):
|
||||
full_scope = 'openid %s' % scope
|
||||
self.set_access_token_scope(full_scope)
|
||||
|
||||
token = self.access_token.token # pylint: disable=no-member
|
||||
token = self.access_token.token
|
||||
return full_scope, token
|
||||
|
||||
def get_with_scope(self, scope):
|
||||
|
||||
@@ -711,8 +711,8 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
|
||||
cookies[settings.ENTERPRISE_CUSTOMER_COOKIE_NAME] = 'test-enterprise-customer'
|
||||
response = self.client.get(reverse('signin_user'), HTTP_ACCEPT="text/html", cookies=cookies)
|
||||
|
||||
self.assertIn(settings.ENTERPRISE_CUSTOMER_COOKIE_NAME, response.cookies) # pylint:disable=no-member
|
||||
enterprise_cookie = response.cookies[settings.ENTERPRISE_CUSTOMER_COOKIE_NAME] # pylint:disable=no-member
|
||||
self.assertIn(settings.ENTERPRISE_CUSTOMER_COOKIE_NAME, response.cookies)
|
||||
enterprise_cookie = response.cookies[settings.ENTERPRISE_CUSTOMER_COOKIE_NAME]
|
||||
|
||||
self.assertEqual(enterprise_cookie['domain'], settings.BASE_COOKIE_DOMAIN)
|
||||
self.assertEqual(enterprise_cookie.value, '')
|
||||
|
||||
@@ -319,7 +319,7 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None):
|
||||
for msg in messages.get_messages(request):
|
||||
if msg.extra_tags.split()[0] == "social-auth":
|
||||
# msg may or may not be translated. Try translating [again] in case we are able to:
|
||||
context['errorMessage'] = _(unicode(msg)) # pylint: disable=translation-of-non-string
|
||||
context['errorMessage'] = _(unicode(msg))
|
||||
break
|
||||
|
||||
return context
|
||||
@@ -379,7 +379,7 @@ def _get_extended_profile_fields():
|
||||
extended_profile_field_names = configuration_helpers.get_value('extended_profile_fields', [])
|
||||
for field_to_exclude in fields_already_showing:
|
||||
if field_to_exclude in extended_profile_field_names:
|
||||
extended_profile_field_names.remove(field_to_exclude) # pylint: disable=no-member
|
||||
extended_profile_field_names.remove(field_to_exclude)
|
||||
|
||||
extended_profile_field_options = configuration_helpers.get_value('EXTRA_FIELD_OPTIONS', [])
|
||||
extended_profile_field_option_tuples = {}
|
||||
@@ -542,11 +542,11 @@ def account_settings_context(request):
|
||||
'country': {
|
||||
'options': list(countries),
|
||||
}, 'gender': {
|
||||
'options': [(choice[0], _(choice[1])) for choice in UserProfile.GENDER_CHOICES], # pylint: disable=translation-of-non-string
|
||||
'options': [(choice[0], _(choice[1])) for choice in UserProfile.GENDER_CHOICES],
|
||||
}, 'language': {
|
||||
'options': released_languages(),
|
||||
}, 'level_of_education': {
|
||||
'options': [(choice[0], _(choice[1])) for choice in UserProfile.LEVEL_OF_EDUCATION_CHOICES], # pylint: disable=translation-of-non-string
|
||||
'options': [(choice[0], _(choice[1])) for choice in UserProfile.LEVEL_OF_EDUCATION_CHOICES],
|
||||
}, 'password': {
|
||||
'url': reverse('password_reset'),
|
||||
}, 'year_of_birth': {
|
||||
|
||||
@@ -143,7 +143,7 @@ def course_team_post_save_callback(**kwargs):
|
||||
|
||||
|
||||
@receiver(post_delete, sender=CourseTeam, dispatch_uid='teams.signals.course_team_post_delete_callback')
|
||||
def course_team_post_delete_callback(**kwargs): # pylint: disable=invalid-name
|
||||
def course_team_post_delete_callback(**kwargs):
|
||||
"""
|
||||
Reindex object after delete.
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=no-member
|
||||
"""Tests for the teams API at the HTTP request level."""
|
||||
import itertools
|
||||
from contextlib import contextmanager
|
||||
@@ -163,8 +162,8 @@ class TeamSignalsTest(EventTestMixin, SharedModuleStoreTestCase):
|
||||
team_membership_last_activity = self.team_membership.last_activity_at
|
||||
yield
|
||||
# Reload team and team membership from the database in order to pick up changes
|
||||
team = CourseTeam.objects.get(id=self.team.id) # pylint: disable=maybe-no-member
|
||||
team_membership = CourseTeamMembership.objects.get(id=self.team_membership.id) # pylint: disable=maybe-no-member
|
||||
team = CourseTeam.objects.get(id=self.team.id)
|
||||
team_membership = CourseTeamMembership.objects.get(id=self.team_membership.id)
|
||||
if should_update:
|
||||
self.assertGreater(team.last_activity_at, team_last_activity)
|
||||
self.assertGreater(team_membership.last_activity_at, team_membership_last_activity)
|
||||
|
||||
@@ -160,7 +160,7 @@ class TeamsDashboardView(GenericAPIView):
|
||||
"team_memberships_url": reverse('team_membership_list', request=request),
|
||||
"my_teams_url": reverse('teams_list', request=request),
|
||||
"team_membership_detail_url": reverse('team_membership_detail', args=['team_id', user.username]),
|
||||
"languages": [[lang[0], _(lang[1])] for lang in settings.ALL_LANGUAGES], # pylint: disable=translation-of-non-string
|
||||
"languages": [[lang[0], _(lang[1])] for lang in settings.ALL_LANGUAGES],
|
||||
"countries": list(countries),
|
||||
"disable_courseware_js": True,
|
||||
"teams_base_url": reverse('teams_dashboard', request=request, kwargs={'course_id': course_id}),
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"""
|
||||
Exceptions for the verify student app
|
||||
"""
|
||||
# (Exception Class Names are sort of self-explanatory, so skipping docstring requirement)
|
||||
# pylint: disable=missing-docstring
|
||||
|
||||
|
||||
class WindowExpiredException(Exception):
|
||||
|
||||
@@ -1279,7 +1279,7 @@ class TestCheckoutWithEcommerceService(ModuleStoreTestCase):
|
||||
ecommerce api, we correctly call to that api to create a basket.
|
||||
"""
|
||||
user = UserFactory.create(username="test-username")
|
||||
course_mode = CourseModeFactory.create(sku="test-sku").to_tuple() # pylint: disable=no-member
|
||||
course_mode = CourseModeFactory.create(sku="test-sku").to_tuple()
|
||||
expected_payment_data = {'foo': 'bar'}
|
||||
# mock out the payment processors endpoint
|
||||
httpretty.register_uri(
|
||||
|
||||
@@ -453,8 +453,8 @@ class PayAndVerifyView(View):
|
||||
return url
|
||||
|
||||
def _redirect_if_necessary(
|
||||
self, message, already_verified, already_paid, is_enrolled, course_key, # pylint: disable=bad-continuation
|
||||
user_is_trying_to_pay, user, sku # pylint: disable=bad-continuation
|
||||
self, message, already_verified, already_paid, is_enrolled, course_key,
|
||||
user_is_trying_to_pay, user, sku
|
||||
):
|
||||
"""Redirect the user to a more appropriate page if necessary.
|
||||
|
||||
@@ -859,8 +859,8 @@ class SubmitPhotosView(View):
|
||||
"""
|
||||
|
||||
@method_decorator(transaction.non_atomic_requests)
|
||||
def dispatch(self, *args, **kwargs): # pylint: disable=missing-docstring
|
||||
return super(SubmitPhotosView, self).dispatch(*args, **kwargs)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(SubmitPhotosView, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(outer_atomic(read_committed=True))
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
set -e
|
||||
|
||||
export LOWER_PYLINT_THRESHOLD=1000
|
||||
export UPPER_PYLINT_THRESHOLD=3125
|
||||
export UPPER_PYLINT_THRESHOLD=2975
|
||||
export ESLINT_THRESHOLD=5590
|
||||
export STYLELINT_THRESHOLD=973
|
||||
|
||||
Reference in New Issue
Block a user