diff --git a/.github/workflows/pylint-checks.yml b/.github/workflows/pylint-checks.yml index 584193adeeaf..c9f1af09ff22 100644 --- a/.github/workflows/pylint-checks.yml +++ b/.github/workflows/pylint-checks.yml @@ -15,7 +15,7 @@ jobs: matrix: include: - module-name: lms-1 - path: "lms/djangoapps/badges/ lms/djangoapps/save_for_later/ lms/djangoapps/bigcommerce_app/ 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/" + path: "lms/djangoapps/badges/ lms/djangoapps/mfe_config_api/ lms/djangoapps/save_for_later/ lms/djangoapps/bigcommerce_app/ 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/email_marketing/ lms/djangoapps/experiments/ lms/djangoapps/instructor_task/ lms/djangoapps/learner_dashboard/ 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/envs/ lms/lib/ lms/tests.py" - module-name: openedx-1 diff --git a/lms/djangoapps/course_home_api/course_metadata/views.py b/lms/djangoapps/course_home_api/course_metadata/views.py index 476f9acb381d..4132b5f9c3db 100644 --- a/lms/djangoapps/course_home_api/course_metadata/views.py +++ b/lms/djangoapps/course_home_api/course_metadata/views.py @@ -23,7 +23,6 @@ from lms.djangoapps.courseware.toggles import courseware_mfe_is_visible - class CourseHomeMetadataView(RetrieveAPIView): """ **Use Cases** diff --git a/lms/djangoapps/course_home_api/outline/views.py b/lms/djangoapps/course_home_api/outline/views.py index 8094ffc2e703..c1b2f47f00b7 100644 --- a/lms/djangoapps/course_home_api/outline/views.py +++ b/lms/djangoapps/course_home_api/outline/views.py @@ -108,7 +108,8 @@ class OutlineTabView(RetrieveAPIView): days_per_week: (int) The number of days the learner wants to learn per week subscribed_to_reminders: (bool) Whether the learner wants email reminders about their goal weekly_learning_goal_enabled: Flag indicating if this feature is enabled for this call - course_revision: (str) Course revision number used to identify what version number from Instructional design team. + course_revision: (str) Course revision number used to identify what version number + from Instructional design team. course_tools: List of serialized Course Tool objects. Each serialization has the following fields: analytics_id: (str) The unique id given to the tool. title: (str) The display title of the tool. diff --git a/lms/djangoapps/courseware/management/commands/dump_course_structure_csv_all_courses.py b/lms/djangoapps/courseware/management/commands/dump_course_structure_csv_all_courses.py index acb630fb0aa0..33dba8b827dc 100644 --- a/lms/djangoapps/courseware/management/commands/dump_course_structure_csv_all_courses.py +++ b/lms/djangoapps/courseware/management/commands/dump_course_structure_csv_all_courses.py @@ -19,8 +19,8 @@ # import json from datetime import datetime -from pytz import UTC from textwrap import dedent +from pytz import UTC from django.core.management.base import BaseCommand, CommandError # from opaque_keys import InvalidKeyError diff --git a/lms/djangoapps/mfe_config_api/views.py b/lms/djangoapps/mfe_config_api/views.py index 3e44ddc8704c..c2984078f746 100644 --- a/lms/djangoapps/mfe_config_api/views.py +++ b/lms/djangoapps/mfe_config_api/views.py @@ -2,14 +2,14 @@ MFE API Views for useful information related to mfes. """ -import json +# import json import logging import re from django.conf import settings from django.http import HttpResponseNotFound, JsonResponse -from django.utils.decorators import method_decorator -from django.views.decorators.cache import cache_page +# from django.utils.decorators import method_decorator +# from django.views.decorators.cache import cache_page from rest_framework import status from rest_framework.views import APIView @@ -21,6 +21,7 @@ log = logging.getLogger(__name__) + class MFEConfigView(APIView): """ Provides an API endpoint to get the MFE_CONFIG from site configuration. @@ -62,13 +63,13 @@ def get(self, request): "request.META %s", request.META ) if request.META.get('HTTP_REFERER'): - referer = re.sub('^https?:\/\/', '', request.META.get('HTTP_REFERER')).split('/')[0] + referer = re.sub(r'^https?:\/\/', '', request.META.get('HTTP_REFERER')).split('/')[0] # pylint: disable=anomalous-backslash-in-string - for site_config in SiteConfiguration.objects.all(): + for site_config in SiteConfiguration.objects.all(): mfe_config = site_config.site_values.get("MFE_CONFIG", {}) if mfe_config.get("BASE_URL"): - mfe_config_base_url = re.sub('^https?:\/\/', '', mfe_config.get("BASE_URL")).split('/')[0] - + mfe_config_base_url = re.sub(r'^https?:\/\/', '', mfe_config.get("BASE_URL")).split('/')[0] # pylint: disable=anomalous-backslash-in-string + if mfe_config_base_url == referer: log.info( "Found the site configuration that matches the MFE base domain." @@ -77,18 +78,17 @@ def get(self, request): configuration = getattr(site_config.site, "configuration", None) mfe_config = configuration.get_value( - f'MFE_CONFIG', getattr(settings, f'MFE_CONFIG', {})) + 'MFE_CONFIG', getattr(settings, 'MFE_CONFIG', {})) if request.query_params.get('mfe'): mfe = str(request.query_params.get('mfe')).upper() - mfe_config.update(configuration.get_value( f'MFE_CONFIG_{mfe}', getattr(settings, f'MFE_CONFIG_{mfe}', {}))) # Exit out of the loop once you find first correct # MFE_CONFIG in Site Configuration. - break; + break else: mfe_config = configuration_helpers.get_value('MFE_CONFIG', getattr(settings, 'MFE_CONFIG', {})) diff --git a/openedx/core/djangoapps/content/course_overviews/migrations/0027_merge_20240123_1603.py b/openedx/core/djangoapps/content/course_overviews/migrations/0027_merge_20240123_1603.py new file mode 100644 index 000000000000..d794a3839a0e --- /dev/null +++ b/openedx/core/djangoapps/content/course_overviews/migrations/0027_merge_20240123_1603.py @@ -0,0 +1,14 @@ +# Generated by Django 3.2.16 on 2024-01-23 16:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_overviews', '0026_auto_20230525_1917'), + ('course_overviews', '0026_courseoverview_entrance_exam'), + ] + + operations = [ + ] diff --git a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py index 9019cca07928..1d8b2313eeeb 100644 --- a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py +++ b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py @@ -380,7 +380,7 @@ def test_malformed_grading_policy(self): course_overview = CourseOverview._create_or_update(course) # pylint: disable=protected-access assert course_overview.lowest_passing_grade is None - @ddt.data((ModuleStoreEnum.Type.mongo, 5, 5), (ModuleStoreEnum.Type.split, 3, 3)) + @ddt.data((ModuleStoreEnum.Type.mongo, 5, 5), (ModuleStoreEnum.Type.split, 2, 2)) @ddt.unpack def test_versioning(self, modulestore_type, min_mongo_calls, max_mongo_calls): """ diff --git a/openedx/features/course_experience/url_helpers.py b/openedx/features/course_experience/url_helpers.py index 651246e297a5..038e0b05cd30 100644 --- a/openedx/features/course_experience/url_helpers.py +++ b/openedx/features/course_experience/url_helpers.py @@ -180,7 +180,7 @@ def make_learning_mfe_courseware_url( strings. They're only ever used to concatenate a URL string. `params` is an optional QueryDict object (e.g. request.GET) """ - learning_microfrontend_url = configuration_helpers.get_value('LEARNING_MICROFRONTEND_URL', getattr(settings, 'LEARNING_MICROFRONTEND_URL', '')) + learning_microfrontend_url = configuration_helpers.get_value('LEARNING_MICROFRONTEND_URL', getattr(settings, 'LEARNING_MICROFRONTEND_URL', '')) # pylint: disable=line-too-long mfe_link = f'{learning_microfrontend_url}/course/{course_key}' if sequence_key: @@ -211,7 +211,7 @@ def get_learning_mfe_home_url( `url_fragment` is an optional string. `params` is an optional QueryDict object (e.g. request.GET) """ - learning_microfrontend_url = configuration_helpers.get_value('LEARNING_MICROFRONTEND_URL', getattr(settings, 'LEARNING_MICROFRONTEND_URL', '')) + learning_microfrontend_url = configuration_helpers.get_value('LEARNING_MICROFRONTEND_URL', getattr(settings, 'LEARNING_MICROFRONTEND_URL', '')) # pylint: disable=line-too-long mfe_link = f'{learning_microfrontend_url}/course/{course_key}' if url_fragment: @@ -227,7 +227,7 @@ def is_request_from_learning_mfe(request: HttpRequest): """ Returns whether the given request was made by the frontend-app-learning MFE. """ - learning_microfrontend_url = configuration_helpers.get_value('LEARNING_MICROFRONTEND_URL', getattr(settings, 'LEARNING_MICROFRONTEND_URL', '')) + learning_microfrontend_url = configuration_helpers.get_value('LEARNING_MICROFRONTEND_URL', getattr(settings, 'LEARNING_MICROFRONTEND_URL', '')) # pylint: disable=line-too-long if not learning_microfrontend_url: return False