diff --git a/lms/__init__.py b/lms/__init__.py index b2e36bfc9496b40f0543156f1ce608c735521794..12f5322a8bede83a71ed684f2a2b3f21cd2d3bfe 100644 --- a/lms/__init__.py +++ b/lms/__init__.py @@ -12,9 +12,10 @@ registration and discovery can work correctly. # FWIW, this is identical behavior to what happens in Kombu if pkg_resources # isn't available. import kombu.utils -kombu.utils.entrypoints = lambda namespace: iter([]) # This will make sure the app is always imported when Django starts so # that shared_task will use this app, and also ensures that the celery # singleton is always configured for the LMS. from .celery import APP as CELERY_APP # lint-amnesty, pylint: disable=wrong-import-position + +kombu.utils.entrypoints = lambda namespace: iter([]) diff --git a/lms/celery.py b/lms/celery.py index 2e7235f8d58efecb611306263dfdb02b4d521b5e..45b94c834c5dd7e84c3303e1f2f28fc186c740a7 100644 --- a/lms/celery.py +++ b/lms/celery.py @@ -7,8 +7,8 @@ Taken from: https://celery.readthedocs.org/en/latest/django/first-steps-with-dja import os +from openedx.core.lib.celery import APP # pylint: disable=wrong-import-position,unused-import # Set the default Django settings module for the 'celery' program # and then instantiate the Celery singleton. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lms.envs.production') -from openedx.core.lib.celery import APP # pylint: disable=wrong-import-position,unused-import diff --git a/lms/docker_lms_gunicorn.py b/lms/docker_lms_gunicorn.py index 9b79a792a16aa75ec5927ce5ec6bccb01aed8ba9..32653ca096bc68ecb91bf908395710aa858cbacb 100644 --- a/lms/docker_lms_gunicorn.py +++ b/lms/docker_lms_gunicorn.py @@ -11,7 +11,7 @@ workers = 17 def pre_request(worker, req): - worker.log.info("%s %s" % (req.method, req.path)) + worker.log.info(f"{req.method} {req.path}") def close_all_caches(): diff --git a/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index 6c2f16e963af94f5fa6d9e868a788eca60d14ab8..fb843755e0027a92c394fba8d5313e5918adb187 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Settings for Bok Choy tests that are used when running LMS. @@ -35,10 +34,10 @@ TEST_ROOT = CONFIG_ROOT.dirname().dirname() / "test_root" os.environ['SERVICE_VARIANT'] = 'bok_choy_docker' if 'BOK_CHOY_HOSTNAME' in os.environ else 'bok_choy' os.environ['LMS_CFG'] = str.format("{config_root}/{service_variant}.yml", config_root=CONFIG_ROOT, service_variant=os.environ['SERVICE_VARIANT']) -os.environ['REVISION_CFG'] = "{config_root}/revisions.yml".format(config_root=CONFIG_ROOT) +os.environ['REVISION_CFG'] = f"{CONFIG_ROOT}/revisions.yml" -from .production import * # pylint: disable=wildcard-import, unused-wildcard-import, wrong-import-position +from .production import * # pylint: disable=wildcard-import, unused-wildcard-import, wrong-import-position ######################### Testing overrides #################################### @@ -58,8 +57,8 @@ update_module_store_settings( default_store=os.environ.get('DEFAULT_STORE', 'draft'), ) -PLATFORM_NAME = ugettext_lazy(u"édX") -PLATFORM_DESCRIPTION = ugettext_lazy(u"Open édX Platform") +PLATFORM_NAME = ugettext_lazy("édX") +PLATFORM_DESCRIPTION = ugettext_lazy("Open édX Platform") ############################ STATIC FILES ############################# @@ -101,9 +100,9 @@ YOUTUBE_HOSTNAME = os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1') # Point the URL used to test YouTube availability to our stub YouTube server YOUTUBE_PORT = 9080 YOUTUBE['TEST_TIMEOUT'] = 5000 -YOUTUBE['API'] = "http://{0}:{1}/get_youtube_api/".format(YOUTUBE_HOSTNAME, YOUTUBE_PORT) -YOUTUBE['METADATA_URL'] = "http://{0}:{1}/test_youtube/".format(YOUTUBE_HOSTNAME, YOUTUBE_PORT) -YOUTUBE['TEXT_API']['url'] = "{0}:{1}/test_transcripts_youtube/".format(YOUTUBE_HOSTNAME, YOUTUBE_PORT) +YOUTUBE['API'] = f"http://{YOUTUBE_HOSTNAME}:{YOUTUBE_PORT}/get_youtube_api/" +YOUTUBE['METADATA_URL'] = f"http://{YOUTUBE_HOSTNAME}:{YOUTUBE_PORT}/test_youtube/" +YOUTUBE['TEXT_API']['url'] = f"{YOUTUBE_HOSTNAME}:{YOUTUBE_PORT}/test_transcripts_youtube/" ############################# SECURITY SETTINGS ################################ # Default to advanced security in common.py, so tests can reset here to use diff --git a/lms/envs/bok_choy_docker.py b/lms/envs/bok_choy_docker.py index 58fe10696383129522cf2fb27b69dfa41bd2e2c9..65ca041516085a79be3670a9e998b92720becbe0 100644 --- a/lms/envs/bok_choy_docker.py +++ b/lms/envs/bok_choy_docker.py @@ -1,14 +1,12 @@ -# -*- coding: utf-8 -*- """ Settings for Bok Choy tests that are used when running Studio in Docker-based devstack. """ -# noinspection PyUnresolvedReferences from .bok_choy import * # pylint: disable=wildcard-import CMS_BASE = '{}:{}'.format(os.environ['BOK_CHOY_HOSTNAME'], os.environ.get('BOK_CHOY_CMS_PORT', 8031)) LMS_BASE = '{}:{}'.format(os.environ['BOK_CHOY_HOSTNAME'], os.environ.get('BOK_CHOY_LMS_PORT', 8003)) -LMS_ROOT_URL = 'http://{}'.format(LMS_BASE) +LMS_ROOT_URL = f'http://{LMS_BASE}' LOGIN_REDIRECT_WHITELIST = [CMS_BASE] SITE_NAME = LMS_BASE @@ -24,6 +22,6 @@ LOGGING['loggers']['tracking']['handlers'] = ['console'] # Point the URL used to test YouTube availability to our stub YouTube server BOK_CHOY_HOST = os.environ['BOK_CHOY_HOSTNAME'] -YOUTUBE['API'] = "http://{}:{}/get_youtube_api/".format(BOK_CHOY_HOST, YOUTUBE_PORT) -YOUTUBE['METADATA_URL'] = "http://{}:{}/test_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT) -YOUTUBE['TEXT_API']['url'] = "{}:{}/test_transcripts_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT) +YOUTUBE['API'] = f"http://{BOK_CHOY_HOST}:{YOUTUBE_PORT}/get_youtube_api/" +YOUTUBE['METADATA_URL'] = f"http://{BOK_CHOY_HOST}:{YOUTUBE_PORT}/test_youtube/" +YOUTUBE['TEXT_API']['url'] = f"{BOK_CHOY_HOST}:{YOUTUBE_PORT}/test_transcripts_youtube/" diff --git a/lms/envs/common.py b/lms/envs/common.py index 134eb7c989413544ae073bd4f7fe8c99ff48df74..0e126d2c6f97f750171b1b0e3979cbb07cceb925 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ This is the common settings file, intended to set sane defaults. If you have a piece of configuration that's dependent on a set of feature flags being set, @@ -30,29 +29,43 @@ Longer TODO: import importlib.util -import sys import os +import sys +################################## TEMPLATE CONFIGURATION ##################################### +# Mako templating +import tempfile # pylint: disable=wrong-import-position,wrong-import-order from corsheaders.defaults import default_headers as corsheaders_default_headers -from path import Path as path from django.utils.translation import ugettext_lazy as _ +from edx_django_utils.plugins import ( # pylint: disable=wrong-import-position,wrong-import-order + add_plugins, + get_plugin_apps +) from enterprise.constants import ( ENTERPRISE_ADMIN_ROLE, ENTERPRISE_CATALOG_ADMIN_ROLE, ENTERPRISE_DASHBOARD_ADMIN_ROLE, ENTERPRISE_ENROLLMENT_API_ADMIN_ROLE, - ENTERPRISE_REPORTING_CONFIG_ADMIN_ROLE, - ENTERPRISE_OPERATOR_ROLE + ENTERPRISE_OPERATOR_ROLE, + ENTERPRISE_REPORTING_CONFIG_ADMIN_ROLE ) +from path import Path as path -from openedx.core.constants import COURSE_KEY_REGEX, COURSE_KEY_PATTERN, COURSE_ID_PATTERN -from openedx.core.djangoapps.theming.helpers_dirs import ( - get_themes_unchecked, - get_theme_base_dirs_from_settings -) +################################# WIKI ################################### +from lms.djangoapps.course_wiki import settings as course_wiki_settings # pylint: disable=wrong-import-position +from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin +from openedx.core.constants import COURSE_ID_PATTERN, COURSE_KEY_PATTERN, COURSE_KEY_REGEX +from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType # pylint: disable=wrong-import-position +from openedx.core.djangoapps.theming.helpers_dirs import get_theme_base_dirs_from_settings, get_themes_unchecked from openedx.core.lib.derived import derived, derived_collection_entry +from openedx.core.lib.rooted_paths import rooted_glob # pylint: disable=wrong-import-position from openedx.core.release import doc_version -from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin +from xmodule.modulestore import prefer_xmodules +# Import after sys.path fixup +# pylint: disable=wrong-import-position +from xmodule.modulestore.edit_info import EditInfoMixin +from xmodule.modulestore.inheritance import InheritanceMixin +from xmodule.x_module import XModuleMixin ################################### FEATURES ################################### # .. setting_name: PLATFORM_NAME @@ -1071,9 +1084,6 @@ OAUTH_EXPIRE_PUBLIC_CLIENT_DAYS = 30 TPA_PROVIDER_BURST_THROTTLE = '10/min' TPA_PROVIDER_SUSTAINED_THROTTLE = '50/hr' -################################## TEMPLATE CONFIGURATION ##################################### -# Mako templating -import tempfile # pylint: disable=wrong-import-position,wrong-import-order MAKO_MODULE_DIR = os.path.join(tempfile.gettempdir(), 'mako_lms') MAKO_TEMPLATE_DIRS_BASE = [ PROJECT_ROOT / 'templates', @@ -1268,13 +1278,13 @@ WIKI_ENABLED = True COURSE_MODE_DEFAULTS = { 'bulk_sku': None, - 'currency': u'usd', + 'currency': 'usd', 'description': None, 'expiration_datetime': None, 'min_price': 0, - 'name': _(u'Audit'), + 'name': _('Audit'), 'sku': None, - 'slug': u'audit', + 'slug': 'audit', 'suggested_prices': '', } @@ -1291,7 +1301,7 @@ USAGE_ID_PATTERN = r'(?P<usage_id>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)| # However, backward compatibility with Ficus older releases is still maintained (space is still not valid) # in the AccountCreationForm and the user_api through the ENABLE_UNICODE_USERNAME feature flag. USERNAME_REGEX_PARTIAL = r'[\w .@_+-]+' -USERNAME_PATTERN = r'(?P<username>{regex})'.format(regex=USERNAME_REGEX_PARTIAL) +USERNAME_PATTERN = fr'(?P<username>{USERNAME_REGEX_PARTIAL})' ############################## EVENT TRACKING ################################# @@ -1383,12 +1393,6 @@ COURSE_LISTINGS = {} ############# XBlock Configuration ########## -# Import after sys.path fixup -# pylint: disable=wrong-import-position -from xmodule.modulestore.edit_info import EditInfoMixin -from xmodule.modulestore.inheritance import InheritanceMixin -from xmodule.modulestore import prefer_xmodules -from xmodule.x_module import XModuleMixin # pylint: enable=wrong-import-position # These are the Mixins that should be added to every XBlock. @@ -1650,87 +1654,87 @@ LANGUAGE_COOKIE = "openedx-language-preference" # Sourced from http://www.localeplanet.com/icu/ and wikipedia LANGUAGES = [ - ('en', u'English'), - ('rtl', u'Right-to-Left Test Language'), - ('eo', u'Dummy Language (Esperanto)'), # Dummy languaged used for testing - ('fake2', u'Fake translations'), # Another dummy language for testing (not pushed to prod) - - ('am', u'አማáˆáŠ›'), # Amharic - ('ar', u'العربية'), # Arabic - ('az', u'azÉ™rbaycanca'), # Azerbaijani - ('bg-bg', u'българÑки (БългариÑ)'), # Bulgarian (Bulgaria) - ('bn-bd', u'বাংলা (বাংলাদেশ)'), # Bengali (Bangladesh) - ('bn-in', u'বাংলা (à¦à¦¾à¦°à¦¤)'), # Bengali (India) - ('bs', u'bosanski'), # Bosnian - ('ca', u'Català '), # Catalan - ('ca@valencia', u'Català (València)'), # Catalan (Valencia) - ('cs', u'ÄŒeÅ¡tina'), # Czech - ('cy', u'Cymraeg'), # Welsh - ('da', u'dansk'), # Danish - ('de-de', u'Deutsch (Deutschland)'), # German (Germany) - ('el', u'Ελληνικά'), # Greek - ('en-uk', u'English (United Kingdom)'), # English (United Kingdom) - ('en@lolcat', u'LOLCAT English'), # LOLCAT English - ('en@pirate', u'Pirate English'), # Pirate English - ('es-419', u'Español (Latinoamérica)'), # Spanish (Latin America) - ('es-ar', u'Español (Argentina)'), # Spanish (Argentina) - ('es-ec', u'Español (Ecuador)'), # Spanish (Ecuador) - ('es-es', u'Español (España)'), # Spanish (Spain) - ('es-mx', u'Español (México)'), # Spanish (Mexico) - ('es-pe', u'Español (Perú)'), # Spanish (Peru) - ('et-ee', u'Eesti (Eesti)'), # Estonian (Estonia) - ('eu-es', u'euskara (Espainia)'), # Basque (Spain) - ('fa', u'Ùارسی'), # Persian - ('fa-ir', u'Ùارسی (ایران)'), # Persian (Iran) - ('fi-fi', u'Suomi (Suomi)'), # Finnish (Finland) - ('fil', u'Filipino'), # Filipino - ('fr', u'Français'), # French - ('gl', u'Galego'), # Galician - ('gu', u'ગà«àªœàª°àª¾àª¤à«€'), # Gujarati - ('he', u'עברית'), # Hebrew - ('hi', u'हिनà¥à¤¦à¥€'), # Hindi - ('hr', u'hrvatski'), # Croatian - ('hu', u'magyar'), # Hungarian - ('hy-am', u'Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶ (Õ€Õ¡ÕµÕ¡Õ½Õ¿Õ¡Õ¶)'), # Armenian (Armenia) - ('id', u'Bahasa Indonesia'), # Indonesian - ('it-it', u'Italiano (Italia)'), # Italian (Italy) - ('ja-jp', u'日本語 (日本)'), # Japanese (Japan) - ('kk-kz', u'қазақ тілі (ҚазақÑтан)'), # Kazakh (Kazakhstan) - ('km-kh', u'ភាសាážáŸ’មែរ (កម្ពុជា)'), # Khmer (Cambodia) - ('kn', u'ಕನà³à²¨à²¡'), # Kannada - ('ko-kr', u'í•œêµì–´ (대한민êµ)'), # Korean (Korea) - ('lt-lt', u'Lietuvių (Lietuva)'), # Lithuanian (Lithuania) - ('ml', u'മലയാളം'), # Malayalam - ('mn', u'Монгол Ñ…Ñл'), # Mongolian - ('mr', u'मराठी'), # Marathi - ('ms', u'Bahasa Melayu'), # Malay - ('nb', u'Norsk bokmÃ¥l'), # Norwegian BokmÃ¥l - ('ne', u'नेपाली'), # Nepali - ('nl-nl', u'Nederlands (Nederland)'), # Dutch (Netherlands) - ('or', u'ଓଡ଼ିଆ'), # Oriya - ('pl', u'Polski'), # Polish - ('pt-br', u'Português (Brasil)'), # Portuguese (Brazil) - ('pt-pt', u'Português (Portugal)'), # Portuguese (Portugal) - ('ro', u'română'), # Romanian - ('ru', u'РуÑÑкий'), # Russian - ('si', u'සිංහල'), # Sinhala - ('sk', u'SlovenÄina'), # Slovak - ('sl', u'SlovenÅ¡Äina'), # Slovenian - ('sq', u'shqip'), # Albanian - ('sr', u'СрпÑки'), # Serbian - ('sv', u'svenska'), # Swedish - ('sw', u'Kiswahili'), # Swahili - ('ta', u'தமிழà¯'), # Tamil - ('te', u'తెలà±à°—à±'), # Telugu - ('th', u'ไทย'), # Thai - ('tr-tr', u'Türkçe (Türkiye)'), # Turkish (Turkey) - ('uk', u'УкраїнÑька'), # Ukranian - ('ur', u'اردو'), # Urdu - ('vi', u'Tiếng Việt'), # Vietnamese - ('uz', u'Ўзбек'), # Uzbek - ('zh-cn', u'ä¸æ–‡ (简体)'), # Chinese (China) - ('zh-hk', u'ä¸æ–‡ (香港)'), # Chinese (Hong Kong) - ('zh-tw', u'ä¸æ–‡ (å°ç£)'), # Chinese (Taiwan) + ('en', 'English'), + ('rtl', 'Right-to-Left Test Language'), + ('eo', 'Dummy Language (Esperanto)'), # Dummy languaged used for testing + ('fake2', 'Fake translations'), # Another dummy language for testing (not pushed to prod) + + ('am', 'አማáˆáŠ›'), # Amharic + ('ar', 'العربية'), # Arabic + ('az', 'azÉ™rbaycanca'), # Azerbaijani + ('bg-bg', 'българÑки (БългариÑ)'), # Bulgarian (Bulgaria) + ('bn-bd', 'বাংলা (বাংলাদেশ)'), # Bengali (Bangladesh) + ('bn-in', 'বাংলা (à¦à¦¾à¦°à¦¤)'), # Bengali (India) + ('bs', 'bosanski'), # Bosnian + ('ca', 'Català '), # Catalan + ('ca@valencia', 'Català (València)'), # Catalan (Valencia) + ('cs', 'ÄŒeÅ¡tina'), # Czech + ('cy', 'Cymraeg'), # Welsh + ('da', 'dansk'), # Danish + ('de-de', 'Deutsch (Deutschland)'), # German (Germany) + ('el', 'Ελληνικά'), # Greek + ('en-uk', 'English (United Kingdom)'), # English (United Kingdom) + ('en@lolcat', 'LOLCAT English'), # LOLCAT English + ('en@pirate', 'Pirate English'), # Pirate English + ('es-419', 'Español (Latinoamérica)'), # Spanish (Latin America) + ('es-ar', 'Español (Argentina)'), # Spanish (Argentina) + ('es-ec', 'Español (Ecuador)'), # Spanish (Ecuador) + ('es-es', 'Español (España)'), # Spanish (Spain) + ('es-mx', 'Español (México)'), # Spanish (Mexico) + ('es-pe', 'Español (Perú)'), # Spanish (Peru) + ('et-ee', 'Eesti (Eesti)'), # Estonian (Estonia) + ('eu-es', 'euskara (Espainia)'), # Basque (Spain) + ('fa', 'Ùارسی'), # Persian + ('fa-ir', 'Ùارسی (ایران)'), # Persian (Iran) + ('fi-fi', 'Suomi (Suomi)'), # Finnish (Finland) + ('fil', 'Filipino'), # Filipino + ('fr', 'Français'), # French + ('gl', 'Galego'), # Galician + ('gu', 'ગà«àªœàª°àª¾àª¤à«€'), # Gujarati + ('he', 'עברית'), # Hebrew + ('hi', 'हिनà¥à¤¦à¥€'), # Hindi + ('hr', 'hrvatski'), # Croatian + ('hu', 'magyar'), # Hungarian + ('hy-am', 'Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶ (Õ€Õ¡ÕµÕ¡Õ½Õ¿Õ¡Õ¶)'), # Armenian (Armenia) + ('id', 'Bahasa Indonesia'), # Indonesian + ('it-it', 'Italiano (Italia)'), # Italian (Italy) + ('ja-jp', '日本語 (日本)'), # Japanese (Japan) + ('kk-kz', 'қазақ тілі (ҚазақÑтан)'), # Kazakh (Kazakhstan) + ('km-kh', 'ភាសាážáŸ’មែរ (កម្ពុជា)'), # Khmer (Cambodia) + ('kn', 'ಕನà³à²¨à²¡'), # Kannada + ('ko-kr', 'í•œêµì–´ (대한민êµ)'), # Korean (Korea) + ('lt-lt', 'Lietuvių (Lietuva)'), # Lithuanian (Lithuania) + ('ml', 'മലയാളം'), # Malayalam + ('mn', 'Монгол Ñ…Ñл'), # Mongolian + ('mr', 'मराठी'), # Marathi + ('ms', 'Bahasa Melayu'), # Malay + ('nb', 'Norsk bokmÃ¥l'), # Norwegian BokmÃ¥l + ('ne', 'नेपाली'), # Nepali + ('nl-nl', 'Nederlands (Nederland)'), # Dutch (Netherlands) + ('or', 'ଓଡ଼ିଆ'), # Oriya + ('pl', 'Polski'), # Polish + ('pt-br', 'Português (Brasil)'), # Portuguese (Brazil) + ('pt-pt', 'Português (Portugal)'), # Portuguese (Portugal) + ('ro', 'română'), # Romanian + ('ru', 'РуÑÑкий'), # Russian + ('si', 'සිංහල'), # Sinhala + ('sk', 'SlovenÄina'), # Slovak + ('sl', 'SlovenÅ¡Äina'), # Slovenian + ('sq', 'shqip'), # Albanian + ('sr', 'СрпÑки'), # Serbian + ('sv', 'svenska'), # Swedish + ('sw', 'Kiswahili'), # Swahili + ('ta', 'தமிழà¯'), # Tamil + ('te', 'తెలà±à°—à±'), # Telugu + ('th', 'ไทย'), # Thai + ('tr-tr', 'Türkçe (Türkiye)'), # Turkish (Turkey) + ('uk', 'УкраїнÑька'), # Ukranian + ('ur', 'اردو'), # Urdu + ('vi', 'Tiếng Việt'), # Vietnamese + ('uz', 'Ўзбек'), # Uzbek + ('zh-cn', 'ä¸æ–‡ (简体)'), # Chinese (China) + ('zh-hk', 'ä¸æ–‡ (香港)'), # Chinese (Hong Kong) + ('zh-tw', 'ä¸æ–‡ (å°ç£)'), # Chinese (Taiwan) ] LANGUAGE_DICT = dict(LANGUAGES) @@ -1786,8 +1790,6 @@ AWS_S3_CUSTOM_DOMAIN = "SET-ME-PLEASE (ex. bucket-name.s3.amazonaws.com)" SIMPLE_WIKI_REQUIRE_LOGIN_EDIT = True SIMPLE_WIKI_REQUIRE_LOGIN_VIEW = False -################################# WIKI ################################### -from lms.djangoapps.course_wiki import settings as course_wiki_settings # pylint: disable=wrong-import-position # .. toggle_name: WIKI_ACCOUNT_HANDLING # .. toggle_implementation: DjangoSetting @@ -2087,7 +2089,6 @@ STATICFILES_FINDERS = [ 'pipeline.finders.PipelineFinder', ] -from openedx.core.lib.rooted_paths import rooted_glob # pylint: disable=wrong-import-position courseware_js = [ 'js/ajax-error.js', @@ -3168,28 +3169,28 @@ SOCIAL_MEDIA_FOOTER_DISPLAY = { # translate this the way that Facebook advertises in your language. "title": _("Facebook"), "icon": "fa-facebook-square", - "action": _(u"Like {platform_name} on Facebook") + "action": _("Like {platform_name} on Facebook") }, "twitter": { # Translators: This is the website name of www.twitter.com. Please # translate this the way that Twitter advertises in your language. "title": _("Twitter"), "icon": "fa-twitter-square", - "action": _(u"Follow {platform_name} on Twitter") + "action": _("Follow {platform_name} on Twitter") }, "linkedin": { # Translators: This is the website name of www.linkedin.com. Please # translate this the way that LinkedIn advertises in your language. "title": _("LinkedIn"), "icon": "fa-linkedin-square", - "action": _(u"Follow {platform_name} on LinkedIn") + "action": _("Follow {platform_name} on LinkedIn") }, "instagram": { # Translators: This is the website name of www.instagram.com. Please # translate this the way that Instagram advertises in your language. "title": _("Instagram"), "icon": "fa-instagram", - "action": _(u"Follow {platform_name} on Instagram") + "action": _("Follow {platform_name} on Instagram") }, "tumblr": { # Translators: This is the website name of www.tumblr.com. Please @@ -3208,7 +3209,7 @@ SOCIAL_MEDIA_FOOTER_DISPLAY = { # translate this the way that Reddit advertises in your language. "title": _("Reddit"), "icon": "fa-reddit-square", - "action": _(u"Subscribe to the {platform_name} subreddit"), + "action": _("Subscribe to the {platform_name} subreddit"), }, "vk": { # Translators: This is the website name of https://vk.com. Please @@ -3227,7 +3228,7 @@ SOCIAL_MEDIA_FOOTER_DISPLAY = { # translate this the way that YouTube advertises in your language. "title": _("Youtube"), "icon": "fa-youtube-square", - "action": _(u"Subscribe to the {platform_name} YouTube channel") + "action": _("Subscribe to the {platform_name} YouTube channel") } } @@ -3498,192 +3499,192 @@ VIDEO_TRANSCRIPTS_MAX_AGE = 31536000 # Note that this is used as the set of choices to the `code` field of the # `LanguageProficiency` model. ALL_LANGUAGES = [ - [u"aa", u"Afar"], - [u"ab", u"Abkhazian"], - [u"af", u"Afrikaans"], - [u"ak", u"Akan"], - [u"sq", u"Albanian"], - [u"am", u"Amharic"], - [u"ar", u"Arabic"], - [u"an", u"Aragonese"], - [u"hy", u"Armenian"], - [u"as", u"Assamese"], - [u"av", u"Avaric"], - [u"ae", u"Avestan"], - [u"ay", u"Aymara"], - [u"az", u"Azerbaijani"], - [u"ba", u"Bashkir"], - [u"bm", u"Bambara"], - [u"eu", u"Basque"], - [u"be", u"Belarusian"], - [u"bn", u"Bengali"], - [u"bh", u"Bihari languages"], - [u"bi", u"Bislama"], - [u"bs", u"Bosnian"], - [u"br", u"Breton"], - [u"bg", u"Bulgarian"], - [u"my", u"Burmese"], - [u"ca", u"Catalan"], - [u"ch", u"Chamorro"], - [u"ce", u"Chechen"], - [u"zh", u"Chinese"], - [u"zh_HANS", u"Simplified Chinese"], - [u"zh_HANT", u"Traditional Chinese"], - [u"cu", u"Church Slavic"], - [u"cv", u"Chuvash"], - [u"kw", u"Cornish"], - [u"co", u"Corsican"], - [u"cr", u"Cree"], - [u"cs", u"Czech"], - [u"da", u"Danish"], - [u"dv", u"Divehi"], - [u"nl", u"Dutch"], - [u"dz", u"Dzongkha"], - [u"en", u"English"], - [u"eo", u"Esperanto"], - [u"et", u"Estonian"], - [u"ee", u"Ewe"], - [u"fo", u"Faroese"], - [u"fj", u"Fijian"], - [u"fi", u"Finnish"], - [u"fr", u"French"], - [u"fy", u"Western Frisian"], - [u"ff", u"Fulah"], - [u"ka", u"Georgian"], - [u"de", u"German"], - [u"gd", u"Gaelic"], - [u"ga", u"Irish"], - [u"gl", u"Galician"], - [u"gv", u"Manx"], - [u"el", u"Greek"], - [u"gn", u"Guarani"], - [u"gu", u"Gujarati"], - [u"ht", u"Haitian"], - [u"ha", u"Hausa"], - [u"he", u"Hebrew"], - [u"hz", u"Herero"], - [u"hi", u"Hindi"], - [u"ho", u"Hiri Motu"], - [u"hr", u"Croatian"], - [u"hu", u"Hungarian"], - [u"ig", u"Igbo"], - [u"is", u"Icelandic"], - [u"io", u"Ido"], - [u"ii", u"Sichuan Yi"], - [u"iu", u"Inuktitut"], - [u"ie", u"Interlingue"], - [u"ia", u"Interlingua"], - [u"id", u"Indonesian"], - [u"ik", u"Inupiaq"], - [u"it", u"Italian"], - [u"jv", u"Javanese"], - [u"ja", u"Japanese"], - [u"kl", u"Kalaallisut"], - [u"kn", u"Kannada"], - [u"ks", u"Kashmiri"], - [u"kr", u"Kanuri"], - [u"kk", u"Kazakh"], - [u"km", u"Central Khmer"], - [u"ki", u"Kikuyu"], - [u"rw", u"Kinyarwanda"], - [u"ky", u"Kirghiz"], - [u"kv", u"Komi"], - [u"kg", u"Kongo"], - [u"ko", u"Korean"], - [u"kj", u"Kuanyama"], - [u"ku", u"Kurdish"], - [u"lo", u"Lao"], - [u"la", u"Latin"], - [u"lv", u"Latvian"], - [u"li", u"Limburgan"], - [u"ln", u"Lingala"], - [u"lt", u"Lithuanian"], - [u"lb", u"Luxembourgish"], - [u"lu", u"Luba-Katanga"], - [u"lg", u"Ganda"], - [u"mk", u"Macedonian"], - [u"mh", u"Marshallese"], - [u"ml", u"Malayalam"], - [u"mi", u"Maori"], - [u"mr", u"Marathi"], - [u"ms", u"Malay"], - [u"mg", u"Malagasy"], - [u"mt", u"Maltese"], - [u"mn", u"Mongolian"], - [u"na", u"Nauru"], - [u"nv", u"Navajo"], - [u"nr", u"Ndebele, South"], - [u"nd", u"Ndebele, North"], - [u"ng", u"Ndonga"], - [u"ne", u"Nepali"], - [u"nn", u"Norwegian Nynorsk"], - [u"nb", u"BokmÃ¥l, Norwegian"], - [u"no", u"Norwegian"], - [u"ny", u"Chichewa"], - [u"oc", u"Occitan"], - [u"oj", u"Ojibwa"], - [u"or", u"Oriya"], - [u"om", u"Oromo"], - [u"os", u"Ossetian"], - [u"pa", u"Panjabi"], - [u"fa", u"Persian"], - [u"pi", u"Pali"], - [u"pl", u"Polish"], - [u"pt", u"Portuguese"], - [u"ps", u"Pushto"], - [u"qu", u"Quechua"], - [u"rm", u"Romansh"], - [u"ro", u"Romanian"], - [u"rn", u"Rundi"], - [u"ru", u"Russian"], - [u"sg", u"Sango"], - [u"sa", u"Sanskrit"], - [u"si", u"Sinhala"], - [u"sk", u"Slovak"], - [u"sl", u"Slovenian"], - [u"se", u"Northern Sami"], - [u"sm", u"Samoan"], - [u"sn", u"Shona"], - [u"sd", u"Sindhi"], - [u"so", u"Somali"], - [u"st", u"Sotho, Southern"], - [u"es", u"Spanish"], - [u"sc", u"Sardinian"], - [u"sr", u"Serbian"], - [u"ss", u"Swati"], - [u"su", u"Sundanese"], - [u"sw", u"Swahili"], - [u"sv", u"Swedish"], - [u"ty", u"Tahitian"], - [u"ta", u"Tamil"], - [u"tt", u"Tatar"], - [u"te", u"Telugu"], - [u"tg", u"Tajik"], - [u"tl", u"Tagalog"], - [u"th", u"Thai"], - [u"bo", u"Tibetan"], - [u"ti", u"Tigrinya"], - [u"to", u"Tonga (Tonga Islands)"], - [u"tn", u"Tswana"], - [u"ts", u"Tsonga"], - [u"tk", u"Turkmen"], - [u"tr", u"Turkish"], - [u"tw", u"Twi"], - [u"ug", u"Uighur"], - [u"uk", u"Ukrainian"], - [u"ur", u"Urdu"], - [u"uz", u"Uzbek"], - [u"ve", u"Venda"], - [u"vi", u"Vietnamese"], - [u"vo", u"Volapük"], - [u"cy", u"Welsh"], - [u"wa", u"Walloon"], - [u"wo", u"Wolof"], - [u"xh", u"Xhosa"], - [u"yi", u"Yiddish"], - [u"yo", u"Yoruba"], - [u"za", u"Zhuang"], - [u"zu", u"Zulu"] + ["aa", "Afar"], + ["ab", "Abkhazian"], + ["af", "Afrikaans"], + ["ak", "Akan"], + ["sq", "Albanian"], + ["am", "Amharic"], + ["ar", "Arabic"], + ["an", "Aragonese"], + ["hy", "Armenian"], + ["as", "Assamese"], + ["av", "Avaric"], + ["ae", "Avestan"], + ["ay", "Aymara"], + ["az", "Azerbaijani"], + ["ba", "Bashkir"], + ["bm", "Bambara"], + ["eu", "Basque"], + ["be", "Belarusian"], + ["bn", "Bengali"], + ["bh", "Bihari languages"], + ["bi", "Bislama"], + ["bs", "Bosnian"], + ["br", "Breton"], + ["bg", "Bulgarian"], + ["my", "Burmese"], + ["ca", "Catalan"], + ["ch", "Chamorro"], + ["ce", "Chechen"], + ["zh", "Chinese"], + ["zh_HANS", "Simplified Chinese"], + ["zh_HANT", "Traditional Chinese"], + ["cu", "Church Slavic"], + ["cv", "Chuvash"], + ["kw", "Cornish"], + ["co", "Corsican"], + ["cr", "Cree"], + ["cs", "Czech"], + ["da", "Danish"], + ["dv", "Divehi"], + ["nl", "Dutch"], + ["dz", "Dzongkha"], + ["en", "English"], + ["eo", "Esperanto"], + ["et", "Estonian"], + ["ee", "Ewe"], + ["fo", "Faroese"], + ["fj", "Fijian"], + ["fi", "Finnish"], + ["fr", "French"], + ["fy", "Western Frisian"], + ["ff", "Fulah"], + ["ka", "Georgian"], + ["de", "German"], + ["gd", "Gaelic"], + ["ga", "Irish"], + ["gl", "Galician"], + ["gv", "Manx"], + ["el", "Greek"], + ["gn", "Guarani"], + ["gu", "Gujarati"], + ["ht", "Haitian"], + ["ha", "Hausa"], + ["he", "Hebrew"], + ["hz", "Herero"], + ["hi", "Hindi"], + ["ho", "Hiri Motu"], + ["hr", "Croatian"], + ["hu", "Hungarian"], + ["ig", "Igbo"], + ["is", "Icelandic"], + ["io", "Ido"], + ["ii", "Sichuan Yi"], + ["iu", "Inuktitut"], + ["ie", "Interlingue"], + ["ia", "Interlingua"], + ["id", "Indonesian"], + ["ik", "Inupiaq"], + ["it", "Italian"], + ["jv", "Javanese"], + ["ja", "Japanese"], + ["kl", "Kalaallisut"], + ["kn", "Kannada"], + ["ks", "Kashmiri"], + ["kr", "Kanuri"], + ["kk", "Kazakh"], + ["km", "Central Khmer"], + ["ki", "Kikuyu"], + ["rw", "Kinyarwanda"], + ["ky", "Kirghiz"], + ["kv", "Komi"], + ["kg", "Kongo"], + ["ko", "Korean"], + ["kj", "Kuanyama"], + ["ku", "Kurdish"], + ["lo", "Lao"], + ["la", "Latin"], + ["lv", "Latvian"], + ["li", "Limburgan"], + ["ln", "Lingala"], + ["lt", "Lithuanian"], + ["lb", "Luxembourgish"], + ["lu", "Luba-Katanga"], + ["lg", "Ganda"], + ["mk", "Macedonian"], + ["mh", "Marshallese"], + ["ml", "Malayalam"], + ["mi", "Maori"], + ["mr", "Marathi"], + ["ms", "Malay"], + ["mg", "Malagasy"], + ["mt", "Maltese"], + ["mn", "Mongolian"], + ["na", "Nauru"], + ["nv", "Navajo"], + ["nr", "Ndebele, South"], + ["nd", "Ndebele, North"], + ["ng", "Ndonga"], + ["ne", "Nepali"], + ["nn", "Norwegian Nynorsk"], + ["nb", "BokmÃ¥l, Norwegian"], + ["no", "Norwegian"], + ["ny", "Chichewa"], + ["oc", "Occitan"], + ["oj", "Ojibwa"], + ["or", "Oriya"], + ["om", "Oromo"], + ["os", "Ossetian"], + ["pa", "Panjabi"], + ["fa", "Persian"], + ["pi", "Pali"], + ["pl", "Polish"], + ["pt", "Portuguese"], + ["ps", "Pushto"], + ["qu", "Quechua"], + ["rm", "Romansh"], + ["ro", "Romanian"], + ["rn", "Rundi"], + ["ru", "Russian"], + ["sg", "Sango"], + ["sa", "Sanskrit"], + ["si", "Sinhala"], + ["sk", "Slovak"], + ["sl", "Slovenian"], + ["se", "Northern Sami"], + ["sm", "Samoan"], + ["sn", "Shona"], + ["sd", "Sindhi"], + ["so", "Somali"], + ["st", "Sotho, Southern"], + ["es", "Spanish"], + ["sc", "Sardinian"], + ["sr", "Serbian"], + ["ss", "Swati"], + ["su", "Sundanese"], + ["sw", "Swahili"], + ["sv", "Swedish"], + ["ty", "Tahitian"], + ["ta", "Tamil"], + ["tt", "Tatar"], + ["te", "Telugu"], + ["tg", "Tajik"], + ["tl", "Tagalog"], + ["th", "Thai"], + ["bo", "Tibetan"], + ["ti", "Tigrinya"], + ["to", "Tonga (Tonga Islands)"], + ["tn", "Tswana"], + ["ts", "Tsonga"], + ["tk", "Turkmen"], + ["tr", "Turkish"], + ["tw", "Twi"], + ["ug", "Uighur"], + ["uk", "Ukrainian"], + ["ur", "Urdu"], + ["uz", "Uzbek"], + ["ve", "Venda"], + ["vi", "Vietnamese"], + ["vo", "Volapük"], + ["cy", "Welsh"], + ["wa", "Walloon"], + ["wo", "Wolof"], + ["xh", "Xhosa"], + ["yi", "Yiddish"], + ["yo", "Yoruba"], + ["za", "Zhuang"], + ["zu", "Zulu"] ] @@ -3900,7 +3901,7 @@ ECOMMERCE_SERVICE_WORKER_USERNAME = 'ecommerce_worker' ECOMMERCE_API_SIGNING_KEY = 'SET-ME-PLEASE' COURSE_CATALOG_URL_ROOT = 'http://localhost:8008' -COURSE_CATALOG_API_URL = '{}/api/v1'.format(COURSE_CATALOG_URL_ROOT) +COURSE_CATALOG_API_URL = f'{COURSE_CATALOG_URL_ROOT}/api/v1' CREDENTIALS_INTERNAL_SERVICE_URL = 'http://localhost:8005' CREDENTIALS_PUBLIC_SERVICE_URL = 'http://localhost:8005' @@ -4230,17 +4231,17 @@ ENTERPRISE_ALL_SERVICE_USERNAMES = [ # which are not provided by the Enterprise service. These settings provide base values # for those features. -ENTERPRISE_PLATFORM_WELCOME_TEMPLATE = _(u'Welcome to {platform_name}.') +ENTERPRISE_PLATFORM_WELCOME_TEMPLATE = _('Welcome to {platform_name}.') ENTERPRISE_SPECIFIC_BRANDED_WELCOME_TEMPLATE = _( - u'You have left the {start_bold}{enterprise_name}{end_bold} website and are now on the {platform_name} site. ' - u'{enterprise_name} has partnered with {platform_name} to offer you high-quality, always available learning ' - u'programs to help you advance your knowledge and career. ' - u'{line_break}Please note that {platform_name} has a different {privacy_policy_link_start}Privacy Policy' - u'{privacy_policy_link_end} from {enterprise_name}.' + 'You have left the {start_bold}{enterprise_name}{end_bold} website and are now on the {platform_name} site. ' + '{enterprise_name} has partnered with {platform_name} to offer you high-quality, always available learning ' + 'programs to help you advance your knowledge and career. ' + '{line_break}Please note that {platform_name} has a different {privacy_policy_link_start}Privacy Policy' + '{privacy_policy_link_end} from {enterprise_name}.' ) ENTERPRISE_PROXY_LOGIN_WELCOME_TEMPLATE = _( - u'{start_bold}{enterprise_name}{end_bold} has partnered with {start_bold}{platform_name}{end_bold} ' - u'to offer you high-quality learning opportunities from the world\'s best institutions and universities.' + '{start_bold}{enterprise_name}{end_bold} has partnered with {start_bold}{platform_name}{end_bold} ' + 'to offer you high-quality learning opportunities from the world\'s best institutions and universities.' ) ENTERPRISE_TAGLINE = '' ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS = { @@ -4540,8 +4541,6 @@ SYSTEM_WIDE_ROLE_CLASSES = [] ############## Plugin Django Apps ######################### -from edx_django_utils.plugins import get_plugin_apps, add_plugins # pylint: disable=wrong-import-position,wrong-import-order -from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType # pylint: disable=wrong-import-position INSTALLED_APPS.extend(get_plugin_apps(ProjectType.LMS)) add_plugins(__name__, ProjectType.LMS, SettingsType.COMMON) diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index f34dc185a239dba08cfc1391088e749f7a18ac3d..d12a55c6c26a472c4d1fbfa50780ab97c2a07bf3 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -8,7 +8,6 @@ import logging from os.path import abspath, dirname, join from corsheaders.defaults import default_headers as corsheaders_default_headers - # pylint: enable=unicode-format-string # lint-amnesty, pylint: disable=bad-option-value ##################################################################### from edx_django_utils.plugins import add_plugins @@ -34,9 +33,9 @@ SITE_NAME = LMS_BASE CELERY_ALWAYS_EAGER = True HTTPS = 'off' -LMS_ROOT_URL = 'http://{}'.format(LMS_BASE) +LMS_ROOT_URL = f'http://{LMS_BASE}' LMS_INTERNAL_ROOT_URL = LMS_ROOT_URL -ENTERPRISE_API_URL = '{}/enterprise/api/v1/'.format(LMS_INTERNAL_ROOT_URL) +ENTERPRISE_API_URL = f'{LMS_INTERNAL_ROOT_URL}/enterprise/api/v1/' IDA_LOGOUT_URI_LIST = [ 'http://localhost:18130/logout/', # ecommerce 'http://localhost:18150/logout/', # credentials @@ -280,10 +279,10 @@ LOGIN_REDIRECT_WHITELIST = [ ###################### JWTs ###################### JWT_AUTH.update({ 'JWT_AUDIENCE': 'lms-key', - 'JWT_ISSUER': '{}/oauth2'.format(LMS_ROOT_URL), + 'JWT_ISSUER': f'{LMS_ROOT_URL}/oauth2', 'JWT_ISSUERS': [{ 'AUDIENCE': 'lms-key', - 'ISSUER': '{}/oauth2'.format(LMS_ROOT_URL), + 'ISSUER': f'{LMS_ROOT_URL}/oauth2', 'SECRET_KEY': 'lms-secret', }], 'JWT_SECRET_KEY': 'lms-secret', @@ -382,7 +381,7 @@ ENTERPRISE_MARKETING_FOOTER_QUERY_PARAMS = {} CREDENTIALS_SERVICE_USERNAME = 'credentials_worker' COURSE_CATALOG_URL_ROOT = 'http://edx.devstack.discovery:18381' -COURSE_CATALOG_API_URL = '{}/api/v1'.format(COURSE_CATALOG_URL_ROOT) +COURSE_CATALOG_API_URL = f'{COURSE_CATALOG_URL_ROOT}/api/v1' SYSTEM_WIDE_ROLE_CLASSES = os.environ.get("SYSTEM_WIDE_ROLE_CLASSES", SYSTEM_WIDE_ROLE_CLASSES) SYSTEM_WIDE_ROLE_CLASSES.append( diff --git a/lms/envs/devstack_decentralized.py b/lms/envs/devstack_decentralized.py index f288787b1ab5fbe6cdd33800969d7f9b3f40225b..b570ac8994aefe169da3f7ea0b1aff7e66543494 100644 --- a/lms/envs/devstack_decentralized.py +++ b/lms/envs/devstack_decentralized.py @@ -7,7 +7,6 @@ import logging from os.path import abspath, dirname, join from corsheaders.defaults import default_headers as corsheaders_default_headers - # pylint: enable=unicode-format-string # lint-amnesty, pylint: disable=bad-option-value ##################################################################### from edx_django_utils.plugins import add_plugins @@ -33,9 +32,9 @@ SITE_NAME = LMS_BASE CELERY_ALWAYS_EAGER = True HTTPS = 'off' -LMS_ROOT_URL = 'http://{}'.format(LMS_BASE) +LMS_ROOT_URL = f'http://{LMS_BASE}' LMS_INTERNAL_ROOT_URL = LMS_ROOT_URL -ENTERPRISE_API_URL = '{}/enterprise/api/v1/'.format(LMS_INTERNAL_ROOT_URL) +ENTERPRISE_API_URL = f'{LMS_INTERNAL_ROOT_URL}/enterprise/api/v1/' IDA_LOGOUT_URI_LIST = [ 'http://localhost:18130/logout/', # ecommerce 'http://localhost:18150/logout/', # credentials @@ -218,10 +217,10 @@ LOGIN_REDIRECT_WHITELIST = [CMS_BASE] ###################### JWTs ###################### JWT_AUTH.update({ 'JWT_AUDIENCE': 'lms-key', - 'JWT_ISSUER': '{}/oauth2'.format(LMS_ROOT_URL), + 'JWT_ISSUER': f'{LMS_ROOT_URL}/oauth2', 'JWT_ISSUERS': [{ 'AUDIENCE': 'lms-key', - 'ISSUER': '{}/oauth2'.format(LMS_ROOT_URL), + 'ISSUER': f'{LMS_ROOT_URL}/oauth2', 'SECRET_KEY': 'lms-secret', }], 'JWT_SECRET_KEY': 'lms-secret', @@ -321,7 +320,7 @@ ENTERPRISE_MARKETING_FOOTER_QUERY_PARAMS = {} CREDENTIALS_SERVICE_USERNAME = 'credentials_worker' COURSE_CATALOG_URL_ROOT = 'http://edx.devstack.discovery:18381' -COURSE_CATALOG_API_URL = '{}/api/v1'.format(COURSE_CATALOG_URL_ROOT) +COURSE_CATALOG_API_URL = f'{COURSE_CATALOG_URL_ROOT}/api/v1' SYSTEM_WIDE_ROLE_CLASSES = os.environ.get("SYSTEM_WIDE_ROLE_CLASSES", SYSTEM_WIDE_ROLE_CLASSES) SYSTEM_WIDE_ROLE_CLASSES.append( diff --git a/lms/envs/devstack_optimized.py b/lms/envs/devstack_optimized.py index b8d7cceea3730de2156ae74096cc275b1e2b29ab..bfd67b310edc676e525cc982c338348a35ff1cf3 100644 --- a/lms/envs/devstack_optimized.py +++ b/lms/envs/devstack_optimized.py @@ -21,9 +21,10 @@ invoked each time that changes have been made. import os # lint-amnesty, pylint: disable=unused-import +from .devstack import * # pylint: disable=wildcard-import + ########################## Devstack settings ################################### -from .devstack import * # pylint: disable=wildcard-import TEST_ROOT = REPO_ROOT / "test_root" diff --git a/lms/envs/devstack_with_worker.py b/lms/envs/devstack_with_worker.py index 359685275717dc0d20129e90ebda2b2a1d9c9f60..e1669f8f5378b7029e683d015616419e89fefd83 100644 --- a/lms/envs/devstack_with_worker.py +++ b/lms/envs/devstack_with_worker.py @@ -14,9 +14,6 @@ In two separate processes on devstack: import os # lint-amnesty, pylint: disable=unused-import -# We intentionally define lots of variables that aren't used, and -# want to import all variables from base settings files -# pylint: disable=wildcard-import, unused-wildcard-import from lms.envs.devstack import * # Require a separate celery worker diff --git a/lms/envs/production.py b/lms/envs/production.py index f0b3ed5635109ad65c718f08c672bc0570f5df78..133b3e76212c380db7a20720bdf1e90aaf3269a7 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ This is the default template for our main set of AWS servers. @@ -43,7 +41,7 @@ def get_env_setting(setting): try: return os.environ[setting] except KeyError: - error_msg = u"Set the %s env variable" % setting + error_msg = "Set the %s env variable" % setting raise ImproperlyConfigured(error_msg) # lint-amnesty, pylint: disable=raise-missing-from ################################ ALWAYS THE SAME ############################## @@ -135,11 +133,11 @@ CELERYD_PREFETCH_MULTIPLIER = 1 QUEUE_VARIANT = CONFIG_PREFIX.lower() -CELERY_DEFAULT_EXCHANGE = 'edx.{0}core'.format(QUEUE_VARIANT) +CELERY_DEFAULT_EXCHANGE = f'edx.{QUEUE_VARIANT}core' -HIGH_PRIORITY_QUEUE = 'edx.{0}core.high'.format(QUEUE_VARIANT) -DEFAULT_PRIORITY_QUEUE = 'edx.{0}core.default'.format(QUEUE_VARIANT) -HIGH_MEM_QUEUE = 'edx.{0}core.high_mem'.format(QUEUE_VARIANT) +HIGH_PRIORITY_QUEUE = f'edx.{QUEUE_VARIANT}core.high' +DEFAULT_PRIORITY_QUEUE = f'edx.{QUEUE_VARIANT}core.default' +HIGH_MEM_QUEUE = f'edx.{QUEUE_VARIANT}core.high_mem' CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE @@ -360,7 +358,7 @@ if "TRACKING_IGNORE_URL_PATTERNS" in ENV_TOKENS: SSL_AUTH_EMAIL_DOMAIN = ENV_TOKENS.get("SSL_AUTH_EMAIL_DOMAIN", "MIT.EDU") SSL_AUTH_DN_FORMAT_STRING = ENV_TOKENS.get( "SSL_AUTH_DN_FORMAT_STRING", - u"/C=US/ST=Massachusetts/O=Massachusetts Institute of Technology/OU=Client CA v1/CN={0}/emailAddress={1}" + "/C=US/ST=Massachusetts/O=Massachusetts Institute of Technology/OU=Client CA v1/CN={0}/emailAddress={1}" ) # Video Caching. Pairing country codes with CDN URLs. @@ -534,11 +532,11 @@ CELERY_BROKER_VHOST = ENV_TOKENS.get("CELERY_BROKER_VHOST", "") CELERY_BROKER_USER = AUTH_TOKENS.get("CELERY_BROKER_USER", "") CELERY_BROKER_PASSWORD = AUTH_TOKENS.get("CELERY_BROKER_PASSWORD", "") -BROKER_URL = "{0}://{1}:{2}@{3}/{4}".format(CELERY_BROKER_TRANSPORT, - CELERY_BROKER_USER, - CELERY_BROKER_PASSWORD, - CELERY_BROKER_HOSTNAME, - CELERY_BROKER_VHOST) +BROKER_URL = "{}://{}:{}@{}/{}".format(CELERY_BROKER_TRANSPORT, + CELERY_BROKER_USER, + CELERY_BROKER_PASSWORD, + CELERY_BROKER_HOSTNAME, + CELERY_BROKER_VHOST) BROKER_USE_SSL = ENV_TOKENS.get('CELERY_BROKER_USE_SSL', False) BROKER_TRANSPORT_OPTIONS = { diff --git a/lms/envs/test.py b/lms/envs/test.py index f3f1d3974b4fe2d7755802fb5b22040d9e2bd637..d21744605551f718ad8ed55ade0e558c5d60369b 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ This config file runs the simplest dev environment using sqlite, and db-based sessions. Assumes structure: @@ -18,15 +17,15 @@ import logging import os from collections import OrderedDict from random import choice # lint-amnesty, pylint: disable=unused-import -from string import digits, ascii_letters, punctuation # lint-amnesty, pylint: disable=unused-import +from string import ascii_letters, digits, punctuation # lint-amnesty, pylint: disable=unused-import from uuid import uuid4 import openid.oidutil from django.utils.translation import ugettext_lazy from edx_django_utils.plugins import add_plugins from path import Path as path -from six.moves import range # lint-amnesty, pylint: disable=unused-import +from common.djangoapps.util.testing import patch_sessions, patch_testcase # pylint: disable=wrong-import-order from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType from openedx.core.lib.derived import derive_settings from openedx.core.lib.tempdir import mkdtemp_clean @@ -34,8 +33,6 @@ from xmodule.modulestore.modulestore_settings import update_module_store_setting from .common import * -from common.djangoapps.util.testing import patch_sessions, patch_testcase # pylint: disable=wrong-import-order - # This patch disables the commit_on_success decorator during tests # in TestCase subclasses. patch_testcase() @@ -130,7 +127,7 @@ COMMENTS_SERVICE_URL = 'http://localhost:4567' DJFS = { 'type': 'osfs', - 'directory_root': '{}/django-pyfs/static/django-pyfs'.format(DATA_DIR), + 'directory_root': f'{DATA_DIR}/django-pyfs/static/django-pyfs', 'url_root': '/static/django-pyfs', } @@ -168,7 +165,7 @@ update_module_store_settings( doc_store_settings={ 'host': MONGO_HOST, 'port': MONGO_PORT_NUM, - 'db': 'test_xmodule_{}'.format(THIS_UUID), + 'db': f'test_xmodule_{THIS_UUID}', 'collection': 'test_modulestore', }, ) @@ -177,7 +174,7 @@ CONTENTSTORE = { 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore', 'DOC_STORE_CONFIG': { 'host': MONGO_HOST, - 'db': 'test_xcontent_{}'.format(THIS_UUID), + 'db': f'test_xcontent_{THIS_UUID}', 'port': MONGO_PORT_NUM, } } @@ -384,8 +381,8 @@ openid.oidutil.log = lambda message, level=0: None # Include a non-ascii character in PLATFORM_NAME and PLATFORM_DESCRIPTION to uncover possible # UnicodeEncodeErrors in tests. Also use lazy text to reveal possible json dumps errors -PLATFORM_NAME = ugettext_lazy(u"édX") -PLATFORM_DESCRIPTION = ugettext_lazy(u"Open édX Platform") +PLATFORM_NAME = ugettext_lazy("édX") +PLATFORM_DESCRIPTION = ugettext_lazy("Open édX Platform") SITE_NAME = "edx.org" @@ -478,7 +475,7 @@ COURSE_BLOCKS_API_EXTRA_FIELDS = [ ] COURSE_CATALOG_URL_ROOT = 'https://catalog.example.com' -COURSE_CATALOG_API_URL = '{}/api/v1'.format(COURSE_CATALOG_URL_ROOT) +COURSE_CATALOG_API_URL = f'{COURSE_CATALOG_URL_ROOT}/api/v1' COMPREHENSIVE_THEME_DIRS = [REPO_ROOT / "themes", REPO_ROOT / "common/test"] COMPREHENSIVE_THEME_LOCALE_PATHS = [REPO_ROOT / "themes/conf/locale", ] diff --git a/lms/lib/courseware_search/lms_filter_generator.py b/lms/lib/courseware_search/lms_filter_generator.py index b517c24f42335346551bd072c585fe2cdd49f1f0..fe753c9269a526306791abed8c003ef072961bba 100644 --- a/lms/lib/courseware_search/lms_filter_generator.py +++ b/lms/lib/courseware_search/lms_filter_generator.py @@ -7,10 +7,10 @@ This file contains implementation override of SearchFilterGenerator which will a import six from search.filter_generator import SearchFilterGenerator +from common.djangoapps.student.models import CourseEnrollment from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme -from common.djangoapps.student.models import CourseEnrollment INCLUDE_SCHEMES = [CohortPartitionScheme, RandomUserPartitionScheme, ] SCHEME_SUPPORTS_ASSIGNMENT = [RandomUserPartitionScheme, ] @@ -29,12 +29,12 @@ class LmsSearchFilterGenerator(SearchFilterGenerator): def field_dictionary(self, **kwargs): """ add course if provided otherwise add courses in which the user is enrolled in """ - field_dictionary = super(LmsSearchFilterGenerator, self).field_dictionary(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments + field_dictionary = super().field_dictionary(**kwargs) if not kwargs.get('user'): field_dictionary['course'] = [] elif not kwargs.get('course_id'): user_enrollments = self._enrollments_for_user(kwargs['user']) - field_dictionary['course'] = [six.text_type(enrollment.course_id) for enrollment in user_enrollments] + field_dictionary['course'] = [str(enrollment.course_id) for enrollment in user_enrollments] # if we have an org filter, only include results for this org filter course_org_filter = configuration_helpers.get_current_site_orgs() @@ -47,7 +47,7 @@ class LmsSearchFilterGenerator(SearchFilterGenerator): """ Exclude any courses defined outside the current org. """ - exclude_dictionary = super(LmsSearchFilterGenerator, self).exclude_dictionary(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments + exclude_dictionary = super().exclude_dictionary(**kwargs) course_org_filter = configuration_helpers.get_current_site_orgs() # If we have a course filter we are ensuring that we only get those courses above if not course_org_filter: diff --git a/lms/lib/courseware_search/test/test_lms_filter_generator.py b/lms/lib/courseware_search/test/test_lms_filter_generator.py index 46745b56f464d80d3476c2c31199d9393f72f579..26289e314bfd976ed1e0ccc49142f3f167004391 100644 --- a/lms/lib/courseware_search/test/test_lms_filter_generator.py +++ b/lms/lib/courseware_search/test/test_lms_filter_generator.py @@ -3,12 +3,13 @@ Tests for the lms_filter_generator """ +from unittest.mock import Mock, patch + import six -from mock import Mock, patch -from lms.lib.courseware_search.lms_filter_generator import LmsSearchFilterGenerator from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.tests.factories import UserFactory +from lms.lib.courseware_search.lms_filter_generator import LmsSearchFilterGenerator from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory @@ -52,7 +53,7 @@ class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase): ) def setUp(self): - super(LmsSearchFilterGeneratorTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.build_courses() self.user = UserFactory.create(username="jack", email="jack@fake.edx.org", password='test') @@ -66,8 +67,8 @@ class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase): field_dictionary, filter_dictionary, _ = LmsSearchFilterGenerator.generate_field_filters(user=self.user) assert 'start_date' in filter_dictionary - assert six.text_type(self.courses[0].id) in field_dictionary['course'] - assert six.text_type(self.courses[1].id) in field_dictionary['course'] + assert str(self.courses[0].id) in field_dictionary['course'] + assert str(self.courses[1].id) in field_dictionary['course'] def test_course_id_provided(self): """ @@ -75,11 +76,11 @@ class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase): """ field_dictionary, filter_dictionary, _ = LmsSearchFilterGenerator.generate_field_filters( user=self.user, - course_id=six.text_type(self.courses[0].id) + course_id=str(self.courses[0].id) ) assert 'start_date' in filter_dictionary - assert six.text_type(self.courses[0].id) == field_dictionary['course'] + assert str(self.courses[0].id) == field_dictionary['course'] def test_user_not_provided(self): """ diff --git a/lms/lib/courseware_search/test/test_lms_result_processor.py b/lms/lib/courseware_search/test/test_lms_result_processor.py index f58ffd357746b0ab3a0784d37c5c8af5d0e4da35..6464e9b0377de6df49cc51da149c8d9930846bd1 100644 --- a/lms/lib/courseware_search/test/test_lms_result_processor.py +++ b/lms/lib/courseware_search/test/test_lms_result_processor.py @@ -3,7 +3,6 @@ Tests for the lms_result_processor """ -import six import pytest from lms.djangoapps.courseware.tests.factories import UserFactory @@ -64,7 +63,7 @@ class LmsSearchResultProcessorTestCase(ModuleStoreTestCase): ) def setUp(self): - super(LmsSearchResultProcessorTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.build_course() def test_url_parameter(self): @@ -76,15 +75,15 @@ class LmsSearchResultProcessorTestCase(ModuleStoreTestCase): srp = LmsSearchResultProcessor( { - "course": six.text_type(self.course.id), - "id": six.text_type(self.html.scope_ids.usage_id), + "course": str(self.course.id), + "id": str(self.html.scope_ids.usage_id), "content": {"text": "This is the html text"} }, "test" ) - assert srp.url == '/courses/{}/jump_to/{}'.format(six.text_type(self.course.id), - six.text_type(self.html.scope_ids.usage_id)) + assert srp.url == '/courses/{}/jump_to/{}'.format(str(self.course.id), + str(self.html.scope_ids.usage_id)) def test_should_remove(self): """ @@ -92,8 +91,8 @@ class LmsSearchResultProcessorTestCase(ModuleStoreTestCase): """ srp = LmsSearchResultProcessor( { - "course": six.text_type(self.course.id), - "id": six.text_type(self.html.scope_ids.usage_id), + "course": str(self.course.id), + "id": str(self.html.scope_ids.usage_id), "content": {"text": "This is html test text"} }, "test" diff --git a/lms/lib/tests/test_utils.py b/lms/lib/tests/test_utils.py index ef5776ecd0cade48011f1f729b0cb39221ed14ae..01c2e00e2fde36aacdb4ec4ed5eb6a18a08535ee 100644 --- a/lms/lib/tests/test_utils.py +++ b/lms/lib/tests/test_utils.py @@ -18,7 +18,7 @@ class LmsUtilsTest(ModuleStoreTestCase): """ Setup a dummy course content. """ - super(LmsUtilsTest, self).setUp() + super().setUp() with self.store.default_store(ModuleStoreEnum.Type.mongo): self.course = CourseFactory.create() diff --git a/lms/lib/xblock/test/test_mixin.py b/lms/lib/xblock/test/test_mixin.py index 058fd0f2aa430eacddc6f630da03f53353f2d8f4..8a3a005e0b85a47c8a3510e1e16db68a44d54c3d 100644 --- a/lms/lib/xblock/test/test_mixin.py +++ b/lms/lib/xblock/test/test_mixin.py @@ -70,7 +70,7 @@ class XBlockValidationTest(LmsXBlockMixinTestCase): Unit tests for XBlock validation """ def setUp(self): - super(XBlockValidationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.build_course() def verify_validation_message(self, message, expected_message, expected_message_type): @@ -280,7 +280,7 @@ class OpenAssessmentBlockMixinTestCase(ModuleStoreTestCase): """ def setUp(self): - super(OpenAssessmentBlockMixinTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.course = CourseFactory.create() self.section = ItemFactory.create(parent=self.course, category='chapter', display_name='Test Section') self.open_assessment = ItemFactory.create( @@ -378,7 +378,7 @@ def ddt_named(parent, child): Helper to get more readable dynamically-generated test names from ddt. """ args = RenamedTuple([parent, child]) - args.__name__ = 'parent_{}_child_{}'.format(parent, child) # pylint: disable=attribute-defined-outside-init + args.__name__ = f'parent_{parent}_child_{child}' # pylint: disable=attribute-defined-outside-init return args @@ -406,7 +406,7 @@ class XBlockMergedGroupAccessTest(LmsXBlockMixinTestCase): ) def setUp(self): - super(XBlockMergedGroupAccessTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.build_course() def verify_group_access(self, block_location, expected_dict): diff --git a/lms/tests.py b/lms/tests.py index 7785abe0ba0222737131921a03a49e1f0cf23af9..b02a364b8792d5b325ce52da1276306d7081bbd3 100644 --- a/lms/tests.py +++ b/lms/tests.py @@ -4,7 +4,6 @@ import logging import mimetypes -from django.conf import settings # lint-amnesty, pylint: disable=unused-import from django.test import TestCase log = logging.getLogger(__name__) diff --git a/lms/urls.py b/lms/urls.py index 5e9f0a523b8e5ff23a93b8510f929e14bb5ae9b5..5642b9d0ba950c2bb7dd573c701667b1eadd3250 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -14,8 +14,9 @@ from edx_api_doc_tools import make_docs_urls from edx_django_utils.plugins import get_plugin_url_patterns from ratelimitbackend import admin +from common.djangoapps.student import views as student_views +from common.djangoapps.util import views as util_views from lms.djangoapps.branding import views as branding_views -from lms.djangoapps.debug import views as debug_views from lms.djangoapps.certificates import views as certificates_views from lms.djangoapps.courseware.masquerade import MasqueradeView from lms.djangoapps.courseware.module_render import ( @@ -27,13 +28,14 @@ from lms.djangoapps.courseware.module_render import ( from lms.djangoapps.courseware.views import views as courseware_views from lms.djangoapps.courseware.views.index import CoursewareIndex from lms.djangoapps.courseware.views.views import CourseTabView, EnrollStaffView, StaticCourseTabView +from lms.djangoapps.debug import views as debug_views from lms.djangoapps.discussion import views as discussion_views from lms.djangoapps.discussion.config.settings import is_forum_daily_digest_enabled from lms.djangoapps.discussion.notification_prefs import views as notification_prefs_views from lms.djangoapps.instructor.views import instructor_dashboard as instructor_dashboard_views from lms.djangoapps.instructor_task import views as instructor_task_views -from lms.djangoapps.staticbook import views as staticbook_views from lms.djangoapps.static_template_view import views as static_template_view_views +from lms.djangoapps.staticbook import views as staticbook_views from openedx.core.apidocs import api_info from openedx.core.djangoapps.auth_exchange.views import LoginWithAccessTokenView from openedx.core.djangoapps.catalog.models import CatalogIntegration @@ -52,8 +54,6 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_ from openedx.core.djangoapps.user_authn.views.login import redirect_to_lms_login from openedx.core.djangoapps.verified_track_content import views as verified_track_content_views from openedx.features.enterprise_support.api import enterprise_enabled -from common.djangoapps.student import views as student_views -from common.djangoapps.util import views as util_views RESET_COURSE_DEADLINES_NAME = 'reset_course_deadlines' RENDER_XBLOCK_NAME = 'render_xblock' @@ -256,9 +256,9 @@ if settings.WIKI_ENABLED: # These urls are for viewing the wiki in the context of a course. They should # never be returned by a reverse() so they come after the other url patterns - url(r'^courses/{}/course_wiki/?$'.format(settings.COURSE_ID_PATTERN), + url(fr'^courses/{settings.COURSE_ID_PATTERN}/course_wiki/?$', course_wiki_views.course_wiki_redirect, name='course_wiki'), - url(r'^courses/{}/wiki/'.format(settings.COURSE_KEY_REGEX), + url(fr'^courses/{settings.COURSE_KEY_REGEX}/wiki/', include((wiki_url_patterns, 'course_wiki_do_not_reverse'), namespace='course_wiki_do_not_reverse')), ] @@ -314,7 +314,7 @@ urlpatterns += [ # passed as a 'view' parameter to the URL. # Note: This is not an API. Compare this with the xblock_view API above. url( - r'^xblock/{usage_key_string}$'.format(usage_key_string=settings.USAGE_KEY_PATTERN), + fr'^xblock/{settings.USAGE_KEY_PATTERN}$', courseware_views.render_xblock, name=RENDER_XBLOCK_NAME, ), @@ -664,7 +664,7 @@ urlpatterns += [ # Calendar Sync UI in LMS url( - r'^courses/{}/'.format(settings.COURSE_ID_PATTERN,), + fr'^courses/{settings.COURSE_ID_PATTERN}/', include('openedx.features.calendar_sync.urls'), ), @@ -912,7 +912,7 @@ urlpatterns += [ # Custom courses on edX (CCX) URLs if settings.FEATURES.get('CUSTOM_COURSES_EDX'): urlpatterns += [ - url(r'^courses/{}/'.format(settings.COURSE_ID_PATTERN), + url(fr'^courses/{settings.COURSE_ID_PATTERN}/', include('lms.djangoapps.ccx.urls')), url(r'^api/ccx/', include(('lms.djangoapps.ccx.api.urls', 'lms.djangoapps.ccx'), namespace='ccx_api')), ] diff --git a/lms/wsgi.py b/lms/wsgi.py index 5fc9188f63a9a5ac9de6b2cf14fdf732116976a0..2e16f258bc757081f98fe045b1d678d37638efbe 100644 --- a/lms/wsgi.py +++ b/lms/wsgi.py @@ -8,28 +8,32 @@ It exposes a module-level variable named ``application``. Django's ``WSGI_APPLICATION`` setting. """ +import os # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position + +# Disable PyContract contract checking when running as a webserver +import contracts # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position +# This application object is used by the development server +# as well as any WSGI server configured to use this file. +from django.core.wsgi import \ + get_wsgi_application # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position + +import lms.startup as startup # lint-amnesty, pylint: disable=wrong-import-position # Patch the xml libs from safe_lxml import defuse_xml_libs +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-position + defuse_xml_libs() -# Disable PyContract contract checking when running as a webserver -import contracts # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position contracts.disable_all() -import os # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.envs.aws") -import lms.startup as startup # lint-amnesty, pylint: disable=wrong-import-position startup.run() -from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-position # Trigger a forced initialization of our modulestores since this can take a # while to complete and we want this done before HTTP requests are accepted. modulestore() -# This application object is used by the development server -# as well as any WSGI server configured to use this file. -from django.core.wsgi import get_wsgi_application # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position application = get_wsgi_application() diff --git a/lms/wsgi_apache_lms.py b/lms/wsgi_apache_lms.py index 00eaac9bb010ab19c9f5f88640647f4a237d765b..d7d63999f8cf9397a0c603421d1a6833176fac8e 100644 --- a/lms/wsgi_apache_lms.py +++ b/lms/wsgi_apache_lms.py @@ -5,19 +5,23 @@ This module contains the WSGI application used for Apache deployment. It exposes a module-level variable named ``application``. """ +import os # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position + +# This application object is used by the development server +# as well as any WSGI server configured to use this file. +from django.core.wsgi import \ + get_wsgi_application # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position + +import lms.startup as startup # lint-amnesty, pylint: disable=wrong-import-position # Patch the xml libs before anything else. from safe_lxml import defuse_xml_libs + defuse_xml_libs() -import os # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.envs.aws") os.environ.setdefault("SERVICE_VARIANT", "lms") -import lms.startup as startup # lint-amnesty, pylint: disable=wrong-import-position startup.run() -# This application object is used by the development server -# as well as any WSGI server configured to use this file. -from django.core.wsgi import get_wsgi_application # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position application = get_wsgi_application() # pylint: disable=invalid-name