diff --git a/.github/workflows/pylint-checks.yml b/.github/workflows/pylint-checks.yml
deleted file mode 100644
index 91141c0c29ed..000000000000
--- a/.github/workflows/pylint-checks.yml
+++ /dev/null
@@ -1,85 +0,0 @@
-name: Pylint Checks
-
-on:
- pull_request:
- merge_group:
- push:
- branches:
- - master
-
-jobs:
- run-pylint:
- runs-on: ubuntu-24.04
- strategy:
- fail-fast: false
- 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/"
- - 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/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/content_staging/ 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/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/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/envs/ openedx/core/djangoapps/notifications/ openedx/core/djangoapps/staticfiles/ openedx/core/djangoapps/content_tagging/ openedx/core/djangoapps/authz/"
- - module-name: common
- path: "common"
- - module-name: cms
- path: "cms"
- - module-name: xmodule
- path: "xmodule"
-
- name: pylint ${{ matrix.module-name }}
- steps:
- - name: Check out repo
- uses: actions/checkout@v6
-
- - name: Install required system packages
- run: sudo apt-get update && sudo apt-get install libxmlsec1-dev
-
- - name: Set up Python
- uses: actions/setup-python@v6
- with:
- python-version: 3.12
-
- - name: Get pip cache dir
- id: pip-cache-dir
- run: |
- echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
-
- - name: Cache pip dependencies
- id: cache-dependencies
- uses: actions/cache@v5
- with:
- path: ${{ steps.pip-cache-dir.outputs.dir }}
- key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/development.txt') }}
- restore-keys: ${{ runner.os }}-pip-
-
- - name: Install required Python dependencies
- run: |
- # dev-requirements is needed because the linter will otherwise
- # trip over some dev-only things like django-debug-toolbar
- # (import debug_toolbar) that aren't in testing.txt.
- make dev-requirements
- # After all requirements are installed, check that they're consistent with each other
- pip check
-
- - name: Run quality tests
- run: |
- pylint ${{ matrix.path }}
-
- # This job aggregates test results. It's the required check for branch protection.
- # https://github.com/marketplace/actions/alls-green#why
- # https://github.com/orgs/community/discussions/33579
- success:
- name: Pylint checks successful
- if: always()
- needs:
- - run-pylint
- runs-on: ubuntu-24.04
- steps:
- - name: Decide whether the needed jobs succeeded or failed
- # uses: re-actors/alls-green@v1.2.1
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
- with:
- jobs: ${{ toJSON(needs) }}
diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml
index b57b713eb93a..213bd860ce2a 100644
--- a/.github/workflows/quality-checks.yml
+++ b/.github/workflows/quality-checks.yml
@@ -6,11 +6,40 @@ on:
push:
branches:
- master
- - open-release/lilac.master
+ - release/**
jobs:
- run_tests:
- name: Quality Others
+ ruff:
+ name: Ruff
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Setup Python
+ uses: actions/setup-python@v6
+ with:
+ python-version: "3.12"
+
+ - name: Get pip cache dir
+ id: pip-cache-dir
+ run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
+
+ - name: Cache pip dependencies
+ uses: actions/cache@v5
+ with:
+ path: ${{ steps.pip-cache-dir.outputs.dir }}
+ key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/testing.txt') }}
+ restore-keys: ${{ runner.os }}-pip-
+
+ - name: Install quality requirements
+ run: pip install -r requirements/edx/testing.txt
+
+ - name: Run ruff
+ run: ruff check --output-format=github .
+
+ policy-checks:
+ name: Policy & Security Checks
+ needs: [ruff]
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -73,12 +102,11 @@ jobs:
run: |
pip install -e .
- - name: Run Quality Tests
+ - name: Run Policy Checks
env:
PIP_SRC: ${{ runner.temp }}
TARGET_BRANCH: ${{ github.base_ref }}
run: |
- ruff check --output-format=github .
make xsslint
make pii_check
make check_keywords
@@ -93,3 +121,82 @@ jobs:
test_root/log/**/*.log
*.log
overwrite: true
+
+ run-pylint:
+ needs: [ruff]
+ runs-on: ubuntu-24.04
+ strategy:
+ fail-fast: false
+ 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/"
+ - 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/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/content_staging/ 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/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/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/envs/ openedx/core/djangoapps/notifications/ openedx/core/djangoapps/staticfiles/ openedx/core/djangoapps/content_tagging/ openedx/core/djangoapps/authz/"
+ - module-name: common
+ path: "common"
+ - module-name: cms
+ path: "cms"
+ - module-name: xmodule
+ path: "xmodule"
+
+ name: pylint ${{ matrix.module-name }}
+ steps:
+ - name: Check out repo
+ uses: actions/checkout@v6
+
+ - name: Install required system packages
+ run: sudo apt-get update && sudo apt-get install libxmlsec1-dev
+
+ - name: Set up Python
+ uses: actions/setup-python@v6
+ with:
+ python-version: "3.12"
+
+ - name: Get pip cache dir
+ id: pip-cache-dir
+ run: |
+ echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
+
+ - name: Cache pip dependencies
+ id: cache-dependencies
+ uses: actions/cache@v5
+ with:
+ path: ${{ steps.pip-cache-dir.outputs.dir }}
+ key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/development.txt') }}
+ restore-keys: ${{ runner.os }}-pip-
+
+ - name: Install required Python dependencies
+ run: |
+ # dev-requirements is needed because the linter will otherwise
+ # trip over some dev-only things like django-debug-toolbar
+ # (import debug_toolbar) that aren't in testing.txt.
+ make dev-requirements
+ # After all requirements are installed, check that they're consistent with each other
+ pip check
+
+ - name: Run quality tests
+ run: |
+ pylint ${{ matrix.path }}
+
+ # This job aggregates test results. It's the required check for branch protection.
+ # https://github.com/marketplace/actions/alls-green#why
+ # https://github.com/orgs/community/discussions/33579
+ success:
+ name: Quality checks successful
+ if: always()
+ needs:
+ - ruff
+ - policy-checks
+ - run-pylint
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Decide whether the needed jobs succeeded or failed
+ # uses: re-actors/alls-green@v1.2.1
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
+ with:
+ jobs: ${{ toJSON(needs) }}
diff --git a/cms/djangoapps/api/v1/serializers/course_runs.py b/cms/djangoapps/api/v1/serializers/course_runs.py
index ab56ea40d341..84fca974730d 100644
--- a/cms/djangoapps/api/v1/serializers/course_runs.py
+++ b/cms/djangoapps/api/v1/serializers/course_runs.py
@@ -38,7 +38,7 @@ class CourseRunScheduleSerializer(serializers.Serializer): # lint-amnesty, pyli
enrollment_end = serializers.DateTimeField(allow_null=True, required=False)
-class CourseRunTeamSerializer(serializers.Serializer): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+class CourseRunTeamSerializer(serializers.Serializer): # pylint: disable=abstract-method, missing-class-docstring
def to_internal_value(self, data):
"""Overriding this to support deserialization, for write operations."""
for member in data:
@@ -61,7 +61,7 @@ def get_attribute(self, instance):
return instance
-class CourseRunTeamSerializerMixin(serializers.Serializer): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+class CourseRunTeamSerializerMixin(serializers.Serializer): # pylint: disable=abstract-method, missing-class-docstring
team = CourseRunTeamSerializer(required=False)
def update_team(self, instance, team): # lint-amnesty, pylint: disable=missing-function-docstring
@@ -100,7 +100,7 @@ def to_internal_value(self, data):
return data == 'self_paced'
-class CourseRunImageSerializer(serializers.Serializer): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+class CourseRunImageSerializer(serializers.Serializer): # pylint: disable=abstract-method, missing-class-docstring
# We set an empty default to prevent the parent serializer from attempting
# to save this value to the Course object.
card_image = CourseRunImageField(source='course_image', default=empty)
@@ -121,7 +121,7 @@ class CourseRunSerializerCommonFieldsMixin(serializers.Serializer): # lint-amne
choices=((False, 'instructor_paced'), (True, 'self_paced'),))
-class CourseRunSerializer(CourseRunSerializerCommonFieldsMixin, CourseRunTeamSerializerMixin, serializers.Serializer): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+class CourseRunSerializer(CourseRunSerializerCommonFieldsMixin, CourseRunTeamSerializerMixin, serializers.Serializer): # pylint: disable=abstract-method, missing-class-docstring
id = serializers.CharField(read_only=True)
title = serializers.CharField(source='display_name')
images = CourseRunImageSerializer(source='*', required=False)
@@ -155,7 +155,7 @@ def create(self, validated_data):
return instance
-class CourseRunRerunSerializer(CourseRunSerializerCommonFieldsMixin, CourseRunTeamSerializerMixin, # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+class CourseRunRerunSerializer(CourseRunSerializerCommonFieldsMixin, CourseRunTeamSerializerMixin, # pylint: disable=abstract-method, missing-class-docstring
serializers.Serializer):
title = serializers.CharField(source='display_name', required=False)
number = serializers.CharField(source='id.course', required=False)
@@ -200,7 +200,7 @@ def update(self, instance, validated_data):
return course_run
-class CourseCloneSerializer(serializers.Serializer): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+class CourseCloneSerializer(serializers.Serializer): # pylint: disable=abstract-method, missing-class-docstring
source_course_id = serializers.CharField()
destination_course_id = serializers.CharField()
diff --git a/cms/djangoapps/api/v1/tests/test_views/test_course_runs.py b/cms/djangoapps/api/v1/tests/test_views/test_course_runs.py
index 4de6209e3729..eaeb9732340d 100644
--- a/cms/djangoapps/api/v1/tests/test_views/test_course_runs.py
+++ b/cms/djangoapps/api/v1/tests/test_views/test_course_runs.py
@@ -344,7 +344,7 @@ def test_rerun(self, pacing_type, expected_self_paced_value, number):
user = UserFactory()
role = 'instructor'
run = '3T2017'
- url = reverse('api:v1:course_run-rerun', kwargs={'pk': str(original_course_run.id)}) # lint-amnesty, pylint: disable=no-member
+ url = reverse('api:v1:course_run-rerun', kwargs={'pk': str(original_course_run.id)}) # pylint: disable=no-member
data = {
'run': run,
'schedule': {
@@ -383,7 +383,7 @@ def test_rerun(self, pacing_type, expected_self_paced_value, number):
self.assert_course_access_role_count(course_run, 1)
course_orgs = get_course_organizations(course_run_key)
self.assertEqual(len(course_orgs), 1) # noqa: PT009
- self.assertEqual(course_orgs[0]['short_name'], original_course_run.id.org) # lint-amnesty, pylint: disable=no-member # noqa: PT009
+ self.assertEqual(course_orgs[0]['short_name'], original_course_run.id.org) # pylint: disable=no-member # noqa: PT009
def test_rerun_duplicate_run(self):
course_run = ToyCourseFactory()
diff --git a/cms/djangoapps/api/v1/views/course_runs.py b/cms/djangoapps/api/v1/views/course_runs.py
index 065714a51218..f9f2f4cbabf2 100644
--- a/cms/djangoapps/api/v1/views/course_runs.py
+++ b/cms/djangoapps/api/v1/views/course_runs.py
@@ -53,7 +53,7 @@ def retrieve(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=u
serializer = self.get_serializer(course_run)
return Response(serializer.data)
- def update(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=missing-function-docstring, unused-argument
+ def update(self, request, *args, **kwargs): # pylint: disable=missing-function-docstring, unused-argument
course_run = self.get_object()
partial = kwargs.pop('partial', False)
@@ -77,7 +77,7 @@ def create(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=unu
methods=['post', 'put'],
parser_classes=(parsers.FormParser, parsers.MultiPartParser,),
serializer_class=CourseRunImageSerializer)
- def images(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=missing-function-docstring, unused-argument
+ def images(self, request, *args, **kwargs): # pylint: disable=missing-function-docstring, unused-argument
course_run = self.get_object()
serializer = CourseRunImageSerializer(course_run, data=request.data, context=self.get_serializer_context())
serializer.is_valid(raise_exception=True)
@@ -85,7 +85,7 @@ def images(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=mis
return Response(serializer.data)
@action(detail=True, methods=['post'])
- def rerun(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=missing-function-docstring, unused-argument
+ def rerun(self, request, *args, **kwargs): # pylint: disable=missing-function-docstring, unused-argument
course_run = self.get_object()
serializer = CourseRunRerunSerializer(course_run, data=request.data, context=self.get_serializer_context())
serializer.is_valid(raise_exception=True)
diff --git a/cms/djangoapps/contentstore/api/views/course_quality.py b/cms/djangoapps/contentstore/api/views/course_quality.py
index 1f51622cb4ab..acc276c018dd 100644
--- a/cms/djangoapps/contentstore/api/views/course_quality.py
+++ b/cms/djangoapps/contentstore/api/views/course_quality.py
@@ -135,7 +135,7 @@ def _execute_method_and_log_time(log_time, func, *args):
return Response(response)
- def _required_course_depth(self, request, all_requested): # lint-amnesty, pylint: disable=missing-function-docstring
+ def _required_course_depth(self, request, all_requested): # pylint: disable=missing-function-docstring
if get_bool_param(request, 'units', all_requested):
# The num_blocks metric for "units" requires retrieving all blocks in the graph.
return None
diff --git a/cms/djangoapps/contentstore/asset_storage_handlers.py b/cms/djangoapps/contentstore/asset_storage_handlers.py
index 06a76a904fcf..35b4061ded50 100644
--- a/cms/djangoapps/contentstore/asset_storage_handlers.py
+++ b/cms/djangoapps/contentstore/asset_storage_handlers.py
@@ -269,7 +269,7 @@ def _assets_json(request, course_key):
assets_usage_locations_map = _get_asset_usage_path(course_key, assets)
- if request_options['requested_page'] > 0 and first_asset_to_display_index >= total_count and total_count > 0: # lint-amnesty, pylint: disable=chained-comparison
+ if request_options['requested_page'] > 0 and first_asset_to_display_index >= total_count and total_count > 0: # pylint: disable=chained-comparison
_update_options_to_requery_final_page(query_options, total_count)
current_page = query_options['current_page']
first_asset_to_display_index = _get_first_asset_index(current_page, requested_page_size)
@@ -735,7 +735,7 @@ def _check_existence_and_get_asset_content(asset_key): # lint-amnesty, pylint:
raise AssetNotFoundException # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
-def _delete_thumbnail(thumbnail_location, course_key, asset_key): # lint-amnesty, pylint: disable=missing-function-docstring
+def _delete_thumbnail(thumbnail_location, course_key, asset_key): # pylint: disable=missing-function-docstring
if thumbnail_location is not None:
# We are ignoring the value of the thumbnail_location-- we only care whether
diff --git a/cms/djangoapps/contentstore/config/waffle.py b/cms/djangoapps/contentstore/config/waffle.py
index 40d11817667e..9169e7f11472 100644
--- a/cms/djangoapps/contentstore/config/waffle.py
+++ b/cms/djangoapps/contentstore/config/waffle.py
@@ -32,6 +32,6 @@
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2021-07-12
# .. toggle_target_removal_date: 2021-12-31
-# .. toggle_warning: Flag course_experience.relative_dates should also be active for relative dates functionalities to work.
+# .. toggle_warning: Flag course_experience.relative_dates should also be active for relative dates functionalities to work. # noqa: E501
# .. toggle_tickets: https://openedx.atlassian.net/browse/AA-844
CUSTOM_RELATIVE_DATES = CourseWaffleFlag(f'{WAFFLE_NAMESPACE}.custom_relative_dates', __name__)
diff --git a/cms/djangoapps/contentstore/course_group_config.py b/cms/djangoapps/contentstore/course_group_config.py
index 2cbab53a6e6e..6126b6785805 100644
--- a/cms/djangoapps/contentstore/course_group_config.py
+++ b/cms/djangoapps/contentstore/course_group_config.py
@@ -67,7 +67,7 @@ def parse(json_string):
try:
configuration = json.loads(json_string.decode("utf-8"))
except ValueError:
- raise GroupConfigurationsValidationError(_("invalid JSON")) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise GroupConfigurationsValidationError(_("invalid JSON")) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
configuration["version"] = UserPartition.VERSION
return configuration
@@ -116,7 +116,7 @@ def get_user_partition(self):
try:
return UserPartition.from_json(self.configuration)
except ReadOnlyUserPartitionError:
- raise GroupConfigurationsValidationError(_("unable to load this type of group configuration")) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise GroupConfigurationsValidationError(_("unable to load this type of group configuration")) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
@staticmethod
def _get_usage_dict(course, unit, block, scheme_name=None):
diff --git a/cms/djangoapps/contentstore/courseware_index.py b/cms/djangoapps/contentstore/courseware_index.py
index 3061907a847d..0d4e5b08f19f 100644
--- a/cms/djangoapps/contentstore/courseware_index.py
+++ b/cms/djangoapps/contentstore/courseware_index.py
@@ -114,7 +114,7 @@ def remove_deleted_items(cls, searcher, structure_key, exclude_items):
searcher.remove(result_ids)
@classmethod
- def index(cls, modulestore, structure_key, triggered_at=None, reindex_age=REINDEX_AGE, timeout=INDEXING_REQUEST_TIMEOUT): # lint-amnesty, pylint: disable=line-too-long, too-many-statements
+ def index(cls, modulestore, structure_key, triggered_at=None, reindex_age=REINDEX_AGE, timeout=INDEXING_REQUEST_TIMEOUT): # pylint: disable=too-many-statements # noqa: E501
"""
Process course for indexing
@@ -630,7 +630,7 @@ def index_about_information(cls, modulestore, course):
# Broad exception handler so that a single bad property does not scupper the collection of others
try:
section_content = about_information.get_value(**about_context)
- except: # pylint: disable=bare-except
+ except: # noqa: E722
section_content = None
log.warning(
"Course discovery could not collect property %s for course %s",
diff --git a/cms/djangoapps/contentstore/exams.py b/cms/djangoapps/contentstore/exams.py
index 5a35d3fbe9f8..384dd1041e7a 100644
--- a/cms/djangoapps/contentstore/exams.py
+++ b/cms/djangoapps/contentstore/exams.py
@@ -33,7 +33,7 @@ def register_exams(course_key):
course = modulestore().get_course(course_key)
if course is None:
- raise ItemNotFoundError("Course {} does not exist", str(course_key)) # lint-amnesty, pylint: disable=raising-format-tuple
+ raise ItemNotFoundError("Course {} does not exist", str(course_key)) # pylint: disable=raising-format-tuple
# get all sequences, since they can be marked as timed/proctored exams
_timed_exams = modulestore().get_items(
diff --git a/cms/djangoapps/contentstore/git_export_utils.py b/cms/djangoapps/contentstore/git_export_utils.py
index 5f1c7877c4b2..1e63dd0ced7d 100644
--- a/cms/djangoapps/contentstore/git_export_utils.py
+++ b/cms/djangoapps/contentstore/git_export_utils.py
@@ -136,7 +136,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
root_dir, course_dir)
except (OSError, AttributeError):
log.exception('Failed export to xml')
- raise GitExportError(GitExportError.XML_EXPORT_FAIL) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise GitExportError(GitExportError.XML_EXPORT_FAIL) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
# Get current branch if not already set
if not branch:
diff --git a/cms/djangoapps/contentstore/management/commands/create_course.py b/cms/djangoapps/contentstore/management/commands/create_course.py
index 86e88beef774..1940c0dfc334 100644
--- a/cms/djangoapps/contentstore/management/commands/create_course.py
+++ b/cms/djangoapps/contentstore/management/commands/create_course.py
@@ -52,7 +52,7 @@ def get_user(self, user):
try:
user_object = user_from_str(user)
except User.DoesNotExist:
- raise CommandError(f"No user {user} found.") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError(f"No user {user} found.") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
return user_object
def handle(self, *args, **options):
diff --git a/cms/djangoapps/contentstore/management/commands/delete_course.py b/cms/djangoapps/contentstore/management/commands/delete_course.py
index 8a64c64e26fe..729159278511 100644
--- a/cms/djangoapps/contentstore/management/commands/delete_course.py
+++ b/cms/djangoapps/contentstore/management/commands/delete_course.py
@@ -67,7 +67,7 @@ def handle(self, *args, **options):
course_key = str(options['course_key'])
course_key = CourseKey.from_string(course_key)
except InvalidKeyError:
- raise CommandError('Invalid course_key: {}'.format(options['course_key'])) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError('Invalid course_key: {}'.format(options['course_key'])) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
if not modulestore().get_course(course_key):
raise CommandError('Course not found: {}'.format(options['course_key']))
@@ -80,6 +80,6 @@ def handle(self, *args, **options):
if options['remove_assets']:
contentstore().delete_all_course_assets(course_key)
- print(f'Deleted assets for course {course_key}') # lint-amnesty, pylint: disable=too-many-format-args
+ print(f'Deleted assets for course {course_key}') # pylint: disable=too-many-format-args
print(f'Deleted course {course_key}')
diff --git a/cms/djangoapps/contentstore/management/commands/export.py b/cms/djangoapps/contentstore/management/commands/export.py
index 76644d2d650b..e7f592e3b8b0 100644
--- a/cms/djangoapps/contentstore/management/commands/export.py
+++ b/cms/djangoapps/contentstore/management/commands/export.py
@@ -32,7 +32,7 @@ def handle(self, *args, **options):
try:
course_key = CourseKey.from_string(options['course_id'])
except InvalidKeyError:
- raise CommandError("Invalid course_key: '%s'." % options['course_id']) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, UP031
+ raise CommandError("Invalid course_key: '%s'." % options['course_id']) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501, UP031
if not modulestore().get_course(course_key):
raise CommandError("Course with %s key not found." % options['course_id']) # noqa: UP031
diff --git a/cms/djangoapps/contentstore/management/commands/export_content_library.py b/cms/djangoapps/contentstore/management/commands/export_content_library.py
index 7a6d4cfd2599..bbb21f667449 100644
--- a/cms/djangoapps/contentstore/management/commands/export_content_library.py
+++ b/cms/djangoapps/contentstore/management/commands/export_content_library.py
@@ -34,7 +34,7 @@ def handle(self, *args, **options):
try:
library_key = CourseKey.from_string(options['library_id'])
except InvalidKeyError:
- raise CommandError('Invalid library ID: "{}".'.format(options['library_id'])) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError('Invalid library ID: "{}".'.format(options['library_id'])) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
if not isinstance(library_key, LibraryLocator):
raise CommandError('Argument "{}" is not a library key'.format(options['library_id']))
@@ -50,7 +50,7 @@ def handle(self, *args, **options):
# Generate archive using the handy tasks implementation
tarball = tasks.create_export_tarball(library, library_key, {}, None)
except Exception as e:
- raise CommandError(f'Failed to export "{library_key}" with "{e}"') # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError(f'Failed to export "{library_key}" with "{e}"') # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
with tarball:
# Save generated archive with keyed filename
prefix, suffix, n = str(library_key).replace(':', '+'), '.tar.gz', 0
diff --git a/cms/djangoapps/contentstore/management/commands/export_olx.py b/cms/djangoapps/contentstore/management/commands/export_olx.py
index 6abed6bd043a..5064737eb7ce 100644
--- a/cms/djangoapps/contentstore/management/commands/export_olx.py
+++ b/cms/djangoapps/contentstore/management/commands/export_olx.py
@@ -49,7 +49,7 @@ def handle(self, *args, **options):
except InvalidKeyError:
raise CommandError("Unparsable course_id") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
except IndexError:
- raise CommandError("Insufficient arguments") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError("Insufficient arguments") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
filename = options['output']
pipe_results = False
diff --git a/cms/djangoapps/contentstore/management/commands/generate_courses.py b/cms/djangoapps/contentstore/management/commands/generate_courses.py
index b1a2889a31a5..b87d2de4b6c3 100644
--- a/cms/djangoapps/contentstore/management/commands/generate_courses.py
+++ b/cms/djangoapps/contentstore/management/commands/generate_courses.py
@@ -35,7 +35,7 @@ def handle(self, *args, **options):
except ValueError:
raise CommandError("Invalid JSON object") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
except KeyError:
- raise CommandError("JSON object is missing courses list") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError("JSON object is missing courses list") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
for course_settings in courses:
# Validate course
@@ -112,7 +112,7 @@ def _process_course_fields(self, fields):
fields[field] = Date().from_json(date_json)
logger.info(field + " has been set to " + date_json)
except Exception: # pylint: disable=broad-except
- logger.info("The date string could not be parsed for " + field) # lint-amnesty, pylint: disable=logging-not-lazy
+ logger.info("The date string could not be parsed for " + field) # pylint: disable=logging-not-lazy
del fields[field]
elif field in course_tab_list_fields:
# Generate CourseTabList object from the json value
@@ -121,11 +121,11 @@ def _process_course_fields(self, fields):
fields[field] = CourseTabList().from_json(course_tab_list_json)
logger.info(field + " has been set to " + course_tab_list_json)
except Exception: # pylint: disable=broad-except
- logger.info("The course tab list string could not be parsed for " + field) # lint-amnesty, pylint: disable=logging-not-lazy
+ logger.info("The course tab list string could not be parsed for " + field) # pylint: disable=logging-not-lazy
del fields[field]
else:
# CourseField is valid and has been set
- logger.info(field + " has been set to " + str(fields[field])) # lint-amnesty, pylint: disable=logging-not-lazy
+ logger.info(field + " has been set to " + str(fields[field])) # pylint: disable=logging-not-lazy
for field in all_fields:
if field not in fields:
@@ -156,7 +156,7 @@ def _course_is_valid(self, course):
if "fields" in course:
for setting in required_field_settings:
if setting not in course["fields"]:
- logger.warning("Fields json is missing " + setting) # lint-amnesty, pylint: disable=logging-not-lazy
+ logger.warning("Fields json is missing " + setting) # pylint: disable=logging-not-lazy
is_valid = False
return is_valid
diff --git a/cms/djangoapps/contentstore/management/commands/git_export.py b/cms/djangoapps/contentstore/management/commands/git_export.py
index a8193f8e3409..1c2a21535603 100644
--- a/cms/djangoapps/contentstore/management/commands/git_export.py
+++ b/cms/djangoapps/contentstore/management/commands/git_export.py
@@ -50,7 +50,7 @@ def handle(self, *args, **options):
try:
course_key = CourseKey.from_string(options['course_loc'])
except InvalidKeyError:
- raise CommandError(str(git_export_utils.GitExportError.BAD_COURSE)) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError(str(git_export_utils.GitExportError.BAD_COURSE)) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
try:
git_export_utils.export_to_git(
diff --git a/cms/djangoapps/contentstore/management/commands/reindex_course.py b/cms/djangoapps/contentstore/management/commands/reindex_course.py
index e9d97ab91c33..826d9ced9d32 100644
--- a/cms/djangoapps/contentstore/management/commands/reindex_course.py
+++ b/cms/djangoapps/contentstore/management/commands/reindex_course.py
@@ -60,7 +60,7 @@ def _parse_course_key(self, raw_value):
try:
result = CourseKey.from_string(raw_value)
except InvalidKeyError:
- raise CommandError("Invalid course_key: '%s'." % raw_value) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, UP031
+ raise CommandError("Invalid course_key: '%s'." % raw_value) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501, UP031
if not isinstance(result, CourseLocator):
raise CommandError(f"Argument {raw_value} is not a course key")
diff --git a/cms/djangoapps/contentstore/management/commands/replace_v1_lib_refs_with_v2_in_courses.py b/cms/djangoapps/contentstore/management/commands/replace_v1_lib_refs_with_v2_in_courses.py
index 20d9e11bb14e..85a6f8f9a617 100644
--- a/cms/djangoapps/contentstore/management/commands/replace_v1_lib_refs_with_v2_in_courses.py
+++ b/cms/djangoapps/contentstore/management/commands/replace_v1_lib_refs_with_v2_in_courses.py
@@ -62,7 +62,7 @@ def replace_all_library_source_blocks_ids(self, v1_to_v2_lib_map):
def validate(self, v1_to_v2_lib_map):
""" Validate that replace_all_library_source_blocks_ids was successful"""
course_id_strings = list(CourseOverview.get_all_course_keys())
- tasks = group(validate_all_library_source_blocks_ids_for_course.s(course_id, v1_to_v2_lib_map) for course_id in course_id_strings) # lint-amnesty, pylint: disable=line-too-long
+ tasks = group(validate_all_library_source_blocks_ids_for_course.s(course_id, v1_to_v2_lib_map) for course_id in course_id_strings) # noqa: E501
results = tasks.apply_async()
validation = set()
diff --git a/cms/djangoapps/contentstore/management/commands/sync_courses.py b/cms/djangoapps/contentstore/management/commands/sync_courses.py
index 75b4e4988a92..be24260a5618 100644
--- a/cms/djangoapps/contentstore/management/commands/sync_courses.py
+++ b/cms/djangoapps/contentstore/management/commands/sync_courses.py
@@ -36,7 +36,7 @@ def get_user(self, user):
try:
user_object = user_from_str(user)
except User.DoesNotExist:
- raise CommandError(f"No user {user} found.") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CommandError(f"No user {user} found.") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
return user_object
def handle(self, *args, **options):
diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_export_all_courses.py b/cms/djangoapps/contentstore/management/commands/tests/test_export_all_courses.py
index 71904e997c15..84fcfbcd67fe 100644
--- a/cms/djangoapps/contentstore/management/commands/tests/test_export_all_courses.py
+++ b/cms/djangoapps/contentstore/management/commands/tests/test_export_all_courses.py
@@ -27,7 +27,7 @@ class ExportAllCourses(ModuleStoreTestCase):
def setUp(self):
""" Common setup. """
super().setUp()
- self.store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) # lint-amnesty, pylint: disable=protected-access
+ self.store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) # pylint: disable=protected-access
self.temp_dir = mkdtemp()
self.addCleanup(shutil.rmtree, self.temp_dir)
self.first_course = CourseFactory.create(
diff --git a/cms/djangoapps/contentstore/proctoring.py b/cms/djangoapps/contentstore/proctoring.py
index 7a6e120c9721..7e00327eeea7 100644
--- a/cms/djangoapps/contentstore/proctoring.py
+++ b/cms/djangoapps/contentstore/proctoring.py
@@ -41,7 +41,7 @@ def register_special_exams(course_key):
course = modulestore().get_course(course_key)
if course is None:
- raise ItemNotFoundError("Course {} does not exist", str(course_key)) # lint-amnesty, pylint: disable=raising-format-tuple
+ raise ItemNotFoundError("Course {} does not exist", str(course_key)) # pylint: disable=raising-format-tuple
if not course.enable_proctored_exams and not course.enable_timed_exams:
# likewise if course does not have these features turned on
diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_group_configurations.py b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_group_configurations.py
index 496a50437104..094e545e3e12 100644
--- a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_group_configurations.py
+++ b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_group_configurations.py
@@ -38,7 +38,7 @@ def test_success_response(self):
"First name",
"First description",
[Group(0, "Group A"), Group(1, "Group B"), Group(2, "Group C")],
- ), # lint-amnesty, pylint: disable=line-too-long
+ ),
]
self.save_course()
diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_videos.py b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_videos.py
index 9da850244ccc..00edb50aad3b 100644
--- a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_videos.py
+++ b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_videos.py
@@ -120,14 +120,14 @@ def test_VideoTranscriptEnabledFlag_enabled(self):
str(self.course.id)
)
self.assertIn("transcript_preferences_handler_url", transcript_settings) # noqa: PT009
- self.assertEqual(expected_preference_handler, transcript_settings["transcript_preferences_handler_url"]) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(expected_preference_handler, transcript_settings["transcript_preferences_handler_url"]) # noqa: PT009
expected_credentials_handler = reverse_course_url(
'transcript_credentials_handler',
str(self.course.id)
)
self.assertIn("transcript_credentials_handler_url", transcript_settings) # noqa: PT009
- self.assertEqual(expected_credentials_handler, transcript_settings["transcript_credentials_handler_url"]) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(expected_credentials_handler, transcript_settings["transcript_credentials_handler_url"]) # noqa: PT009
with patch(
'openedx.core.djangoapps.video_config.toggles.XPERT_TRANSLATIONS_UI.is_enabled'
) as xpertTranslationfeature:
diff --git a/cms/djangoapps/contentstore/rest_api/v2/views/tests/test_downstreams.py b/cms/djangoapps/contentstore/rest_api/v2/views/tests/test_downstreams.py
index 149732437215..18a0fafa658e 100644
--- a/cms/djangoapps/contentstore/rest_api/v2/views/tests/test_downstreams.py
+++ b/cms/djangoapps/contentstore/rest_api/v2/views/tests/test_downstreams.py
@@ -127,7 +127,7 @@ def setUp(self):
self._publish_container(self.top_level_unit_id_2)
self._publish_container(self.top_level_subsection_id)
self._publish_container(self.top_level_section_id)
- self.mock_upstream_link = f"{settings.COURSE_AUTHORING_MICROFRONTEND_URL}/library/{self.library_id}/components?usageKey={self.video_lib_id}" # pylint: disable=line-too-long # noqa: E501
+ self.mock_upstream_link = f"{settings.COURSE_AUTHORING_MICROFRONTEND_URL}/library/{self.library_id}/components?usageKey={self.video_lib_id}" # noqa: E501
self.course = CourseFactory.create()
add_users(self.superuser, CourseStaffRole(self.course.id), self.course_user)
chapter = BlockFactory.create(category='chapter', parent=self.course)
diff --git a/cms/djangoapps/contentstore/signals/handlers.py b/cms/djangoapps/contentstore/signals/handlers.py
index 53476d0eb43a..8c9c6df4ae1c 100644
--- a/cms/djangoapps/contentstore/signals/handlers.py
+++ b/cms/djangoapps/contentstore/signals/handlers.py
@@ -75,7 +75,7 @@ def wrapper(*args, **kwargs):
return task_decorator
-def _create_catalog_data_for_signal(course_key: CourseKey) -> (Optional[datetime], Optional[CourseCatalogData]): # noqa: UP045 # pylint: disable=line-too-long
+def _create_catalog_data_for_signal(course_key: CourseKey) -> (Optional[datetime], Optional[CourseCatalogData]): # noqa: UP045
"""
Creates data for catalog-info-changed signal when course is published.
diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py
index b73800053288..746b5e0eb227 100644
--- a/cms/djangoapps/contentstore/tasks.py
+++ b/cms/djangoapps/contentstore/tasks.py
@@ -437,7 +437,7 @@ def create_export_tarball(course_block, course_key, context, status=None):
if parent_loc is not None:
parent = modulestore().get_item(parent_loc)
- except: # pylint: disable=bare-except
+ except: # noqa: E722
# if we have a nested exception, then we'll show the more generic error message
pass
@@ -525,7 +525,7 @@ def sync_discussion_settings(course_key, user):
fields = ["enable_graded_units", "unit_level_visibility", "enable_in_context", "posting_restrictions"]
# Plugin configuration is stored in the course settings under the provider name.
- field_mappings = dict(zip(fields, fields)) | {"plugin_configuration": discussion_config.provider_type} # noqa: B905 # pylint: disable=line-too-long
+ field_mappings = dict(zip(fields, fields)) | {"plugin_configuration": discussion_config.provider_type} # noqa: B905
for attr_name, settings_key in field_mappings.items():
if settings_key in discussion_settings:
@@ -1007,7 +1007,7 @@ def validate_all_library_source_blocks_ids_for_course(course_key_string, v1_to_v
@shared_task(time_limit=30)
@set_code_owner_attribute
-def replace_all_library_source_blocks_ids_for_course(course_key_string, v1_to_v2_lib_map): # lint-amnesty, pylint: disable=useless-return
+def replace_all_library_source_blocks_ids_for_course(course_key_string, v1_to_v2_lib_map): # pylint: disable=useless-return
"""Search a Modulestore for all library source blocks in a course by querying mongo.
replace all source_library_ids with the corresponding v2 value from the map.
@@ -1066,7 +1066,7 @@ def replace_all_library_source_blocks_ids_for_course(course_key_string, v1_to_v2
@shared_task(time_limit=30)
@set_code_owner_attribute
-def undo_all_library_source_blocks_ids_for_course(course_key_string, v1_to_v2_lib_map): # lint-amnesty, pylint: disable=useless-return
+def undo_all_library_source_blocks_ids_for_course(course_key_string, v1_to_v2_lib_map): # pylint: disable=useless-return
"""Search a Modulestore for all library source blocks in a course by querying mongo.
replace all source_library_ids with the corresponding v1 value from the inverted map.
This is exists to undo changes made previously.
diff --git a/cms/djangoapps/contentstore/tests/test_clone_course.py b/cms/djangoapps/contentstore/tests/test_clone_course.py
index 2449c9269288..2a4b3134681c 100644
--- a/cms/djangoapps/contentstore/tests/test_clone_course.py
+++ b/cms/djangoapps/contentstore/tests/test_clone_course.py
@@ -70,7 +70,7 @@ def test_space_in_asset_name_for_rerun_course(self):
# Get & verify all assets of the course
assets, count = contentstore().get_all_content_for_course(course.id)
self.assertEqual(count, 1) # noqa: PT009
- self.assertEqual({asset['asset_key'].block_id for asset in assets}, course_assets) # lint-amnesty, pylint: disable=consider-using-set-comprehension # noqa: PT009
+ self.assertEqual({asset['asset_key'].block_id for asset in assets}, course_assets) # pylint: disable=consider-using-set-comprehension # noqa: PT009
# rerun from split into split
split_rerun_id = CourseLocator(org=org, course=course_number, run="2012_Q2")
@@ -129,14 +129,14 @@ def test_rerun_course(self):
)
# try to hit the generic exception catch
- with patch('xmodule.modulestore.split_mongo.mongo_connection.MongoPersistenceBackend.insert_course_index', Mock(side_effect=Exception)): # lint-amnesty, pylint: disable=line-too-long
+ with patch('xmodule.modulestore.split_mongo.mongo_connection.MongoPersistenceBackend.insert_course_index', Mock(side_effect=Exception)): # noqa: E501
split_course4_id = CourseLocator(org="edx3", course="split3", run="rerun_fail")
fields = {'display_name': 'total failure'}
CourseRerunState.objects.initiated(split_course3_id, split_course4_id, self.user, fields['display_name'])
result = rerun_course.delay(str(split_course3_id), str(split_course4_id), self.user.id,
json.dumps(fields, cls=EdxJSONEncoder))
self.assertIn("exception: ", result.get()) # noqa: PT009
- self.assertIsNone(self.store.get_course(split_course4_id), "Didn't delete course after error") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertIsNone(self.store.get_course(split_course4_id), "Didn't delete course after error") # noqa: PT009
CourseRerunState.objects.find_first(
course_key=split_course4_id,
state=CourseRerunUIStateManager.State.FAILED
diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py
index 5c33e156721b..b87d14c9a3fd 100644
--- a/cms/djangoapps/contentstore/tests/test_contentstore.py
+++ b/cms/djangoapps/contentstore/tests/test_contentstore.py
@@ -79,7 +79,7 @@ def decorated_func(*args, **kwargs):
try:
from PIL import Image
except ImportError:
- raise SkipTest("Pillow is not installed (or not found)") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise SkipTest("Pillow is not installed (or not found)") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
if not getattr(Image.core, "jpeg_decoder", False):
raise SkipTest("Pillow cannot open JPEG files")
return func(*args, **kwargs)
@@ -301,7 +301,7 @@ def test_rewrite_nonportable_links_on_import(self):
html_block = self.store.get_item(html_block_location)
self.assertIn('/jump_to_id/nonportable_link', html_block.data) # noqa: PT009
- def verify_content_existence(self, store, root_dir, course_id, dirname, category_name, filename_suffix=''): # lint-amnesty, pylint: disable=missing-function-docstring
+ def verify_content_existence(self, store, root_dir, course_id, dirname, category_name, filename_suffix=''): # pylint: disable=missing-function-docstring
filesystem = OSFS(root_dir / 'test_export')
self.assertTrue(filesystem.exists(dirname)) # noqa: PT009
@@ -441,7 +441,7 @@ def test_html_export_roundtrip(self):
# get the sample HTML with styling information
html_block = self.store.get_item(course_id.make_usage_key('html', 'with_styling'))
- self.assertIn('
', html_block.data) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertIn('
', html_block.data) # noqa: PT009
# get the sample HTML with just a simple
tag information
html_block = self.store.get_item(course_id.make_usage_key('html', 'just_img'))
@@ -1447,7 +1447,7 @@ def test_capa_block(self):
problem_loc = UsageKey.from_string(payload['locator'])
problem = self.store.get_item(problem_loc)
self.assertIsInstance(problem, ProblemBlock, "New problem is not a ProblemBlock") # noqa: PT009
- self.assertNotIn('markdown', problem.editable_metadata_fields, "Markdown slipped into the editable metadata fields") # lint-amnesty, pylint: disable=line-too-long # noqa: PT009
+ self.assertNotIn('markdown', problem.editable_metadata_fields, "Markdown slipped into the editable metadata fields") # noqa: E501, PT009
def test_cms_imported_course_walkthrough(self):
"""
@@ -1921,7 +1921,7 @@ def test_rerun_course_video_upload_token(self):
# Verify video upload pipeline is empty.
source_course = self.store.get_course(source_course.id)
new_course = self.store.get_course(destination_course_key)
- self.assertDictEqual(source_course.video_upload_pipeline, {"course_video_upload_token": 'test-token'}) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertDictEqual(source_course.video_upload_pipeline, {"course_video_upload_token": 'test-token'}) # noqa: PT009
self.assertEqual(new_course.video_upload_pipeline, {}) # noqa: PT009
def test_rerun_course_success(self):
diff --git a/cms/djangoapps/contentstore/tests/test_course_listing.py b/cms/djangoapps/contentstore/tests/test_course_listing.py
index 31c9be4c2741..76bbd98bfc99 100644
--- a/cms/djangoapps/contentstore/tests/test_course_listing.py
+++ b/cms/djangoapps/contentstore/tests/test_course_listing.py
@@ -408,7 +408,7 @@ def _set_of_course_keys(course_list, key_attribute_name='id'):
return {getattr(c, key_attribute_name) for c in course_list}
found_courses, unsucceeded_course_actions = _accessible_courses_iter_for_tests(self.request)
- self.assertSetEqual(_set_of_course_keys(courses + courses_in_progress), _set_of_course_keys(found_courses)) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertSetEqual(_set_of_course_keys(courses + courses_in_progress), _set_of_course_keys(found_courses)) # noqa: PT009
self.assertSetEqual( # noqa: PT009
_set_of_course_keys(courses_in_progress), _set_of_course_keys(unsucceeded_course_actions, 'course_key')
)
diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py
index 5d726627f27e..41ce4d3fd1cd 100644
--- a/cms/djangoapps/contentstore/tests/test_course_settings.py
+++ b/cms/djangoapps/contentstore/tests/test_course_settings.py
@@ -174,7 +174,7 @@ def test_disable_advanced_settings_feature(self, disable_advanced_settings):
If this feature is enabled, only Django Staff/Superuser should be able to access the "Advanced Settings" page.
For non-staff users the "Advanced Settings" tab link should not be visible.
"""
- advanced_settings_link_html = f"Advanced Settings".encode('utf-8') # noqa: UP012 # pylint: disable=line-too-long
+ advanced_settings_link_html = f"Advanced Settings".encode('utf-8') # noqa: UP012
with override_settings(FEATURES={
'DISABLE_ADVANCED_SETTINGS': disable_advanced_settings,
@@ -280,9 +280,9 @@ def compare_details_with_encoding(self, encoded, details, context):
details['about_sidebar_html'], encoded['about_sidebar_html'], context + " about_sidebar_html not =="
)
self.assertEqual(details['overview'], encoded['overview'], context + " overviews not ==") # noqa: PT009
- self.assertEqual(details['intro_video'], encoded.get('intro_video', None), context + " intro_video not ==") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(details['intro_video'], encoded.get('intro_video', None), context + " intro_video not ==") # noqa: PT009
self.assertEqual(details['effort'], encoded['effort'], context + " efforts not ==") # noqa: PT009
- self.assertEqual(details['course_image_name'], encoded['course_image_name'], context + " images not ==") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(details['course_image_name'], encoded['course_image_name'], context + " images not ==") # noqa: PT009
self.assertEqual(details['language'], encoded['language'], context + " languages not ==") # noqa: PT009
def compare_date_fields(self, details, encoded, context, field):
@@ -323,7 +323,7 @@ def test_upgrade_deadline(self, has_verified_mode, has_expiration_date):
settings_details_url = get_url(self.course.id)
response = self.client.get_html(settings_details_url)
- self.assertEqual(b"Upgrade Deadline Date" in response.content, has_expiration_date and has_verified_mode) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(b"Upgrade Deadline Date" in response.content, has_expiration_date and has_verified_mode) # noqa: PT009
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PREREQUISITE_COURSES': True})
@override_waffle_flag(toggles.LEGACY_STUDIO_SCHEDULE_DETAILS, True)
@@ -743,11 +743,9 @@ def test_update_from_json(self, send_signal, tracker, uuid):
# one for each of the calls to update_from_json()
send_signal.assert_has_calls([
- # pylint: disable=line-too-long
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_2),
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_3),
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_4),
- # pylint: enable=line-too-long
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_2), # noqa: E501
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_3), # noqa: E501
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_4), # noqa: E501
])
# one for each of the calls to update_from_json(); the last update doesn't actually change the parts of the
@@ -865,10 +863,8 @@ def test_update_grader_from_json(self, send_signal, tracker, uuid):
# one for each of the calls to update_grader_from_json()
send_signal.assert_has_calls([
- # pylint: disable=line-too-long
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_2),
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_3),
- # pylint: enable=line-too-long
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_2), # noqa: E501
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_3), # noqa: E501
])
# one for each of the calls to update_grader_from_json()
@@ -906,7 +902,7 @@ def test_update_cutoffs_from_json(self, tracker, uuid):
test_grader.grade_cutoffs['Pass'] = 0.75
CourseGradingModel.update_cutoffs_from_json(self.course.id, test_grader.grade_cutoffs, self.user)
altered_grader = CourseGradingModel.fetch(self.course.id)
- self.assertDictEqual(test_grader.grade_cutoffs, altered_grader.grade_cutoffs, "cutoff change 'Pass'") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertDictEqual(test_grader.grade_cutoffs, altered_grader.grade_cutoffs, "cutoff change 'Pass'") # noqa: PT009
grading_policy_3 = self._grading_policy_hash_for_course()
# one for each of the calls to update_cutoffs_from_json()
@@ -936,7 +932,7 @@ def test_delete_grace_period(self):
CourseGradingModel.update_grace_period_from_json(
self.course.id, test_grader.grace_period, self.user)
altered_grader = CourseGradingModel.fetch(self.course.id)
- self.assertDictEqual(test_grader.grace_period, altered_grader.grace_period, "Adding in a grace period") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertDictEqual(test_grader.grace_period, altered_grader.grace_period, "Adding in a grace period") # noqa: PT009
test_grader.grace_period = {'hours': 1, 'minutes': 10, 'seconds': 0}
# Now delete the grace period
@@ -981,10 +977,8 @@ def test_update_section_grader_type(self, send_signal, tracker, uuid):
# one for each call to update_section_grader_type()
send_signal.assert_has_calls([
- # pylint: disable=line-too-long
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_1),
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_2),
- # pylint: enable=line-too-long
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_1), # noqa: E501
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_2), # noqa: E501
])
tracker.emit.assert_has_calls([
@@ -1061,11 +1055,9 @@ def test_add_delete_grader(self, send_signal):
self.assertNotIn(original_model['graders'][1], updated_model['graders']) # noqa: PT009
send_signal.assert_has_calls([
# once for the POST
- # pylint: disable=line-too-long
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_hash1),
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_hash1), # noqa: E501
# once for the DELETE
- mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_hash2),
- # pylint: enable=line-too-long
+ mock.call(sender=CourseGradingModel, user_id=self.user.id, course_key=self.course.id, grading_policy_hash=grading_policy_hash2), # noqa: E501
])
def setup_test_set_get_section_grader_ajax(self):
@@ -1346,7 +1338,7 @@ def test_validate_from_json_correct_inputs(self):
# Tab gets tested in test_advanced_settings_munge_tabs
self.assertIn('advanced_modules', test_model, 'Missing advanced_modules') # noqa: PT009
- self.assertEqual(test_model['advanced_modules']['value'], ['notes'], 'advanced_module is not updated') # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(test_model['advanced_modules']['value'], ['notes'], 'advanced_module is not updated') # noqa: PT009
def test_validate_from_json_wrong_inputs(self):
# input incorrectly formatted data
@@ -1417,7 +1409,7 @@ def test_update_from_json(self):
self.assertIn('display_name', test_model, 'Missing editable metadata field') # noqa: PT009
self.assertEqual(test_model['display_name']['value'], 'jolly roger', "not expected value") # noqa: PT009
self.assertIn('advertised_start', test_model, 'Missing revised advertised_start metadata field') # noqa: PT009
- self.assertEqual(test_model['advertised_start']['value'], 'start B', "advertised_start not expected value") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(test_model['advertised_start']['value'], 'start B', "advertised_start not expected value") # noqa: PT009
def update_check(self, test_model):
"""
@@ -1426,9 +1418,9 @@ def update_check(self, test_model):
self.assertIn('display_name', test_model, 'Missing editable metadata field') # noqa: PT009
self.assertEqual(test_model['display_name']['value'], self.course.display_name) # noqa: PT009
self.assertIn('advertised_start', test_model, 'Missing new advertised_start metadata field') # noqa: PT009
- self.assertEqual(test_model['advertised_start']['value'], 'start A', "advertised_start not expected value") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(test_model['advertised_start']['value'], 'start A', "advertised_start not expected value") # noqa: PT009
self.assertIn('days_early_for_beta', test_model, 'Missing days_early_for_beta metadata field') # noqa: PT009
- self.assertEqual(test_model['days_early_for_beta']['value'], 2, "days_early_for_beta not expected value") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(test_model['days_early_for_beta']['value'], 2, "days_early_for_beta not expected value") # noqa: PT009
def test_http_fetch_initial_fields(self):
response = self.client.get_json(self.course_setting_url)
@@ -1465,7 +1457,7 @@ def test_http_update_from_json(self):
self.assertIn('display_name', test_model, 'Missing editable metadata field') # noqa: PT009
self.assertEqual(test_model['display_name']['value'], 'jolly roger', "not expected value") # noqa: PT009
self.assertIn('advertised_start', test_model, 'Missing revised advertised_start metadata field') # noqa: PT009
- self.assertEqual(test_model['advertised_start']['value'], 'start B', "advertised_start not expected value") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(test_model['advertised_start']['value'], 'start B', "advertised_start not expected value") # noqa: PT009
@patch.dict(settings.FEATURES, {'ENABLE_EDXNOTES': True})
@patch('xmodule.util.xmodule_django.get_current_request')
diff --git a/cms/djangoapps/contentstore/tests/test_courseware_index.py b/cms/djangoapps/contentstore/tests/test_courseware_index.py
index f298b570b2b5..13629e5d6404 100644
--- a/cms/djangoapps/contentstore/tests/test_courseware_index.py
+++ b/cms/djangoapps/contentstore/tests/test_courseware_index.py
@@ -387,7 +387,7 @@ def _test_course_about_store_index(self, store):
field_dictionary={"course": str(self.course.id)}
)
self.assertEqual(response["total"], 1) # noqa: PT009
- self.assertEqual(response["results"][0]["data"]["content"]["short_description"], short_description) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(response["results"][0]["data"]["content"]["short_description"], short_description) # noqa: PT009
def _test_course_about_mode_index(self, store):
"""
@@ -459,7 +459,7 @@ def _test_course_location_null(self, store):
result = response["results"][0]["data"]
self.assertEqual(result["course_name"], "Search Index Test Course") # noqa: PT009
- self.assertEqual(result["location"], ["Week 1", CoursewareSearchIndexer.UNNAMED_MODULE_NAME, "Subsection 2"]) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(result["location"], ["Week 1", CoursewareSearchIndexer.UNNAMED_MODULE_NAME, "Subsection 2"]) # noqa: PT009
@patch('django.conf.settings.SEARCH_ENGINE', 'search.tests.utils.ErroringIndexEngine')
def _test_exception(self, store):
@@ -584,7 +584,7 @@ def _test_large_course_deletion(self, store):
load_factor = 6
try:
self._do_test_large_course_deletion(store, load_factor)
- except: # pylint: disable=bare-except
+ except: # noqa: E722
# Catch any exception here to see when we fail
print(f"Failed with load_factor of {load_factor}")
@@ -1199,7 +1199,7 @@ def test_content_group_gets_indexed(self):
self.assertIn(self._html_experiment_group_result(self.html_unit4, [str(2)]), indexed_content) # noqa: PT009
self.assertIn(self._html_experiment_group_result(self.html_unit5, [str(3)]), indexed_content) # noqa: PT009
self.assertIn(self._html_experiment_group_result(self.html_unit6, [str(4)]), indexed_content) # noqa: PT009
- self.assertNotIn(self._html_experiment_group_result(self.html_unit6, [str(5)]), indexed_content) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertNotIn(self._html_experiment_group_result(self.html_unit6, [str(5)]), indexed_content) # noqa: PT009
self.assertIn( # noqa: PT009
self._vertical_experiment_group_result(self.condition_0_vertical, [str(2)]),
indexed_content
diff --git a/cms/djangoapps/contentstore/tests/test_import.py b/cms/djangoapps/contentstore/tests/test_import.py
index d7e8d7905842..af703184f776 100644
--- a/cms/djangoapps/contentstore/tests/test_import.py
+++ b/cms/djangoapps/contentstore/tests/test_import.py
@@ -239,7 +239,7 @@ def test_rewrite_reference_value_dict_draft(self):
{"0": '9f0941d021414798836ef140fb5f6841', "1": '0faf29473cf1497baa33fcc828b179cd'},
)
- def _verify_split_test_import(self, target_course_name, source_course_name, split_test_name, groups_to_verticals): # lint-amnesty, pylint: disable=missing-function-docstring
+ def _verify_split_test_import(self, target_course_name, source_course_name, split_test_name, groups_to_verticals): # pylint: disable=missing-function-docstring
module_store = modulestore()
target_id = module_store.make_course_key('testX', target_course_name, 'copy_run')
import_course_from_xml(
diff --git a/cms/djangoapps/contentstore/tests/test_import_draft_order.py b/cms/djangoapps/contentstore/tests/test_import_draft_order.py
index 16ba4872655f..b039f3fcd209 100644
--- a/cms/djangoapps/contentstore/tests/test_import_draft_order.py
+++ b/cms/djangoapps/contentstore/tests/test_import_draft_order.py
@@ -38,7 +38,7 @@ def test_order(self):
# '5a05be9d59fc4bb79282c94c9e6b88c7' and 'second' are public verticals.
self.assertEqual(7, len(verticals)) # noqa: PT009
self.assertEqual(course_key.make_usage_key('vertical', 'z'), verticals[0]) # noqa: PT009
- self.assertEqual(course_key.make_usage_key('vertical', '5a05be9d59fc4bb79282c94c9e6b88c7'), verticals[1]) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(course_key.make_usage_key('vertical', '5a05be9d59fc4bb79282c94c9e6b88c7'), verticals[1]) # noqa: PT009
self.assertEqual(course_key.make_usage_key('vertical', 'a'), verticals[2]) # noqa: PT009
self.assertEqual(course_key.make_usage_key('vertical', 'second'), verticals[3]) # noqa: PT009
self.assertEqual(course_key.make_usage_key('vertical', 'b'), verticals[4]) # noqa: PT009
diff --git a/cms/djangoapps/contentstore/tests/test_libraries.py b/cms/djangoapps/contentstore/tests/test_libraries.py
index 29a194fd017e..503ca4be7b79 100644
--- a/cms/djangoapps/contentstore/tests/test_libraries.py
+++ b/cms/djangoapps/contentstore/tests/test_libraries.py
@@ -499,10 +499,10 @@ def test_library_filters(self):
self._create_library(library="l3", display_name="Library-Title-3", org='org-test1')
self._create_library(library="l4", display_name="Library-Title-4", org='org-test2')
- self.assertEqual(len(self.client.get_json(LIBRARY_REST_URL).json()), 5) # 1 more from self.setUp() # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(len(self.client.get_json(LIBRARY_REST_URL).json()), 5) # 1 more from self.setUp() # noqa: E501, PT009
self.assertEqual(len(self.client.get_json(f'{LIBRARY_REST_URL}?org=org-test1').json()), 2) # noqa: PT009
self.assertEqual(len(self.client.get_json(f'{LIBRARY_REST_URL}?text_search=test-lib').json()), 2) # noqa: PT009
- self.assertEqual(len(self.client.get_json(f'{LIBRARY_REST_URL}?text_search=library-title').json()), 3) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(len(self.client.get_json(f'{LIBRARY_REST_URL}?text_search=library-title').json()), 3) # noqa: PT009
self.assertEqual(len(self.client.get_json(f'{LIBRARY_REST_URL}?text_search=library-').json()), 3) # noqa: PT009
self.assertEqual(len(self.client.get_json(f'{LIBRARY_REST_URL}?text_search=org-test').json()), 3) # noqa: PT009
diff --git a/cms/djangoapps/contentstore/tests/test_permissions.py b/cms/djangoapps/contentstore/tests/test_permissions.py
index 86e77118426d..a82905521dbb 100644
--- a/cms/djangoapps/contentstore/tests/test_permissions.py
+++ b/cms/djangoapps/contentstore/tests/test_permissions.py
@@ -101,7 +101,7 @@ def test_get_all_users(self):
user = users.pop()
group.add_users(user)
user_by_role[role].append(user)
- self.assertTrue(auth.has_course_author_access(user, self.course_key), f"{user} does not have access") # lint-amnesty, pylint: disable=line-too-long # noqa: PT009
+ self.assertTrue(auth.has_course_author_access(user, self.course_key), f"{user} does not have access") # noqa: PT009
course_team_url = reverse_course_url('course_team_handler', self.course_key)
response = self.client.get_html(course_team_url)
@@ -134,9 +134,9 @@ def test_get_all_users(self):
if hasattr(user, '_roles'):
del user._roles
- self.assertTrue(auth.has_course_author_access(user, copy_course_key), f"{user} no copy access") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertTrue(auth.has_course_author_access(user, copy_course_key), f"{user} no copy access") # noqa: PT009
if (role is OrgStaffRole) or (role is OrgInstructorRole):
auth.remove_users(self.user, role(self.course_key.org), user)
else:
auth.remove_users(self.user, role(self.course_key), user)
- self.assertFalse(auth.has_course_author_access(user, self.course_key), f"{user} remove didn't work") # lint-amnesty, pylint: disable=line-too-long # noqa: PT009
+ self.assertFalse(auth.has_course_author_access(user, self.course_key), f"{user} remove didn't work") # noqa: PT009
diff --git a/cms/djangoapps/contentstore/tests/test_proctoring.py b/cms/djangoapps/contentstore/tests/test_proctoring.py
index 83b46ca2a063..b4e936de33c7 100644
--- a/cms/djangoapps/contentstore/tests/test_proctoring.py
+++ b/cms/djangoapps/contentstore/tests/test_proctoring.py
@@ -70,7 +70,7 @@ def _verify_exam_data(self, sequence, expected_active):
self.assertEqual(exam['exam_name'], sequence.display_name) # noqa: PT009
self.assertEqual(exam['time_limit_mins'], sequence.default_time_limit_minutes) # noqa: PT009
self.assertEqual(exam['is_proctored'], sequence.is_proctored_exam) # noqa: PT009
- self.assertEqual(exam['is_practice_exam'], sequence.is_practice_exam or sequence.is_onboarding_exam) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(exam['is_practice_exam'], sequence.is_practice_exam or sequence.is_onboarding_exam) # noqa: PT009
self.assertEqual(exam['is_active'], expected_active) # noqa: PT009
self.assertEqual(exam['backend'], self.course.proctoring_provider) # noqa: PT009
diff --git a/cms/djangoapps/contentstore/tests/test_tasks.py b/cms/djangoapps/contentstore/tests/test_tasks.py
index e1dd0b68d273..50fe216cff04 100644
--- a/cms/djangoapps/contentstore/tests/test_tasks.py
+++ b/cms/djangoapps/contentstore/tests/test_tasks.py
@@ -224,7 +224,7 @@ class RegisterExamsTaskTestCase(CourseTestCase): # pylint: disable=missing-clas
@mock.patch('cms.djangoapps.contentstore.exams.register_exams')
@mock.patch('cms.djangoapps.contentstore.proctoring.register_special_exams')
- def test_exam_service_not_enabled_success(self, _mock_register_exams_proctoring, _mock_register_exams_service): # noqa: PT019 # pylint: disable=line-too-long
+ def test_exam_service_not_enabled_success(self, _mock_register_exams_proctoring, _mock_register_exams_service): # noqa: PT019
""" edx-proctoring interface is called if exam service is not enabled """
update_special_exams_and_publish(str(self.course.id))
_mock_register_exams_proctoring.assert_called_once_with(self.course.id)
@@ -233,7 +233,7 @@ def test_exam_service_not_enabled_success(self, _mock_register_exams_proctoring,
@mock.patch('cms.djangoapps.contentstore.exams.register_exams')
@mock.patch('cms.djangoapps.contentstore.proctoring.register_special_exams')
@override_waffle_flag(EXAMS_IDA, active=True)
- def test_exam_service_enabled_success(self, _mock_register_exams_proctoring, _mock_register_exams_service): # noqa: PT019 # pylint: disable=line-too-long
+ def test_exam_service_enabled_success(self, _mock_register_exams_proctoring, _mock_register_exams_service): # noqa: PT019
""" exams service interface is called if exam service is enabled """
update_special_exams_and_publish(str(self.course.id))
_mock_register_exams_proctoring.assert_not_called()
@@ -261,7 +261,7 @@ class CheckBrokenLinksTaskTest(ModuleStoreTestCase):
"""Tests for CheckBrokenLinksTask"""
def setUp(self):
super().setUp()
- self.store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) # lint-amnesty, pylint: disable=protected-access
+ self.store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) # pylint: disable=protected-access
self.test_course = CourseFactory.create(
org="test", course="course1", display_name="run1"
)
diff --git a/cms/djangoapps/contentstore/tests/test_transcripts_utils.py b/cms/djangoapps/contentstore/tests/test_transcripts_utils.py
index 721bc59eb2d2..3a208a826759 100644
--- a/cms/djangoapps/contentstore/tests/test_transcripts_utils.py
+++ b/cms/djangoapps/contentstore/tests/test_transcripts_utils.py
@@ -361,7 +361,7 @@ def test_fail_bad_subs_filedata(self):
with self.assertRaises(TranscriptsGenerationException) as cm: # noqa: PT027
transcripts_utils.generate_subs_from_source(youtube_subs, 'srt', srt_filedata, self.course)
exception_message = str(cm.exception)
- self.assertEqual(exception_message, "Something wrong with SubRip transcripts file during parsing.") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(exception_message, "Something wrong with SubRip transcripts file during parsing.") # noqa: PT009
class TestGenerateSrtFromSjson(TestDownloadYoutubeSubs): # lint-amnesty, pylint: disable=test-inherits-tests
diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py
index 85e694f02e24..7c380f82bae6 100644
--- a/cms/djangoapps/contentstore/tests/test_utils.py
+++ b/cms/djangoapps/contentstore/tests/test_utils.py
@@ -44,7 +44,7 @@ def lms_link_test(self):
course_key = CourseLocator('mitX', '101', 'test')
location = course_key.make_usage_key('vertical', 'contacting_us')
link = utils.get_lms_link_for_item(location, False)
- self.assertEqual(link, "//localhost:8000/courses/course-v1:mitX+101+test/jump_to/block-v1:mitX+101+test+type" # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(link, "//localhost:8000/courses/course-v1:mitX+101+test/jump_to/block-v1:mitX+101+test+type" # noqa: PT009
"@vertical+block@contacting_us")
# test preview
@@ -58,7 +58,7 @@ def lms_link_test(self):
# now test with the course' location
location = course_key.make_usage_key('course', 'test')
link = utils.get_lms_link_for_item(location)
- self.assertEqual(link, "//localhost:8000/courses/course-v1:mitX+101+test/jump_to/block-v1:mitX+101+test+type" # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(link, "//localhost:8000/courses/course-v1:mitX+101+test/jump_to/block-v1:mitX+101+test+type" # noqa: PT009
"@course+block@test")
def lms_link_for_certificate_web_view_test(self):
@@ -159,7 +159,7 @@ def _test_visible_to_students(self, expected_visible_without_lock, name, start_d
with and without visible_to_staff_only set.
"""
no_staff_lock = self._create_xblock_with_start_date(name, start_date, publish, visible_to_staff_only=False)
- self.assertEqual(expected_visible_without_lock, utils.is_currently_visible_to_students(no_staff_lock)) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(expected_visible_without_lock, utils.is_currently_visible_to_students(no_staff_lock)) # noqa: PT009
# any xblock with visible_to_staff_only set to True should not be visible to students.
staff_lock = self._create_xblock_with_start_date(
diff --git a/cms/djangoapps/contentstore/tests/test_video_utils.py b/cms/djangoapps/contentstore/tests/test_video_utils.py
index 1fb1ed76ccb7..9ab61db98d68 100644
--- a/cms/djangoapps/contentstore/tests/test_video_utils.py
+++ b/cms/djangoapps/contentstore/tests/test_video_utils.py
@@ -49,7 +49,7 @@ def test_corrupt_image_file(self):
size=settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MIN_BYTES']
)
error = validate_video_image(uploaded_image_file)
- self.assertEqual(error, 'There is a problem with this image file. Try to upload a different file.') # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(error, 'There is a problem with this image file. Try to upload a different file.') # noqa: PT009
@ddt.ddt
@@ -214,7 +214,7 @@ def mocked_youtube_thumbnail_responses(resolutions):
mocked_responses = []
for resolution in YOUTUBE_THUMBNAIL_SIZES:
mocked_content = resolutions.get(resolution, '')
- error_response = False if mocked_content else True # lint-amnesty, pylint: disable=simplifiable-if-expression
+ error_response = False if mocked_content else True # pylint: disable=simplifiable-if-expression
mocked_responses.append(self.mocked_youtube_thumbnail_response(mocked_content, error_response))
return mocked_responses
@@ -320,14 +320,14 @@ def test_scrape_youtube_thumbnail_logging(
(
b'dummy-content',
None,
- 'This image file type is not supported. Supported file types are {supported_file_formats}.'.format( # noqa: UP032 # pylint: disable=line-too-long
+ 'This image file type is not supported. Supported file types are {supported_file_formats}.'.format( # noqa: UP032
supported_file_formats=list(settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS.keys())
)
),
(
None,
None,
- 'This image file type is not supported. Supported file types are {supported_file_formats}.'.format( # noqa: UP032 # pylint: disable=line-too-long
+ 'This image file type is not supported. Supported file types are {supported_file_formats}.'.format( # noqa: UP032
supported_file_formats=list(settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS.keys())
)
),
diff --git a/cms/djangoapps/contentstore/tests/test_xblock_handler_permissions.py b/cms/djangoapps/contentstore/tests/test_xblock_handler_permissions.py
index cc7b53ca0991..065092636039 100644
--- a/cms/djangoapps/contentstore/tests/test_xblock_handler_permissions.py
+++ b/cms/djangoapps/contentstore/tests/test_xblock_handler_permissions.py
@@ -30,7 +30,7 @@ def test_get_block_fields_staff_allowed(self):
self.assertEqual(self.client.get_json(f'/xblock/{self.html_block.location}').status_code, 200) # noqa: PT009
def test_get_block_fields_non_staff_forbidden(self):
- self.assertEqual(self.non_staff_client.get_json(f'/xblock/{self.html_block.location}').status_code, 403) # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(self.non_staff_client.get_json(f'/xblock/{self.html_block.location}').status_code, 403) # noqa: PT009
# --- POST /xblock/{blockId} metadata ---
diff --git a/cms/djangoapps/contentstore/toggles.py b/cms/djangoapps/contentstore/toggles.py
index 30a030f966a9..400e56fffbdd 100644
--- a/cms/djangoapps/contentstore/toggles.py
+++ b/cms/djangoapps/contentstore/toggles.py
@@ -125,7 +125,7 @@ def use_new_pdf_editor():
# .. toggle_name: new_core_editors.use_video_gallery_flow
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
-# .. toggle_description: This flag enables the use the video selection gallery on the flow of the new core video xblock editor
+# .. toggle_description: This flag enables the use the video selection gallery on the flow of the new core video xblock editor # noqa: E501
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2023-04-03
# .. toggle_target_removal_date: 2023-6-01
@@ -163,7 +163,7 @@ def individualize_anonymous_user_id(course_id):
# .. toggle_name: contentstore.use_react_markdown_editor
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
-# .. toggle_description: This flag enables the use of the Markdown editor when creating or editing problems in the authoring MFE
+# .. toggle_description: This flag enables the use of the Markdown editor when creating or editing problems in the authoring MFE # noqa: E501
# .. toggle_use_cases: opt_in
# .. toggle_creation_date: 2025-4-11
# .. toggle_tickets: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/4517232656/Re-enable+Markdown+editing+of+CAPA+problems+to+meet+various+use+cases
@@ -387,7 +387,7 @@ def use_new_group_configurations_page(course_key):
# .. toggle_name: contentstore.mock_video_uploads
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
-# .. toggle_description: This flag mocks contentstore video uploads for local development, if you don't have access to AWS
+# .. toggle_description: This flag mocks contentstore video uploads for local development, if you don't have access to AWS # noqa: E501
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2023-7-25
# .. toggle_tickets: TNL-10897
@@ -544,7 +544,7 @@ def use_legacy_logged_out_home():
# .. toggle_name: contentstore.enable_course_optimizer_check_prev_run_links
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
-# .. toggle_description: When enabled, allows the Course Optimizer to detect and update links pointing to previous course runs.
+# .. toggle_description: When enabled, allows the Course Optimizer to detect and update links pointing to previous course runs. # noqa: E501
# This feature enables instructors to fix internal course links that still point to old course runs
# after creating a course rerun.
# .. toggle_use_cases: temporary
diff --git a/cms/djangoapps/contentstore/transcript_storage_handlers.py b/cms/djangoapps/contentstore/transcript_storage_handlers.py
index 293475232c95..f60055e59429 100644
--- a/cms/djangoapps/contentstore/transcript_storage_handlers.py
+++ b/cms/djangoapps/contentstore/transcript_storage_handlers.py
@@ -64,7 +64,7 @@ def validate_transcript_credentials(provider, **credentials):
must_have_props = ['api_key', 'username']
missing = [
- must_have_prop for must_have_prop in must_have_props if must_have_prop not in list(credentials.keys()) # lint-amnesty, pylint: disable=consider-iterating-dictionary
+ must_have_prop for must_have_prop in must_have_props if must_have_prop not in list(credentials.keys()) # pylint: disable=consider-iterating-dictionary
]
if missing:
error_message = '{missing} must be specified.'.format(missing=' and '.join(missing))
@@ -233,7 +233,7 @@ def validate_transcript_upload_data(data, files):
data['language_code'] != data['new_language_code'] and
data['new_language_code'] in get_available_transcript_languages(video_id=data['edx_video_id'])
):
- error = _('A transcript with the "{language_code}" language code already exists.'.format( # lint-amnesty, pylint: disable=translation-of-non-string
+ error = _('A transcript with the "{language_code}" language code already exists.'.format( # pylint: disable=translation-of-non-string
language_code=data['new_language_code']
))
elif 'file' not in files:
diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py
index 35818125efab..9ab864ab114c 100644
--- a/cms/djangoapps/contentstore/utils.py
+++ b/cms/djangoapps/contentstore/utils.py
@@ -599,7 +599,7 @@ def is_currently_visible_to_students(xblock):
return False
# Check start date
- if 'detached' not in published._class_tags and published.start is not None: # lint-amnesty, pylint: disable=protected-access
+ if 'detached' not in published._class_tags and published.start is not None: # pylint: disable=protected-access
return datetime.now(UTC) > published.start
# No start date, so it's always visible
@@ -996,7 +996,7 @@ def get_subsections_in_section():
section_subsections = section.get_children()
return section_subsections
except AttributeError:
- log.error("URL Retrieval Error: subsection {subsection} included in section {section}".format( # noqa: UP032 # pylint: disable=line-too-long
+ log.error("URL Retrieval Error: subsection {subsection} included in section {section}".format( # noqa: UP032
section=section.location,
subsection=subsection.location
))
@@ -1494,7 +1494,7 @@ def get_course_settings(request, course_key, course_block):
# if 'minimum_grade_credit' of a course is not set or 0 then
# show warning message to course author.
- show_min_grade_warning = False if course_block.minimum_grade_credit > 0 else True # lint-amnesty, pylint: disable=simplifiable-if-expression
+ show_min_grade_warning = False if course_block.minimum_grade_credit > 0 else True # pylint: disable=simplifiable-if-expression
settings_context.update(
{
'is_credit_course': True,
@@ -1950,7 +1950,7 @@ def _get_course_index_context(request, course_key, course_block):
'lms_link': lms_link,
'sections': sections,
'course_structure': course_structure,
- 'initial_state': course_outline_initial_state(locator_to_show, course_structure) if locator_to_show else None, # lint-amnesty, pylint: disable=line-too-long
+ 'initial_state': course_outline_initial_state(locator_to_show, course_structure) if locator_to_show else None,
'initial_user_clipboard': user_clipboard,
'rerun_notification_id': current_action.id if current_action else None,
'course_release_date': course_release_date,
diff --git a/cms/djangoapps/contentstore/video_utils.py b/cms/djangoapps/contentstore/video_utils.py
index 44e216947117..85cf0cd16fe3 100644
--- a/cms/djangoapps/contentstore/video_utils.py
+++ b/cms/djangoapps/contentstore/video_utils.py
@@ -87,7 +87,7 @@ def download_youtube_video_thumbnail(youtube_id):
thumbnail_content = thumbnail_content_type = None
# Download highest resolution thumbnail available.
for thumbnail_quality in YOUTUBE_THUMBNAIL_SIZES:
- thumbnail_url = urljoin('https://img.youtube.com', '/vi/{youtube_id}/{thumbnail_quality}.jpg'.format( # noqa: UP032 # pylint: disable=line-too-long
+ thumbnail_url = urljoin('https://img.youtube.com', '/vi/{youtube_id}/{thumbnail_quality}.jpg'.format( # noqa: UP032
youtube_id=youtube_id, thumbnail_quality=thumbnail_quality
))
response = requests.get(thumbnail_url)
@@ -115,7 +115,7 @@ def validate_and_update_video_image(course_key_string, edx_video_id, image_file,
update_video_image(edx_video_id, course_key_string, image_file, image_filename)
LOGGER.info(
- 'VIDEOS: Scraping youtube video thumbnail for edx_video_id [%s] in course [%s]', edx_video_id, course_key_string # lint-amnesty, pylint: disable=line-too-long
+ 'VIDEOS: Scraping youtube video thumbnail for edx_video_id [%s] in course [%s]', edx_video_id, course_key_string
)
diff --git a/cms/djangoapps/contentstore/views/certificate_manager.py b/cms/djangoapps/contentstore/views/certificate_manager.py
index dda1e172c503..b53c93565612 100644
--- a/cms/djangoapps/contentstore/views/certificate_manager.py
+++ b/cms/djangoapps/contentstore/views/certificate_manager.py
@@ -88,7 +88,7 @@ def parse(json_string):
try:
certificate = json.loads(json_string)
except ValueError:
- raise CertificateValidationError(_("invalid JSON")) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise CertificateValidationError(_("invalid JSON")) # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
# Include the data contract version
certificate["version"] = CERTIFICATE_SCHEMA_VERSION
# Ensure a signatories list is always returned
diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py
index 9fa38665466f..a5f2125e71bc 100644
--- a/cms/djangoapps/contentstore/views/component.py
+++ b/cms/djangoapps/contentstore/views/component.py
@@ -350,7 +350,7 @@ def create_support_legend_dict():
templates_for_category.append(
create_template_dict(
- _(template['metadata'].get('display_name')), # lint-amnesty, pylint: disable=translation-of-non-string
+ _(template['metadata'].get('display_name')), # pylint: disable=translation-of-non-string
category,
support_level_with_template,
template_id,
diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py
index 3d248944bdd5..4ad82865565b 100644
--- a/cms/djangoapps/contentstore/views/course.py
+++ b/cms/djangoapps/contentstore/views/course.py
@@ -1346,7 +1346,7 @@ def course_info_update_handler(request, course_key_string, provided_id=None):
elif request.method == 'DELETE':
try:
return JsonResponse(delete_course_update(usage_key, request.json, provided_id, request.user))
- except: # lint-amnesty, pylint: disable=bare-except
+ except: # noqa: E722
return HttpResponseBadRequest(
"Failed to delete",
content_type="text/plain"
@@ -1357,7 +1357,7 @@ def course_info_update_handler(request, course_key_string, provided_id=None):
return JsonResponse(update_course_updates(
usage_key, request.json, provided_id, request.user, request.method
))
- except: # lint-amnesty, pylint: disable=bare-except
+ except: # noqa: E722
return HttpResponseBadRequest(
"Failed to save",
content_type="text/plain"
@@ -1639,7 +1639,7 @@ def validate_textbook_json(textbook):
try:
textbook = json.loads(textbook)
except ValueError:
- raise TextbookValidationError("invalid JSON") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
+ raise TextbookValidationError("invalid JSON") # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904, E501
if not isinstance(textbook, dict):
raise TextbookValidationError("must be JSON object")
if not textbook.get("tab_title"):
@@ -1923,7 +1923,7 @@ def group_configurations_detail_handler(request, course_key_string, group_config
if request.method in ('POST', 'PUT'): # can be either and sometimes django is rewriting one to the other
try:
- new_configuration = GroupConfiguration(request.body, course, group_configuration_id).get_user_partition() # lint-amnesty, pylint: disable=line-too-long
+ new_configuration = GroupConfiguration(request.body, course, group_configuration_id).get_user_partition() # noqa: E501
except GroupConfigurationsValidationError as err:
return JsonResponse({"error": str(err)}, status=400)
diff --git a/cms/djangoapps/contentstore/views/error.py b/cms/djangoapps/contentstore/views/error.py
index 5a9c23490ba6..ed0db0af62bb 100644
--- a/cms/djangoapps/contentstore/views/error.py
+++ b/cms/djangoapps/contentstore/views/error.py
@@ -20,7 +20,7 @@ def outer(func):
def inner(request, *args, **kwargs):
if request.headers.get('x-requested-with') == 'XMLHttpRequest':
content = dump_js_escaped_json({"error": message})
- return HttpResponse(content, content_type="application/json", # lint-amnesty, pylint: disable=http-response-with-content-type-json
+ return HttpResponse(content, content_type="application/json", # pylint: disable=http-response-with-content-type-json
status=status)
else:
return func(request, *args, **kwargs)
diff --git a/cms/djangoapps/contentstore/views/organization.py b/cms/djangoapps/contentstore/views/organization.py
index 7ece98201ac1..c9c9eaa60966 100644
--- a/cms/djangoapps/contentstore/views/organization.py
+++ b/cms/djangoapps/contentstore/views/organization.py
@@ -22,4 +22,4 @@ def get(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=unused
"""Returns organization list as json."""
organizations = get_organizations()
org_names_list = [(org["short_name"]) for org in organizations]
- return HttpResponse(dump_js_escaped_json(org_names_list), content_type='application/json; charset=utf-8') # lint-amnesty, pylint: disable=http-response-with-content-type-json
+ return HttpResponse(dump_js_escaped_json(org_names_list), content_type='application/json; charset=utf-8') # pylint: disable=http-response-with-content-type-json
diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py
index d3ca840c01fd..45b0298601af 100644
--- a/cms/djangoapps/contentstore/views/preview.py
+++ b/cms/djangoapps/contentstore/views/preview.py
@@ -93,7 +93,7 @@ def preview_handler(request, usage_key_string, handler, suffix=''):
return webob_to_django_response(resp)
-def handler_url(block, handler_name, suffix='', query='', thirdparty=False): # lint-amnesty, pylint: disable=unused-argument
+def handler_url(block, handler_name, suffix='', query='', thirdparty=False): # pylint: disable=unused-argument
"""
Handler URL function for Preview
"""
@@ -312,7 +312,7 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False):
is_reorderable = _is_xblock_reorderable(xblock, context)
selected_groups_label = get_visibility_partition_info(xblock)['selected_groups_label']
if selected_groups_label:
- selected_groups_label = _('Access restricted to: {list_of_groups}').format(list_of_groups=selected_groups_label) # lint-amnesty, pylint: disable=line-too-long
+ selected_groups_label = _('Access restricted to: {list_of_groups}').format(list_of_groups=selected_groups_label) # noqa: E501
course = modulestore().get_course(xblock.location.course_key)
can_edit = context.get('can_edit', True)
diff --git a/cms/djangoapps/contentstore/views/tabs.py b/cms/djangoapps/contentstore/views/tabs.py
index 86a725bcfc78..ba0334d1caf4 100644
--- a/cms/djangoapps/contentstore/views/tabs.py
+++ b/cms/djangoapps/contentstore/views/tabs.py
@@ -179,7 +179,7 @@ def edit_tab_handler(course_item: CourseBlock, tabs_data: Dict, user: User): #
raise NotImplementedError(f"Unsupported request to edit tab: {tabs_data}")
-def get_tab_by_tab_id_locator(tab_list: List[CourseTab], tab_id_locator: Dict[str, str]) -> Optional[CourseTab]: # noqa: UP006, UP045 # pylint: disable=line-too-long
+def get_tab_by_tab_id_locator(tab_list: List[CourseTab], tab_id_locator: Dict[str, str]) -> Optional[CourseTab]: # noqa: UP006, UP045
"""
Look for a tab with the specified tab_id or locator. Returns the first matching tab.
"""
@@ -191,7 +191,7 @@ def get_tab_by_tab_id_locator(tab_list: List[CourseTab], tab_id_locator: Dict[st
return tab
-def get_tab_by_locator(tab_list: List[CourseTab], tab_location: Union[str, UsageKey]) -> Optional[CourseTab]: # noqa: UP006, UP007, UP045 # pylint: disable=line-too-long
+def get_tab_by_locator(tab_list: List[CourseTab], tab_location: Union[str, UsageKey]) -> Optional[CourseTab]: # noqa: UP006, UP007, UP045
"""
Look for a tab with the specified locator. Returns the first matching tab.
"""
diff --git a/cms/djangoapps/contentstore/views/tests/test_assets.py b/cms/djangoapps/contentstore/views/tests/test_assets.py
index 4601f27f05f0..99825f6f24e5 100644
--- a/cms/djangoapps/contentstore/views/tests/test_assets.py
+++ b/cms/djangoapps/contentstore/views/tests/test_assets.py
@@ -447,10 +447,10 @@ def test_basic(self):
output["external_url"], "https://lms_root_url/asset-v1:org+class+run+type@asset+block@my_file_name.jpg"
)
self.assertEqual(output["portable_url"], "/static/my_file_name.jpg") # noqa: PT009
- self.assertEqual(output["thumbnail"], "/asset-v1:org+class+run+type@thumbnail+block@my_file_name_thumb.jpg") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(output["thumbnail"], "/asset-v1:org+class+run+type@thumbnail+block@my_file_name_thumb.jpg") # noqa: PT009
self.assertEqual(output["id"], str(location)) # noqa: PT009
self.assertEqual(output['locked'], True) # noqa: PT009
- self.assertEqual(output['static_full_url'], '/asset-v1:org+class+run+type@asset+block@my_file_name.jpg') # noqa: PT009 # pylint: disable=line-too-long
+ self.assertEqual(output['static_full_url'], '/asset-v1:org+class+run+type@asset+block@my_file_name.jpg') # noqa: PT009
output = assets._get_asset_json("name", content_type, upload_date, location, None, False, course_key)
self.assertIsNone(output["thumbnail"]) # noqa: PT009
diff --git a/cms/djangoapps/contentstore/views/tests/test_block.py b/cms/djangoapps/contentstore/views/tests/test_block.py
index bb1206169189..1a75fcd25e6a 100644
--- a/cms/djangoapps/contentstore/views/tests/test_block.py
+++ b/cms/djangoapps/contentstore/views/tests/test_block.py
@@ -2212,7 +2212,7 @@ def _make_draft_content_different_from_published(self):
published = modulestore().get_item(
self.problem_usage_key,
revision=ModuleStoreEnum.RevisionOption.published_only,
- ) # lint-amnesty, pylint: disable=line-too-long
+ )
# Update the draft version and check that published is different.
self.client.ajax_post(
@@ -2940,7 +2940,7 @@ def test_advanced_components(self):
# Now fully disable done through XBlockConfiguration
XBlockConfiguration.objects.create(name="done", enabled=False)
self.templates = get_component_templates(self.course)
- self.assertTrue((not any(item.get("category") == "done" for item in self.get_templates_of_type("advanced")))) # noqa: PT009, UP034 # pylint: disable=line-too-long
+ self.assertTrue((not any(item.get("category") == "done" for item in self.get_templates_of_type("advanced")))) # noqa: PT009, UP034
def test_deprecated_no_advance_component_button(self):
"""
@@ -4613,5 +4613,5 @@ def test_xblock_edit_view_contains_resources(self):
resource_links = [link["href"] for link in soup.find_all("link", {"rel": "stylesheet"})]
script_sources = [script["src"] for script in soup.find_all("script") if script.get("src")]
- self.assertGreater(len(resource_links), 0, f"No CSS resources found in HTML. Found: {resource_links}") # noqa: PT009 # pylint: disable=line-too-long
- self.assertGreater(len(script_sources), 0, f"No JS resources found in HTML. Found: {script_sources}") # noqa: PT009 # pylint: disable=line-too-long
+ self.assertGreater(len(resource_links), 0, f"No CSS resources found in HTML. Found: {resource_links}") # noqa: PT009
+ self.assertGreater(len(script_sources), 0, f"No JS resources found in HTML. Found: {script_sources}") # noqa: PT009
diff --git a/cms/djangoapps/contentstore/views/tests/test_course_updates.py b/cms/djangoapps/contentstore/views/tests/test_course_updates.py
index 36c4e45c56c7..9c2328b83dae 100644
--- a/cms/djangoapps/contentstore/views/tests/test_course_updates.py
+++ b/cms/djangoapps/contentstore/views/tests/test_course_updates.py
@@ -42,7 +42,7 @@ def get_response(content, date):
return json.loads(resp.content.decode('utf-8'))
- init_content = '