fix: bump pylint version (#31084)
This commit is contained in:
15
.github/workflows/pylint-checks.yml
vendored
15
.github/workflows/pylint-checks.yml
vendored
@@ -14,20 +14,19 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- module-name: lms-1
|
||||
path: "lms/djangoapps/badges/ lms/djangoapps/branding/ lms/djangoapps/bulk_email/ lms/djangoapps/bulk_enroll/ lms/djangoapps/bulk_user_retirement/ lms/djangoapps/ccx/ lms/djangoapps/certificates/ lms/djangoapps/commerce/ lms/djangoapps/course_api/ lms/djangoapps/course_blocks/ lms/djangoapps/course_home_api/ lms/djangoapps/course_wiki/ lms/djangoapps/coursewarehistoryextended/ lms/djangoapps/debug/ lms/djangoapps/courseware/ lms/djangoapps/course_goals/ lms/djangoapps/rss_proxy/ lms/djangoapps/save_for_later/"
|
||||
path: "--django-settings-module=lms.envs.test lms/djangoapps/badges/ lms/djangoapps/branding/ lms/djangoapps/bulk_email/ lms/djangoapps/bulk_enroll/ lms/djangoapps/bulk_user_retirement/ lms/djangoapps/ccx/ lms/djangoapps/certificates/ lms/djangoapps/commerce/ lms/djangoapps/course_api/ lms/djangoapps/course_blocks/ lms/djangoapps/course_home_api/ lms/djangoapps/course_wiki/ lms/djangoapps/coursewarehistoryextended/ lms/djangoapps/debug/ lms/djangoapps/courseware/ lms/djangoapps/course_goals/ lms/djangoapps/rss_proxy/ lms/djangoapps/save_for_later/"
|
||||
- module-name: lms-2
|
||||
path: "lms/djangoapps/gating/ lms/djangoapps/grades/ lms/djangoapps/instructor/ lms/djangoapps/instructor_analytics/ lms/djangoapps/discussion/ lms/djangoapps/edxnotes/ lms/djangoapps/email_marketing/ lms/djangoapps/experiments/ lms/djangoapps/instructor_task/ lms/djangoapps/learner_dashboard/ lms/djangoapps/learner_home/ lms/djangoapps/lms_initialization/ lms/djangoapps/lms_xblock/ lms/djangoapps/lti_provider/ lms/djangoapps/mailing/ lms/djangoapps/mobile_api/ lms/djangoapps/monitoring/ lms/djangoapps/ora_staff_grader/ lms/djangoapps/program_enrollments/ lms/djangoapps/rss_proxy lms/djangoapps/static_template_view/ lms/djangoapps/staticbook/ lms/djangoapps/support/ lms/djangoapps/survey/ lms/djangoapps/teams/ lms/djangoapps/tests/ lms/djangoapps/user_tours/ lms/djangoapps/verify_student/ lms/djangoapps/mfe_config_api/ lms/envs/ lms/lib/ lms/tests.py"
|
||||
path: "--django-settings-module=lms.envs.test lms/djangoapps/gating/ lms/djangoapps/grades/ lms/djangoapps/instructor/ lms/djangoapps/instructor_analytics/ lms/djangoapps/discussion/ lms/djangoapps/edxnotes/ lms/djangoapps/email_marketing/ lms/djangoapps/experiments/ lms/djangoapps/instructor_task/ lms/djangoapps/learner_dashboard/ lms/djangoapps/learner_home/ lms/djangoapps/lms_initialization/ lms/djangoapps/lms_xblock/ lms/djangoapps/lti_provider/ lms/djangoapps/mailing/ lms/djangoapps/mobile_api/ lms/djangoapps/monitoring/ lms/djangoapps/ora_staff_grader/ lms/djangoapps/program_enrollments/ lms/djangoapps/rss_proxy lms/djangoapps/static_template_view/ lms/djangoapps/staticbook/ lms/djangoapps/support/ lms/djangoapps/survey/ lms/djangoapps/teams/ lms/djangoapps/tests/ lms/djangoapps/user_tours/ lms/djangoapps/verify_student/ lms/djangoapps/mfe_config_api/ lms/envs/ lms/lib/ lms/tests.py"
|
||||
- module-name: openedx-1
|
||||
path: "openedx/core/types/ openedx/core/djangoapps/ace_common/ openedx/core/djangoapps/agreements/ openedx/core/djangoapps/api_admin/ openedx/core/djangoapps/auth_exchange/ openedx/core/djangoapps/bookmarks/ openedx/core/djangoapps/cache_toolbox/ openedx/core/djangoapps/catalog/ openedx/core/djangoapps/ccxcon/ openedx/core/djangoapps/commerce/ openedx/core/djangoapps/common_initialization/ openedx/core/djangoapps/common_views/ openedx/core/djangoapps/config_model_utils/ openedx/core/djangoapps/content/ openedx/core/djangoapps/content_libraries/ openedx/core/djangoapps/contentserver/ openedx/core/djangoapps/cookie_metadata/ openedx/core/djangoapps/cors_csrf/ openedx/core/djangoapps/course_apps/ openedx/core/djangoapps/course_date_signals/ openedx/core/djangoapps/course_groups/ openedx/core/djangoapps/courseware_api/ openedx/core/djangoapps/crawlers/ openedx/core/djangoapps/credentials/ openedx/core/djangoapps/credit/ openedx/core/djangoapps/dark_lang/ openedx/core/djangoapps/debug/ openedx/core/djangoapps/demographics/ openedx/core/djangoapps/discussions/ openedx/core/djangoapps/django_comment_common/ openedx/core/djangoapps/embargo/ openedx/core/djangoapps/enrollments/ openedx/core/djangoapps/external_user_ids/ openedx/core/djangoapps/zendesk_proxy/ openedx/core/djangolib/ openedx/core/lib/ openedx/core/tests/ openedx/core/djangoapps/course_live/"
|
||||
path: "--django-settings-module=lms.envs.test openedx/core/types/ openedx/core/djangoapps/ace_common/ openedx/core/djangoapps/agreements/ openedx/core/djangoapps/api_admin/ openedx/core/djangoapps/auth_exchange/ openedx/core/djangoapps/bookmarks/ openedx/core/djangoapps/cache_toolbox/ openedx/core/djangoapps/catalog/ openedx/core/djangoapps/ccxcon/ openedx/core/djangoapps/commerce/ openedx/core/djangoapps/common_initialization/ openedx/core/djangoapps/common_views/ openedx/core/djangoapps/config_model_utils/ openedx/core/djangoapps/content/ openedx/core/djangoapps/content_libraries/ openedx/core/djangoapps/contentserver/ openedx/core/djangoapps/cookie_metadata/ openedx/core/djangoapps/cors_csrf/ openedx/core/djangoapps/course_apps/ openedx/core/djangoapps/course_date_signals/ openedx/core/djangoapps/course_groups/ openedx/core/djangoapps/courseware_api/ openedx/core/djangoapps/crawlers/ openedx/core/djangoapps/credentials/ openedx/core/djangoapps/credit/ openedx/core/djangoapps/dark_lang/ openedx/core/djangoapps/debug/ openedx/core/djangoapps/demographics/ openedx/core/djangoapps/discussions/ openedx/core/djangoapps/django_comment_common/ openedx/core/djangoapps/embargo/ openedx/core/djangoapps/enrollments/ openedx/core/djangoapps/external_user_ids/ openedx/core/djangoapps/zendesk_proxy/ openedx/core/djangolib/ openedx/core/lib/ openedx/core/tests/ openedx/core/djangoapps/course_live/"
|
||||
- module-name: openedx-2
|
||||
path: "openedx/core/djangoapps/geoinfo/ openedx/core/djangoapps/header_control/ openedx/core/djangoapps/heartbeat/ openedx/core/djangoapps/lang_pref/ openedx/core/djangoapps/models/ openedx/core/djangoapps/monkey_patch/ openedx/core/djangoapps/oauth_dispatch/ openedx/core/djangoapps/olx_rest_api/ openedx/core/djangoapps/password_policy/ openedx/core/djangoapps/plugin_api/ openedx/core/djangoapps/plugins/ openedx/core/djangoapps/profile_images/ openedx/core/djangoapps/programs/ openedx/core/djangoapps/safe_sessions/ openedx/core/djangoapps/schedules/ openedx/core/djangoapps/service_status/ openedx/core/djangoapps/session_inactivity_timeout/ openedx/core/djangoapps/signals/ openedx/core/djangoapps/site_configuration/ openedx/core/djangoapps/system_wide_roles/ openedx/core/djangoapps/theming/ openedx/core/djangoapps/user_api/ openedx/core/djangoapps/user_authn/ openedx/core/djangoapps/util/ openedx/core/djangoapps/verified_track_content/ openedx/core/djangoapps/video_config/ openedx/core/djangoapps/video_pipeline/ openedx/core/djangoapps/waffle_utils/ openedx/core/djangoapps/xblock/ openedx/core/djangoapps/xmodule_django/ openedx/core/tests/ openedx/features/ openedx/testing/ openedx/tests/ openedx/core/djangoapps/learner_pathway/"
|
||||
path: "--django-settings-module=lms.envs.test openedx/core/djangoapps/geoinfo/ openedx/core/djangoapps/header_control/ openedx/core/djangoapps/heartbeat/ openedx/core/djangoapps/lang_pref/ openedx/core/djangoapps/models/ openedx/core/djangoapps/monkey_patch/ openedx/core/djangoapps/oauth_dispatch/ openedx/core/djangoapps/olx_rest_api/ openedx/core/djangoapps/password_policy/ openedx/core/djangoapps/plugin_api/ openedx/core/djangoapps/plugins/ openedx/core/djangoapps/profile_images/ openedx/core/djangoapps/programs/ openedx/core/djangoapps/safe_sessions/ openedx/core/djangoapps/schedules/ openedx/core/djangoapps/service_status/ openedx/core/djangoapps/session_inactivity_timeout/ openedx/core/djangoapps/signals/ openedx/core/djangoapps/site_configuration/ openedx/core/djangoapps/system_wide_roles/ openedx/core/djangoapps/theming/ openedx/core/djangoapps/user_api/ openedx/core/djangoapps/user_authn/ openedx/core/djangoapps/util/ openedx/core/djangoapps/verified_track_content/ openedx/core/djangoapps/video_config/ openedx/core/djangoapps/video_pipeline/ openedx/core/djangoapps/waffle_utils/ openedx/core/djangoapps/xblock/ openedx/core/djangoapps/xmodule_django/ openedx/core/tests/ openedx/features/ openedx/testing/ openedx/tests/ openedx/core/djangoapps/learner_pathway/"
|
||||
- module-name: common
|
||||
path: "common"
|
||||
path: "--django-settings-module=lms.envs.test common"
|
||||
- module-name: cms
|
||||
path: "cms"
|
||||
path: "--django-settings-module=cms.envs.test cms"
|
||||
- module-name: xmodule
|
||||
path: "xmodule"
|
||||
|
||||
path: "--django-settings-module=lms.envs.test xmodule"
|
||||
|
||||
name: pylint ${{ matrix.module-name }}
|
||||
steps:
|
||||
|
||||
@@ -83,7 +83,7 @@ class TestCourseListing(ModuleStoreTestCase):
|
||||
Reverse the setup
|
||||
"""
|
||||
self.client.logout()
|
||||
ModuleStoreTestCase.tearDown(self)
|
||||
ModuleStoreTestCase.tearDown(self) # pylint: disable=non-parent-method-called
|
||||
|
||||
def test_rerun(self):
|
||||
"""
|
||||
|
||||
@@ -87,7 +87,7 @@ class TestCourseListing(ModuleStoreTestCase):
|
||||
Reverse the setup
|
||||
"""
|
||||
self.client.logout()
|
||||
ModuleStoreTestCase.tearDown(self)
|
||||
ModuleStoreTestCase.tearDown(self) # pylint: disable=non-parent-method-called
|
||||
|
||||
def test_empty_course_listing(self):
|
||||
"""
|
||||
|
||||
@@ -62,7 +62,7 @@ class TestCourseAccess(ModuleStoreTestCase):
|
||||
Reverse the setup
|
||||
"""
|
||||
self.client.logout()
|
||||
ModuleStoreTestCase.tearDown(self)
|
||||
ModuleStoreTestCase.tearDown(self) # pylint: disable=non-parent-method-called
|
||||
|
||||
def test_get_all_users(self):
|
||||
"""
|
||||
|
||||
@@ -1206,10 +1206,10 @@ def settings_handler(request, course_key_string): # lint-amnesty, pylint: disab
|
||||
if is_prerequisite_courses_enabled():
|
||||
courses, in_process_course_actions = get_courses_accessible_to_user(request)
|
||||
# exclude current course from the list of available courses
|
||||
courses = (course for course in courses if course.id != course_key)
|
||||
courses = [course for course in courses if course.id != course_key]
|
||||
if courses:
|
||||
courses, __ = _process_courses_list(courses, in_process_course_actions)
|
||||
settings_context.update({'possible_pre_requisite_courses': list(courses)})
|
||||
settings_context.update({'possible_pre_requisite_courses': courses})
|
||||
|
||||
if credit_eligibility_enabled:
|
||||
if is_credit_course(course_key):
|
||||
|
||||
@@ -244,7 +244,7 @@ class ProctoringRequirementsEmailTests(EmailTemplateTagMixin, ModuleStoreTestCas
|
||||
self.course = None
|
||||
self.user = UserFactory()
|
||||
|
||||
@ddt.data('course_run_1', 'matt''s course', 'matt's run')
|
||||
@ddt.data('course_run_1', 'matt\'s course', 'matt's run')
|
||||
def test_send_proctoring_requirements_email(self, course_run_name):
|
||||
self.course = CourseFactory(
|
||||
display_name=course_run_name,
|
||||
|
||||
@@ -39,10 +39,10 @@ class BlockCountsTransformer(BlockStructureTransformer):
|
||||
|
||||
for block_key in block_structure.post_order_traversal():
|
||||
for block_type in self.block_types_to_count:
|
||||
descendants_type_count = sum([
|
||||
descendants_type_count = sum(
|
||||
block_structure.get_transformer_block_field(child_key, self, block_type, 0)
|
||||
for child_key in block_structure.get_children(block_key)
|
||||
])
|
||||
)
|
||||
block_structure.set_transformer_block_field(
|
||||
block_key,
|
||||
self,
|
||||
|
||||
@@ -96,15 +96,16 @@ class StartDateTransformer(FilteringTransformerMixin, BlockStructureTransformer)
|
||||
|
||||
now = datetime.now(UTC)
|
||||
|
||||
removal_condition = lambda block_key: not check_start_date(
|
||||
usage_info.user,
|
||||
block_structure.get_xblock_field(block_key, 'days_early_for_beta'),
|
||||
self._get_merged_start_date(block_structure, block_key),
|
||||
usage_info.course_key,
|
||||
now=now,
|
||||
)
|
||||
def _removal_condition(block_key):
|
||||
return not check_start_date(
|
||||
usage_info.user,
|
||||
block_structure.get_xblock_field(block_key, 'days_early_for_beta'),
|
||||
self._get_merged_start_date(block_structure, block_key),
|
||||
usage_info.course_key,
|
||||
now=now
|
||||
)
|
||||
|
||||
if usage_info.include_has_scheduled_content:
|
||||
self._check_has_scheduled_content(block_structure, removal_condition)
|
||||
self._check_has_scheduled_content(block_structure, _removal_condition)
|
||||
|
||||
return [block_structure.create_removal_filter(removal_condition)]
|
||||
return [block_structure.create_removal_filter(_removal_condition)]
|
||||
|
||||
@@ -799,8 +799,9 @@ def sort_by_announcement(courses):
|
||||
"""
|
||||
|
||||
# Sort courses by how far are they from they start day
|
||||
key = lambda course: course.sorting_score
|
||||
courses = sorted(courses, key=key)
|
||||
def _key(course):
|
||||
return course.sorting_score
|
||||
courses = sorted(courses, key=_key)
|
||||
|
||||
return courses
|
||||
|
||||
|
||||
@@ -2067,8 +2067,11 @@ class TestModuleTrackingContext(SharedModuleStoreTestCase):
|
||||
"""
|
||||
original_usage_key = UsageKey.from_string('block-v1:A+B+C+type@problem+block@abcd1234')
|
||||
original_usage_version = ObjectId()
|
||||
mock_get_original_usage = lambda _, key: (original_usage_key, original_usage_version)
|
||||
with patch('xmodule.modulestore.mixed.MixedModuleStore.get_block_original_usage', mock_get_original_usage):
|
||||
|
||||
def _mock_get_original_usage(_, __):
|
||||
return original_usage_key, original_usage_version
|
||||
|
||||
with patch('xmodule.modulestore.mixed.MixedModuleStore.get_block_original_usage', _mock_get_original_usage):
|
||||
module_info = self.handle_callback_and_get_module_info(mock_tracker)
|
||||
assert 'original_usage_key' in module_info
|
||||
assert module_info['original_usage_key'] == str(original_usage_key)
|
||||
|
||||
@@ -76,13 +76,16 @@ class TestComputeGrades(SharedModuleStoreTestCase):
|
||||
if not estimate_first_attempted:
|
||||
command.append('--no_estimate_first_attempted')
|
||||
call_command(*(command + courses))
|
||||
_kwargs = lambda course_key, offset: {
|
||||
'course_key': course_key,
|
||||
'batch_size': 2,
|
||||
'offset': offset,
|
||||
'estimate_first_attempted': estimate_first_attempted,
|
||||
'seq_id': ANY,
|
||||
}
|
||||
|
||||
def _kwargs(course_key, offset):
|
||||
return {
|
||||
'course_key': course_key,
|
||||
'batch_size': 2,
|
||||
'offset': offset,
|
||||
'estimate_first_attempted': estimate_first_attempted,
|
||||
'seq_id': ANY
|
||||
}
|
||||
|
||||
actual = mock_task.apply_async.call_args_list
|
||||
# Order doesn't matter, but can't use a set because dicts aren't hashable
|
||||
expected = [
|
||||
|
||||
@@ -438,8 +438,10 @@ class TestInstructorEnrollmentStudentModule(SharedModuleStoreTestCase):
|
||||
module_state_key=msk,
|
||||
state=original_state
|
||||
)
|
||||
# lambda to reload the module state from the database
|
||||
module = lambda: StudentModule.objects.get(student=self.user, course_id=self.course_key, module_state_key=msk)
|
||||
|
||||
def module():
|
||||
return StudentModule.objects.get(student=self.user, course_id=self.course_key, module_state_key=msk)
|
||||
|
||||
assert json.loads(module().state)['attempts'] == 32
|
||||
reset_student_attempts(self.course_key, self.user, msk, requesting_user=self.user)
|
||||
assert json.loads(module().state)['attempts'] == 0
|
||||
|
||||
@@ -343,8 +343,8 @@ def get_metadata_from_index(queryset, text_search=None):
|
||||
type=lib.type,
|
||||
description=metadata[i]['description'],
|
||||
version=metadata[i]['version'],
|
||||
allow_public_learning=queryset[i].allow_public_learning,
|
||||
allow_public_read=queryset[i].allow_public_read,
|
||||
allow_public_learning=lib.allow_public_learning,
|
||||
allow_public_read=lib.allow_public_read,
|
||||
num_blocks=metadata[i].get('num_blocks'),
|
||||
last_published=metadata[i].get('last_published'),
|
||||
has_unpublished_changes=metadata[i].get('has_unpublished_changes'),
|
||||
|
||||
@@ -122,7 +122,7 @@ class Model:
|
||||
def _update_from_response(self, response_data):
|
||||
for k, v in response_data.items():
|
||||
if k in self.accessible_fields:
|
||||
self.__setattr__(k, v)
|
||||
setattr(self, k, v)
|
||||
else:
|
||||
log.warning(
|
||||
"Unexpected field {field_name} in model {model_name}".format(
|
||||
|
||||
@@ -392,7 +392,7 @@ class ProgramProgressMeter:
|
||||
certificate
|
||||
)
|
||||
earliest_course_run_date = min(
|
||||
[date for date in [available_date, earliest_course_run_date] if date]
|
||||
date for date in [available_date, earliest_course_run_date] if date
|
||||
)
|
||||
|
||||
# If we're missing a cert for a course, the program isn't completed and we should just bail now
|
||||
@@ -400,7 +400,7 @@ class ProgramProgressMeter:
|
||||
return None
|
||||
|
||||
# Keep the catalog course date if it's the latest one
|
||||
program_available_date = max([date for date in [earliest_course_run_date, program_available_date] if date])
|
||||
program_available_date = max(date for date in [earliest_course_run_date, program_available_date] if date)
|
||||
|
||||
return program_available_date
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ class AuthFailedError(Exception):
|
||||
""" Returns a dict representation of the error. """
|
||||
resp = {'success': False}
|
||||
for attr in ('value', 'redirect', 'redirect_url', 'error_code', 'context'):
|
||||
if self.__getattribute__(attr):
|
||||
resp[attr] = self.__getattribute__(attr)
|
||||
if getattr(self, attr):
|
||||
resp[attr] = getattr(self, attr)
|
||||
|
||||
return resp
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ class CacheIsolationMixin:
|
||||
|
||||
cls.__old_settings.append(copy.deepcopy(settings.CACHES))
|
||||
override = override_settings(CACHES=cache_settings)
|
||||
override.__enter__()
|
||||
override.__enter__() # pylint: disable=unnecessary-dunder-call
|
||||
cls.__settings_overrides.append(override)
|
||||
|
||||
assert settings.CACHES == cache_settings
|
||||
|
||||
@@ -166,10 +166,10 @@ class EffortEstimationTransformer(BlockStructureTransformer):
|
||||
|
||||
def _gather_child_values(self, block_structure, block_key, field, default=0):
|
||||
"""Collects and sums all child values for field."""
|
||||
return sum([
|
||||
return sum(
|
||||
block_structure.get_xblock_field(child_key, field, default=default)
|
||||
for child_key in block_structure.get_children(block_key)
|
||||
])
|
||||
)
|
||||
|
||||
def _estimate_children_effort(self, _usage_info, block_structure, block_key):
|
||||
"""Collects time and activity counts for children."""
|
||||
|
||||
@@ -29,7 +29,8 @@ class SetDjangoSettingsChecker(BaseChecker):
|
||||
cms_module = False
|
||||
lms_module = False
|
||||
common_module = False
|
||||
for arg in self.linter.cmdline_parser.largs:
|
||||
arguments = self.linter.cmdline_parser.parse_args()[1]
|
||||
for arg in arguments:
|
||||
if arg.startswith('cms'):
|
||||
cms_module = True
|
||||
elif arg.startswith('lms'):
|
||||
|
||||
13
pylintrc
13
pylintrc
@@ -69,7 +69,7 @@
|
||||
[MASTER]
|
||||
ignore = ,.git,.tox,migrations,node_modules,.pycharm_helpers
|
||||
persistent = yes
|
||||
load-plugins = edx_lint.pylint,pylint_django_settings,pylint_django,pylint_celery,pylint_pytest
|
||||
load-plugins = edx_lint.pylint,pylint_django,pylint_celery,pylint_pytest
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
enable =
|
||||
@@ -286,7 +286,6 @@ disable =
|
||||
illegal-waffle-usage,
|
||||
|
||||
logging-fstring-interpolation,
|
||||
native-string,
|
||||
import-outside-toplevel,
|
||||
inconsistent-return-statements,
|
||||
no-else-break,
|
||||
@@ -308,8 +307,12 @@ disable =
|
||||
unused-argument,
|
||||
unsubscriptable-object,
|
||||
abstract-method,
|
||||
wrong-import-order,
|
||||
no-self-use,
|
||||
not-callable,
|
||||
unsupported-binary-operation,
|
||||
missing-timeout,
|
||||
c-extension-no-member,
|
||||
no-name-in-module,
|
||||
unnecessary-lambda-assignment,
|
||||
|
||||
[REPORTS]
|
||||
output-format = text
|
||||
@@ -406,4 +409,4 @@ int-import-graph =
|
||||
[EXCEPTIONS]
|
||||
overgeneral-exceptions = Exception
|
||||
|
||||
# 976a7bc58c47b2957e91b1632c6ea16e0112bc3b
|
||||
# 567bf30b121db79bc07a7028651f7efa0724e8a4
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# pylintrc tweaks for use with edx_lint.
|
||||
[MASTER]
|
||||
ignore+ = ,.git,.tox,migrations,node_modules,.pycharm_helpers
|
||||
load-plugins = edx_lint.pylint,pylint_django_settings,pylint_django,pylint_celery,pylint_pytest
|
||||
load-plugins = edx_lint.pylint,pylint_django,pylint_celery,pylint_pytest
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable+ =
|
||||
# Disable unicode-format-string until we can agree to turn it on.
|
||||
native-string,
|
||||
# Disable new refactoring suggestions for now, we have more important things to fix first
|
||||
import-outside-toplevel,
|
||||
inconsistent-return-statements,
|
||||
@@ -29,7 +27,12 @@ disable+ =
|
||||
unused-argument,
|
||||
unsubscriptable-object,
|
||||
abstract-method,
|
||||
no-self-use,
|
||||
not-callable,
|
||||
unsupported-binary-operation,
|
||||
missing-timeout,
|
||||
c-extension-no-member,
|
||||
no-name-in-module,
|
||||
unnecessary-lambda-assignment,
|
||||
|
||||
[BASIC]
|
||||
attr-rgx = [a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
@@ -52,9 +52,6 @@ django-webpack-loader==0.7.0
|
||||
# version of py2neo will work with Neo4j 3.5.
|
||||
py2neo<2022
|
||||
|
||||
# pylint==2.14.0 is causing test failures
|
||||
pylint==2.13.9
|
||||
|
||||
# scipy version 1.8 requires numpy>=1.17.3, we've pinned numpy to <1.17.0 in requirements/edx-sandbox/py38.in
|
||||
scipy<1.8.0
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ asn1crypto==1.5.1
|
||||
# -r requirements/edx/testing.txt
|
||||
# oscrypto
|
||||
# snowflake-connector-python
|
||||
astroid==2.11.7
|
||||
astroid==2.12.10
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# pylint
|
||||
@@ -1150,9 +1150,8 @@ pylatexenc==2.10
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# olxcleaner
|
||||
pylint==2.13.9
|
||||
pylint==2.15.3
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/testing.txt
|
||||
# edx-lint
|
||||
# pylint-celery
|
||||
@@ -1556,6 +1555,10 @@ tomli==2.0.1
|
||||
# pylint
|
||||
# pytest
|
||||
# tox
|
||||
tomlkit==0.11.5
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# pylint
|
||||
tox==3.26.0
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
|
||||
@@ -47,7 +47,7 @@ asn1crypto==1.5.1
|
||||
# -r requirements/edx/base.txt
|
||||
# oscrypto
|
||||
# snowflake-connector-python
|
||||
astroid==2.11.7
|
||||
astroid==2.12.10
|
||||
# via
|
||||
# pylint
|
||||
# pylint-celery
|
||||
@@ -1088,9 +1088,8 @@ pylatexenc==2.10
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# olxcleaner
|
||||
pylint==2.13.9
|
||||
pylint==2.15.3
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# edx-lint
|
||||
# pylint-celery
|
||||
# pylint-django
|
||||
@@ -1445,6 +1444,8 @@ tomli==2.0.1
|
||||
# pylint
|
||||
# pytest
|
||||
# tox
|
||||
tomlkit==0.11.5
|
||||
# via pylint
|
||||
tox==3.26.0
|
||||
# via
|
||||
# -r requirements/edx/testing.in
|
||||
|
||||
@@ -91,7 +91,7 @@ class CorrectMap(object):
|
||||
|
||||
"""
|
||||
# empty current dict
|
||||
self.__init__()
|
||||
self.__init__() # pylint: disable=unnecessary-dunder-call
|
||||
|
||||
if not correct_map:
|
||||
return
|
||||
|
||||
@@ -726,8 +726,8 @@ class ChoiceResponse(LoncapaResponse):
|
||||
edc_max_grade = len(all_choices)
|
||||
edc_current_grade = 0
|
||||
|
||||
good_answers = sum([1 for answer in student_answer if answer in self.correct_choices])
|
||||
good_non_answers = sum([1 for blank in student_non_answers if blank in self.incorrect_choices])
|
||||
good_answers = sum(1 for answer in student_answer if answer in self.correct_choices)
|
||||
good_non_answers = sum(1 for blank in student_non_answers if blank in self.incorrect_choices)
|
||||
edc_current_grade = good_answers + good_non_answers
|
||||
|
||||
return_grade = round_away_from_zero(self.get_max_score() * float(edc_current_grade) / float(edc_max_grade), 2)
|
||||
@@ -759,8 +759,8 @@ class ChoiceResponse(LoncapaResponse):
|
||||
|
||||
halves_error_count = 0
|
||||
|
||||
incorrect_answers = sum([1 for answer in student_answer if answer in self.incorrect_choices])
|
||||
missed_answers = sum([1 for blank in student_non_answers if blank in self.correct_choices])
|
||||
incorrect_answers = sum(1 for answer in student_answer if answer in self.incorrect_choices)
|
||||
missed_answers = sum(1 for blank in student_non_answers if blank in self.correct_choices)
|
||||
halves_error_count = incorrect_answers + missed_answers
|
||||
|
||||
if halves_error_count == 0:
|
||||
|
||||
@@ -970,7 +970,7 @@ class CodeResponseTest(ResponseTest): # pylint: disable=missing-class-docstring
|
||||
cmap = CorrectMap()
|
||||
for i, answer_id in enumerate(answer_ids):
|
||||
queuestate = CodeResponseTest.make_queuestate(i, datetime.now(UTC))
|
||||
cmap.update(CorrectMap(answer_id=answer_ids[i], queuestate=queuestate))
|
||||
cmap.update(CorrectMap(answer_id=answer_id, queuestate=queuestate))
|
||||
self.problem.correct_map.update(cmap)
|
||||
|
||||
assert self.problem.is_queued() is True
|
||||
@@ -986,7 +986,7 @@ class CodeResponseTest(ResponseTest): # pylint: disable=missing-class-docstring
|
||||
for i, answer_id in enumerate(answer_ids):
|
||||
queuekey = 1000 + i
|
||||
queuestate = CodeResponseTest.make_queuestate(queuekey, datetime.now(UTC))
|
||||
old_cmap.update(CorrectMap(answer_id=answer_ids[i], queuestate=queuestate))
|
||||
old_cmap.update(CorrectMap(answer_id=answer_id, queuestate=queuestate))
|
||||
|
||||
# Message format common to external graders
|
||||
grader_msg = '<span>MESSAGE</span>' # Must be valid XML
|
||||
@@ -1102,7 +1102,7 @@ class CodeResponseTest(ResponseTest): # pylint: disable=missing-class-docstring
|
||||
for i, answer_id in enumerate(answer_ids):
|
||||
queuekey = 1000 + i
|
||||
queuestate = CodeResponseTest.make_queuestate(queuekey, datetime.now(UTC))
|
||||
old_cmap.update(CorrectMap(answer_id=answer_ids[i], queuestate=queuestate))
|
||||
old_cmap.update(CorrectMap(answer_id=answer_id, queuestate=queuestate))
|
||||
|
||||
for grader_msg in valid_grader_msgs:
|
||||
correct_score_msg = json.dumps({'correct': True, 'score': 1, 'msg': grader_msg})
|
||||
|
||||
@@ -318,7 +318,7 @@ class ModuleStoreIsolationMixin(CacheIsolationMixin, SignalIsolationMixin):
|
||||
|
||||
cls.__old_modulestores.append(copy.deepcopy(settings.MODULESTORE))
|
||||
cls.__old_contentstores.append(copy.deepcopy(settings.CONTENTSTORE))
|
||||
override.__enter__()
|
||||
override.__enter__() # pylint: disable=unnecessary-dunder-call
|
||||
cls.__settings_overrides.append(override)
|
||||
XMODULE_FACTORY_LOCK.enable()
|
||||
clear_existing_modulestores()
|
||||
|
||||
@@ -465,9 +465,9 @@ class CourseComparisonTest(TestCase):
|
||||
actual_course_key, None, sort=('displayname', ModuleStoreEnum.SortOrder.descending)
|
||||
)
|
||||
assert len(expected_course_assets) == len(actual_course_assets)
|
||||
for idx, __ in enumerate(expected_course_assets):
|
||||
for idx, expected_val in enumerate(expected_course_assets):
|
||||
for attr in AssetMetadata.ATTRS_ALLOWED_TO_UPDATE:
|
||||
if attr in ('edited_on',):
|
||||
# edited_on is updated upon import.
|
||||
continue
|
||||
assert getattr(expected_course_assets[idx], attr) == getattr(actual_course_assets[idx], attr)
|
||||
assert getattr(expected_val, attr) == getattr(actual_course_assets[idx], attr)
|
||||
|
||||
@@ -86,9 +86,11 @@ DEFAULT_PUBLIC_VIEW_MESSAGE = (
|
||||
'Sign in or register, and enroll in this course to view it.'
|
||||
)
|
||||
|
||||
|
||||
# Make '_' a no-op so we can scrape strings. Using lambda instead of
|
||||
# `django.utils.translation.ugettext_noop` because Django cannot be imported in this file
|
||||
_ = lambda text: text
|
||||
def _(text):
|
||||
return text
|
||||
|
||||
|
||||
class OpaqueKeyReader(IdReader):
|
||||
@@ -1800,7 +1802,7 @@ class CombinedSystem:
|
||||
|
||||
"""
|
||||
context = context or {}
|
||||
return self.__getattr__('render')(block, view_name, context)
|
||||
return self.__getattr__('render')(block, view_name, context) # pylint: disable=unnecessary-dunder-call
|
||||
|
||||
def service(self, block, service_name):
|
||||
"""Return a service, or None.
|
||||
|
||||
Reference in New Issue
Block a user