diff --git a/lms/djangoapps/branding/api.py b/lms/djangoapps/branding/api.py
index c365c79d1f..5ca86846c4 100644
--- a/lms/djangoapps/branding/api.py
+++ b/lms/djangoapps/branding/api.py
@@ -22,8 +22,8 @@ from django.urls import reverse
from django.utils.translation import ugettext as _
from six.moves.urllib.parse import urljoin
-from lms.djangoapps.branding.models import BrandingApiConfig
from common.djangoapps.edxmako.shortcuts import marketing_link
+from lms.djangoapps.branding.models import BrandingApiConfig
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger("edx.footer")
@@ -126,9 +126,9 @@ def _footer_copyright():
return _(
# Translators: 'edX' and 'Open edX' are trademarks of 'edX Inc.'.
# Please do not translate any of these trademarks and company names.
- u"\u00A9 {org_name}. All rights reserved except where noted. "
- u"edX, Open edX and their respective logos are "
- u"registered trademarks of edX Inc."
+ "\u00A9 {org_name}. All rights reserved except where noted. "
+ "edX, Open edX and their respective logos are "
+ "registered trademarks of edX Inc."
).format(org_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))
@@ -165,10 +165,10 @@ def _footer_social_links():
links.append(
{
"name": social_name,
- "title": six.text_type(display.get("title", "")),
+ "title": str(display.get("title", "")),
"url": settings.SOCIAL_MEDIA_FOOTER_URLS.get(social_name, "#"),
"icon-class": display.get("icon", ""),
- "action": six.text_type(display.get("action", "")).format(platform_name=platform_name),
+ "action": str(display.get("action", "")).format(platform_name=platform_name),
}
)
return links
@@ -215,7 +215,7 @@ def _build_support_form_url(full_path=False):
# Prepend with lms base_url if specified by `full_path`
if full_path:
- contact_us_page = '{}{}'.format(settings.LMS_ROOT_URL, contact_us_page)
+ contact_us_page = f'{settings.LMS_ROOT_URL}{contact_us_page}'
return contact_us_page
@@ -277,7 +277,7 @@ def _footer_navigation_links(language=settings.LANGUAGE_CODE):
("about", (marketing_link("ABOUT"), _("About"))),
("enterprise", (
marketing_link("ENTERPRISE"),
- _(u"{platform_name} for Business").format(platform_name=platform_name)
+ _("{platform_name} for Business").format(platform_name=platform_name)
)),
("blog", (marketing_link("BLOG"), _("Blog"))),
("help-center", (_build_help_center_url(language), _("Help Center"))),
@@ -353,7 +353,7 @@ def _footer_business_links(language=settings.LANGUAGE_CODE):
("about", (marketing_link("ABOUT"), _("About"))),
("enterprise", (
_add_enterprise_marketing_footer_query_params(marketing_link("ENTERPRISE")),
- _(u"{platform_name} for Business").format(platform_name=platform_name)
+ _("{platform_name} for Business").format(platform_name=platform_name)
)),
]
@@ -424,7 +424,7 @@ def _footer_mobile_links(is_secure):
{
"name": "apple",
"title": _(
- u"Download the {platform_name} mobile app from the Apple App Store"
+ "Download the {platform_name} mobile app from the Apple App Store"
).format(platform_name=platform_name),
"url": settings.MOBILE_STORE_URLS.get('apple', '#'),
"image": _absolute_url_staticfile(is_secure, 'images/app/app_store_badge_135x40.svg'),
@@ -432,7 +432,7 @@ def _footer_mobile_links(is_secure):
{
"name": "google",
"title": _(
- u"Download the {platform_name} mobile app from Google Play"
+ "Download the {platform_name} mobile app from Google Play"
).format(platform_name=platform_name),
"url": settings.MOBILE_STORE_URLS.get('google', '#'),
"image": _absolute_url_staticfile(is_secure, 'images/app/google_play_badge_45.png'),
@@ -586,7 +586,7 @@ def get_logo_url(is_secure=True):
return _absolute_url_staticfile(is_secure=is_secure, name=logo_url_from_site_config)
if university:
- return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
+ return staticfiles_storage.url(f'images/{university}-on-edx-logo.png')
if brand_logo_url:
return brand_logo_url
diff --git a/lms/djangoapps/branding/migrations/0001_initial.py b/lms/djangoapps/branding/migrations/0001_initial.py
index 0c18ca9a21..78161afbfa 100644
--- a/lms/djangoapps/branding/migrations/0001_initial.py
+++ b/lms/djangoapps/branding/migrations/0001_initial.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-
-
-
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
@@ -33,7 +29,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')),
('enabled', models.BooleanField(default=False, verbose_name='Enabled')),
- ('configuration', models.TextField(help_text=u'JSON data of Configuration for Video Branding.')),
+ ('configuration', models.TextField(help_text='JSON data of Configuration for Video Branding.')),
('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')),
],
options={
diff --git a/lms/djangoapps/branding/models.py b/lms/djangoapps/branding/models.py
index c05f7d0148..ee710847b9 100644
--- a/lms/djangoapps/branding/models.py
+++ b/lms/djangoapps/branding/models.py
@@ -33,7 +33,7 @@ class BrandingInfoConfig(ConfigurationModel):
app_label = "branding"
configuration = TextField(
- help_text=u"JSON data of Configuration for Video Branding."
+ help_text="JSON data of Configuration for Video Branding."
)
def clean(self):
diff --git a/lms/djangoapps/branding/tests/test_api.py b/lms/djangoapps/branding/tests/test_api.py
index 0dcd981456..7fab4addcf 100644
--- a/lms/djangoapps/branding/tests/test_api.py
+++ b/lms/djangoapps/branding/tests/test_api.py
@@ -1,15 +1,16 @@
-# encoding: utf-8
"""Tests of Branding API """
-import mock
+from unittest import mock
+
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
+from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration
+
from ..api import _footer_business_links, get_footer, get_home_url, get_logo_url
-from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration # lint-amnesty, pylint: disable=wrong-import-order
test_config_disabled_contact_us = { # pylint: disable=invalid-name
"CONTACT_US_ENABLE": False,
@@ -123,7 +124,7 @@ class TestFooter(TestCase):
'connect_links': [
{'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
# pylint: disable=line-too-long
- {'url': '{base_url}/support/contact_us'.format(base_url=settings.LMS_ROOT_URL), 'name': 'contact', 'title': 'Contact Us'},
+ {'url': f'{settings.LMS_ROOT_URL}/support/contact_us', 'name': 'contact', 'title': 'Contact Us'},
{'url': 'https://example.support.edx.org/hc/en-us', 'name': 'help-center', 'title': 'Help Center'},
{'url': 'https://edx.org/media-kit', 'name': 'media_kit', 'title': 'Media Kit'},
{'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
@@ -138,8 +139,8 @@ class TestFooter(TestCase):
'title': 'Accessibility Policy'},
{'url': 'https://edx.org/sitemap', 'name': 'sitemap', 'title': 'Sitemap'},
{'name': 'media_kit',
- 'title': u'Media Kit',
- 'url': u'https://edx.org/media-kit'}
+ 'title': 'Media Kit',
+ 'url': 'https://edx.org/media-kit'}
],
'social_links': [
{'url': '#', 'action': 'Like \xe9dX on Facebook', 'name': 'facebook',
diff --git a/lms/djangoapps/branding/tests/test_models.py b/lms/djangoapps/branding/tests/test_models.py
index 9493e44e04..81dfc92ac7 100644
--- a/lms/djangoapps/branding/tests/test_models.py
+++ b/lms/djangoapps/branding/tests/test_models.py
@@ -15,7 +15,7 @@ class BrandingInfoConfigTest(TestCase):
"""
def setUp(self):
- super(BrandingInfoConfigTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
+ super().setUp()
self.configuration_string = """{
"CN": {
"url": "http://www.xuetangx.com",
diff --git a/lms/djangoapps/branding/tests/test_page.py b/lms/djangoapps/branding/tests/test_page.py
index a8bcc01ac1..292ae5264a 100644
--- a/lms/djangoapps/branding/tests/test_page.py
+++ b/lms/djangoapps/branding/tests/test_page.py
@@ -4,8 +4,8 @@ Tests for branding page
import datetime
+from unittest.mock import Mock, patch
-import six
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponseRedirect
@@ -13,14 +13,13 @@ from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
from milestones.tests.utils import MilestonesTestCaseMixin
-from mock import Mock, patch
from pytz import UTC
+from common.djangoapps.edxmako.shortcuts import render_to_response
+from common.djangoapps.util.milestones_helpers import set_prerequisite_courses
from lms.djangoapps.branding.views import index
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
-from common.djangoapps.edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
-from common.djangoapps.util.milestones_helpers import set_prerequisite_courses
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@@ -44,7 +43,7 @@ class AnonymousIndexPageTest(ModuleStoreTestCase):
Tests that anonymous users can access the '/' page, Need courses with start date
"""
def setUp(self):
- super(AnonymousIndexPageTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
+ super().setUp()
self.factory = RequestFactory()
self.course = CourseFactory.create(
days_early_for_beta=5,
@@ -130,7 +129,7 @@ class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase, Mi
emit_signals=True,
)
- pre_requisite_courses = [six.text_type(pre_requisite_course.id)]
+ pre_requisite_courses = [str(pre_requisite_course.id)]
# for this failure to occur, the enrollment window needs to be in the past
course = CourseFactory.create(
@@ -161,7 +160,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
ENABLED_SIGNALS = ['course_published']
def setUp(self):
- super(IndexPageCourseCardsSortingTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
+ super().setUp()
self.starting_later = CourseFactory.create(
org='MITx',
number='1000',
diff --git a/lms/djangoapps/branding/tests/test_views.py b/lms/djangoapps/branding/tests/test_views.py
index 9ec3b723a0..65a449963d 100644
--- a/lms/djangoapps/branding/tests/test_views.py
+++ b/lms/djangoapps/branding/tests/test_views.py
@@ -1,24 +1,23 @@
-# encoding: utf-8
"""Tests of Branding API views. """
import json
+from unittest import mock
import ddt
-import mock
import six
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test import TestCase
from django.urls import reverse
+from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.branding.models import BrandingApiConfig
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.lang_pref.api import released_languages
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme_context
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
-from common.djangoapps.student.tests.factories import UserFactory
@ddt.ddt
@@ -127,7 +126,7 @@ class TestFooter(CacheIsolationTestCase):
@ddt.data(
("en", "registered trademarks"),
- ("eo", u"régïstéréd trädémärks"), # Dummy language string
+ ("eo", "régïstéréd trädémärks"), # Dummy language string
("unknown", "registered trademarks"), # default to English
)
@ddt.unpack
@@ -250,7 +249,7 @@ class TestFooter(CacheIsolationTestCase):
url = reverse("branding_footer")
if params is not None:
- url = u"{url}?{params}".format(
+ url = "{url}?{params}".format(
url=url,
params=six.moves.urllib.parse.urlencode(params)
)
@@ -264,13 +263,13 @@ class TestFooter(CacheIsolationTestCase):
assert 'footer-language-selector' in content
# Verify the correct language is selected
- assert u'