Merge pull request #26317 from edx/usamasadiq/bom-2308-pylint-amnesty
Applied pylint-amnesty
This commit is contained in:
@@ -34,7 +34,7 @@ class CourseActionStateManager(models.Manager):
|
||||
There may or may not be greater than one entry, depending on the usage pattern for this Action.
|
||||
"""
|
||||
objects = self.find_all(exclude_args=exclude_args, **kwargs)
|
||||
if len(objects) == 0:
|
||||
if len(objects) == 0: # lint-amnesty, pylint: disable=no-else-raise
|
||||
raise CourseActionStateItemNotFoundError(
|
||||
"No entry found for action {action} with filter {filter}, excluding {exclude}".format(
|
||||
action=self.ACTION,
|
||||
@@ -152,4 +152,4 @@ class CourseRerunUIStateManager(CourseActionUIStateManager):
|
||||
|
||||
class CourseActionStateItemNotFoundError(Exception):
|
||||
"""An exception class for errors specific to Course Action states."""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
@@ -10,7 +10,7 @@ file and check it in at the same time as your model changes. To do that,
|
||||
|
||||
"""
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.db import models
|
||||
from opaque_keys.edx.django.models import CourseKeyField
|
||||
from common.djangoapps.course_action_state.managers import CourseActionStateManager, CourseRerunUIStateManager
|
||||
|
||||
@@ -22,7 +22,7 @@ class TestCourseActionStateManagerBase(TestCase):
|
||||
Base class for testing Course Action State Managers.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(TestCourseActionStateManagerBase, self).setUp()
|
||||
super(TestCourseActionStateManagerBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_key = CourseLocator("test_org", "test_course_num", "test_run")
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestCourseRerunStateManager(TestCase):
|
||||
Test class for testing the CourseRerunUIStateManager.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(TestCourseRerunStateManager, self).setUp()
|
||||
super(TestCourseRerunStateManager, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.source_course_key = CourseLocator("source_org", "source_course_num", "source_run")
|
||||
self.course_key = CourseLocator("test_org", "test_course_num", "test_run")
|
||||
self.created_user = UserFactory()
|
||||
@@ -97,7 +97,7 @@ class TestCourseRerunStateManager(TestCase):
|
||||
exception = Exception("failure in rerunning")
|
||||
try:
|
||||
raise exception
|
||||
except:
|
||||
except: # lint-amnesty, pylint: disable=bare-except
|
||||
CourseRerunState.objects.failed(course_key=self.course_key)
|
||||
|
||||
self.expected_rerun_state.update(
|
||||
|
||||
@@ -63,7 +63,7 @@ class CourseModeForm(forms.ModelForm):
|
||||
args_copy['course'] = CourseKey.from_string(args_copy['course'])
|
||||
args = [args_copy]
|
||||
|
||||
super(CourseModeForm, self).__init__(*args, **kwargs)
|
||||
super(CourseModeForm, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
try:
|
||||
if self.data.get('course'):
|
||||
@@ -122,7 +122,7 @@ class CourseModeForm(forms.ModelForm):
|
||||
Clean the form fields.
|
||||
This is the place to perform checks that involve multiple form fields.
|
||||
"""
|
||||
cleaned_data = super(CourseModeForm, self).clean()
|
||||
cleaned_data = super(CourseModeForm, self).clean() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
mode_slug = cleaned_data.get("mode_slug")
|
||||
upgrade_deadline = cleaned_data.get("_expiration_datetime")
|
||||
verification_deadline = cleaned_data.get("verification_deadline")
|
||||
@@ -173,7 +173,7 @@ class CourseModeForm(forms.ModelForm):
|
||||
verification_deadline
|
||||
)
|
||||
|
||||
return super(CourseModeForm, self).save(commit=commit)
|
||||
return super(CourseModeForm, self).save(commit=commit) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
|
||||
@admin.register(CourseMode)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CourseModesConfig(AppConfig):
|
||||
class CourseModesConfig(AppConfig): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
name = 'common.djangoapps.course_modes'
|
||||
verbose_name = "Course Modes"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from requests.exceptions import ConnectionError, Timeout # pylint: disable=rede
|
||||
from slumber.exceptions import SlumberBaseException
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from common.djangoapps.student.helpers import VERIFY_STATUS_APPROVED, VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED
|
||||
from common.djangoapps.student.helpers import VERIFY_STATUS_APPROVED, VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED # lint-amnesty, pylint: disable=line-too-long
|
||||
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
|
||||
|
||||
DISPLAY_VERIFIED = "verified"
|
||||
|
||||
@@ -6,7 +6,7 @@ Add and create new modes for running courses on this particular LMS
|
||||
from collections import defaultdict, namedtuple
|
||||
from datetime import timedelta
|
||||
|
||||
import inspect
|
||||
import inspect # lint-amnesty, pylint: disable=unused-import
|
||||
import logging
|
||||
import six
|
||||
from config_models.models import ConfigurationModel
|
||||
@@ -21,7 +21,7 @@ from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from edx_django_utils.cache import RequestCache
|
||||
from opaque_keys.edx.django.models import CourseKeyField
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.keys import CourseKey # lint-amnesty, pylint: disable=unused-import
|
||||
from simple_history.models import HistoricalRecords
|
||||
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
@@ -193,8 +193,8 @@ class CourseMode(models.Model):
|
||||
app_label = "course_modes"
|
||||
unique_together = ('course', 'mode_slug', 'currency')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CourseMode, self).__init__(*args, **kwargs)
|
||||
def __init__(self, *args, **kwargs): # lint-amnesty, pylint: disable=useless-super-delegation
|
||||
super(CourseMode, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def clean(self):
|
||||
"""
|
||||
@@ -211,21 +211,21 @@ class CourseMode(models.Model):
|
||||
if int(self.min_price) < min_price_for_mode:
|
||||
mode_display_name = mode_config.get('display_name', self.mode_slug)
|
||||
raise ValidationError(
|
||||
_(
|
||||
u"The {course_mode} course mode has a minimum price of {min_price}. You must set a price greater than or equal to {min_price}.".format(
|
||||
_( # lint-amnesty, pylint: disable=translation-of-non-string
|
||||
u"The {course_mode} course mode has a minimum price of {min_price}. You must set a price greater than or equal to {min_price}.".format( # lint-amnesty, pylint: disable=line-too-long
|
||||
course_mode=mode_display_name, min_price=min_price_for_mode
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def save(self, force_insert=False, force_update=False, using=None):
|
||||
def save(self, force_insert=False, force_update=False, using=None): # lint-amnesty, pylint: disable=arguments-differ
|
||||
# Ensure currency is always lowercase.
|
||||
self.clean() # ensure object-level validation is performed before we save.
|
||||
self.currency = self.currency.lower()
|
||||
if self.id is None:
|
||||
# If this model has no primary key at save time, it needs to be force-inserted.
|
||||
force_insert = True
|
||||
super(CourseMode, self).save(force_insert, force_update, using)
|
||||
super(CourseMode, self).save(force_insert, force_update, using) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
@property
|
||||
def slug(self):
|
||||
|
||||
@@ -66,7 +66,7 @@ class CourseModesViewTestBase(AuthAndScopesTestMixin):
|
||||
cls.other_mode.delete()
|
||||
|
||||
def setUp(self):
|
||||
super(CourseModesViewTestBase, self).setUp()
|
||||
super(CourseModesViewTestBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
# overwrite self.student to be a staff member, since only staff
|
||||
# should be able to access the course_modes API endpoints.
|
||||
# This is needed to make a handful of tests inherited from AuthAndScopesTestMixin pass.
|
||||
|
||||
@@ -16,7 +16,7 @@ from openedx.core.djangoapps.content.course_overviews.tests.factories import Cou
|
||||
|
||||
|
||||
# Factories are self documenting
|
||||
class CourseModeFactory(DjangoModelFactory):
|
||||
class CourseModeFactory(DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
class Meta(object):
|
||||
model = CourseMode
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class AdminCourseModeFormTest(ModuleStoreTestCase):
|
||||
"""
|
||||
Create a test course.
|
||||
"""
|
||||
super(AdminCourseModeFormTest, self).setUp()
|
||||
super(AdminCourseModeFormTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course = CourseFactory.create()
|
||||
CourseOverview.load_from_module_store(self.course.id)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import six
|
||||
from six.moves import zip
|
||||
|
||||
from common.djangoapps.course_modes.helpers import enrollment_mode_display
|
||||
from common.djangoapps.course_modes.models import CourseMode, Mode, get_cosmetic_display_price, invalidate_course_mode_cache
|
||||
from common.djangoapps.course_modes.models import CourseMode, Mode, get_cosmetic_display_price, invalidate_course_mode_cache # lint-amnesty, pylint: disable=line-too-long
|
||||
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
@@ -38,12 +38,12 @@ class CourseModeModelTest(TestCase):
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(CourseModeModelTest, self).setUp()
|
||||
super(CourseModeModelTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_key = CourseLocator('Test', 'TestCourse', 'TestCourseRun')
|
||||
CourseMode.objects.all().delete()
|
||||
|
||||
def tearDown(self):
|
||||
super(CourseModeModelTest, self).tearDown()
|
||||
super(CourseModeModelTest, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
invalidate_course_mode_cache(sender=None)
|
||||
|
||||
def create_mode(
|
||||
@@ -524,7 +524,7 @@ class CourseModeModelTest(TestCase):
|
||||
self.assertEqual(CourseMode.is_masters_only(self.course_key), expected_is_masters_only)
|
||||
|
||||
|
||||
class TestCourseOverviewIntegration(ModuleStoreTestCase):
|
||||
class TestCourseOverviewIntegration(ModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def test_course_overview_version_update(self):
|
||||
course = CourseFactory.create()
|
||||
course_overview = CourseOverview.get_from_id(course.id)
|
||||
@@ -537,7 +537,7 @@ class TestCourseOverviewIntegration(ModuleStoreTestCase):
|
||||
assert CourseMode.objects.filter(pk=course_mode.pk).exists()
|
||||
|
||||
|
||||
class TestDisplayPrices(ModuleStoreTestCase):
|
||||
class TestDisplayPrices(ModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
@override_settings(PAID_COURSE_REGISTRATION_CURRENCY=["USD", "$"])
|
||||
def test_get_cosmetic_display_price(self):
|
||||
"""
|
||||
|
||||
@@ -25,7 +25,7 @@ class CourseModeSignalTest(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CourseModeSignalTest, self).setUp()
|
||||
super(CourseModeSignalTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.end = datetime.now(tz=UTC).replace(microsecond=0) + timedelta(days=7)
|
||||
self.course = CourseFactory.create(end=self.end)
|
||||
CourseMode.objects.all().delete()
|
||||
|
||||
@@ -43,7 +43,7 @@ class CourseModeViewTest(CatalogIntegrationMixin, UrlResetMixin, ModuleStoreTest
|
||||
|
||||
@patch.dict(settings.FEATURES, {'MODE_CREATION_FOR_TESTING': True})
|
||||
def setUp(self):
|
||||
super(CourseModeViewTest, self).setUp()
|
||||
super(CourseModeViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
now = datetime.now(pytz.utc)
|
||||
day = timedelta(days=1)
|
||||
tomorrow = now + day
|
||||
@@ -517,7 +517,7 @@ class TrackSelectionEmbargoTest(UrlResetMixin, ModuleStoreTestCase):
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
super(TrackSelectionEmbargoTest, self).setUp()
|
||||
super(TrackSelectionEmbargoTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
# Create a course and course modes
|
||||
self.course = CourseFactory.create()
|
||||
|
||||
@@ -64,11 +64,11 @@ class ChooseModeView(View):
|
||||
atomic() block is active, since that would break atomicity.
|
||||
|
||||
"""
|
||||
return super(ChooseModeView, self).dispatch(*args, **kwargs)
|
||||
return super(ChooseModeView, self).dispatch(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(transaction.atomic)
|
||||
def get(self, request, course_id, error=None):
|
||||
def get(self, request, course_id, error=None): # lint-amnesty, pylint: disable=too-many-statements
|
||||
"""Displays the course mode choice page.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""
|
||||
""" # lint-amnesty, pylint: disable=django-not-configured
|
||||
This app exists solely to host unusual database migrations.
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2008 Mikeal Rogers
|
||||
# Copyright (c) 2008 Mikeal Rogers # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
LOOKUP = {}
|
||||
|
||||
from .paths import add_lookup, clear_lookups, lookup_template, save_lookups
|
||||
from .paths import add_lookup, clear_lookups, lookup_template, save_lookups # lint-amnesty, pylint: disable=wrong-import-position
|
||||
|
||||
|
||||
class Engines(object):
|
||||
|
||||
@@ -36,7 +36,7 @@ class Mako(BaseEngine):
|
||||
"""
|
||||
params = params.copy()
|
||||
options = params.pop('OPTIONS').copy()
|
||||
super(Mako, self).__init__(params)
|
||||
super(Mako, self).__init__(params) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.context_processors = options.pop('context_processors', [])
|
||||
self.namespace = options.pop('namespace', 'main')
|
||||
|
||||
@@ -45,7 +45,7 @@ class Mako(BaseEngine):
|
||||
return Template(template_code)
|
||||
except MakoException:
|
||||
message = text_error_template().render()
|
||||
raise TemplateSyntaxError(message)
|
||||
raise TemplateSyntaxError(message) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
def get_template(self, template_name):
|
||||
"""
|
||||
@@ -55,7 +55,7 @@ class Mako(BaseEngine):
|
||||
try:
|
||||
return Template(lookup_template(self.namespace, template_name), engine=self)
|
||||
except TopLevelLookupException:
|
||||
raise TemplateDoesNotExist(template_name)
|
||||
raise TemplateDoesNotExist(template_name) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
@cached_property
|
||||
def template_context_processors(self):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
# lint-amnesty, pylint: disable=missing-module-docstring
|
||||
|
||||
import logging
|
||||
|
||||
@@ -70,7 +70,7 @@ class MakoLoader(object):
|
||||
try:
|
||||
template = Engine.get_default().from_string(source)
|
||||
return template
|
||||
except ImproperlyConfigured:
|
||||
except ImproperlyConfigured: # lint-amnesty, pylint: disable=try-except-raise
|
||||
# Either no DjangoTemplates engine was configured -or- multiple engines
|
||||
# were configured, making the get_default() call above fail.
|
||||
raise
|
||||
@@ -96,17 +96,17 @@ class MakoLoader(object):
|
||||
self.base_loader.reset()
|
||||
|
||||
|
||||
class MakoFilesystemLoader(MakoLoader):
|
||||
class MakoFilesystemLoader(MakoLoader): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
is_usable = True
|
||||
_accepts_engine_in_init = True
|
||||
|
||||
def __init__(self, *args):
|
||||
MakoLoader.__init__(self, FilesystemLoader(*args))
|
||||
MakoLoader.__init__(self, FilesystemLoader(*args)) # lint-amnesty, pylint: disable=no-value-for-parameter
|
||||
|
||||
|
||||
class MakoAppDirectoriesLoader(MakoLoader):
|
||||
class MakoAppDirectoriesLoader(MakoLoader): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
is_usable = True
|
||||
_accepts_engine_in_init = True
|
||||
|
||||
def __init__(self, *args):
|
||||
MakoLoader.__init__(self, AppDirectoriesLoader(*args))
|
||||
MakoLoader.__init__(self, AppDirectoriesLoader(*args)) # lint-amnesty, pylint: disable=no-value-for-parameter
|
||||
|
||||
@@ -25,7 +25,7 @@ class TopLevelTemplateURI(six.text_type):
|
||||
to the URI should be looked up straight in the standard edx-platform location instead of trying to locate an
|
||||
overridding template in the current theme first.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class DynamicTemplateLookup(TemplateLookup):
|
||||
@@ -34,7 +34,7 @@ class DynamicTemplateLookup(TemplateLookup):
|
||||
for adding directories progressively.
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DynamicTemplateLookup, self).__init__(*args, **kwargs)
|
||||
super(DynamicTemplateLookup, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.__original_module_directory = self.template_args['module_directory']
|
||||
|
||||
def __repr__(self):
|
||||
@@ -74,7 +74,7 @@ class DynamicTemplateLookup(TemplateLookup):
|
||||
that template lookup skips the current theme and looks up the built-in template in standard locations.
|
||||
"""
|
||||
# Make requested uri relative to the calling uri.
|
||||
relative_uri = super(DynamicTemplateLookup, self).adjust_uri(uri, relativeto)
|
||||
relative_uri = super(DynamicTemplateLookup, self).adjust_uri(uri, relativeto) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
# Is the calling template (relativeto) which is including or inheriting current template (uri)
|
||||
# located inside a theme?
|
||||
if relativeto != strip_site_theme_templates_path(relativeto):
|
||||
@@ -99,7 +99,7 @@ class DynamicTemplateLookup(TemplateLookup):
|
||||
else:
|
||||
try:
|
||||
# Try to find themed template, i.e. see if current theme overrides the template
|
||||
template = super(DynamicTemplateLookup, self).get_template(get_template_path_with_theme(uri))
|
||||
template = super(DynamicTemplateLookup, self).get_template(get_template_path_with_theme(uri)) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
except TopLevelLookupException:
|
||||
template = self._get_toplevel_template(uri)
|
||||
|
||||
@@ -110,7 +110,7 @@ class DynamicTemplateLookup(TemplateLookup):
|
||||
Lookup a default/toplevel template, ignoring current theme.
|
||||
"""
|
||||
# Strip off the prefix path to theme and look in default template dirs.
|
||||
return super(DynamicTemplateLookup, self).get_template(strip_site_theme_templates_path(uri))
|
||||
return super(DynamicTemplateLookup, self).get_template(strip_site_theme_templates_path(uri)) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
|
||||
def clear_lookups(namespace):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2008 Mikeal Rogers
|
||||
# Copyright (c) 2008 Mikeal Rogers # lint-amnesty, pylint: disable=missing-module-docstring
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,7 @@ import logging
|
||||
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.http import Http404, HttpResponse # lint-amnesty, pylint: disable=unused-import
|
||||
from django.template import engines
|
||||
from django.urls import reverse, NoReverseMatch
|
||||
from six.moves.urllib.parse import urljoin
|
||||
@@ -26,7 +26,7 @@ from django.core.exceptions import ValidationError
|
||||
|
||||
from edx_django_utils.monitoring import set_custom_attribute
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site
|
||||
from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site # lint-amnesty, pylint: disable=unused-import
|
||||
from xmodule.util.xmodule_django import get_current_request_hostname
|
||||
|
||||
from . import Engines
|
||||
@@ -87,7 +87,7 @@ def marketing_link(name):
|
||||
elif not enable_mktg_site and name in link_map:
|
||||
# don't try to reverse disabled marketing links
|
||||
if link_map[name] is not None:
|
||||
host_name = get_current_request_hostname()
|
||||
host_name = get_current_request_hostname() # lint-amnesty, pylint: disable=unused-variable
|
||||
if link_map[name].startswith('http'):
|
||||
return link_map[name]
|
||||
else:
|
||||
@@ -144,7 +144,7 @@ def marketing_link_context_processor(request):
|
||||
settings.MKTG_URLS
|
||||
)
|
||||
|
||||
return dict(
|
||||
return dict( # lint-amnesty, pylint: disable=consider-using-dict-comprehension
|
||||
[
|
||||
("MKTG_URL_" + k, marketing_link(k))
|
||||
for k in (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2008 Mikeal Rogers
|
||||
# Copyright (c) 2008 Mikeal Rogers # lint-amnesty, pylint: disable=missing-module-docstring
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ class Template(object):
|
||||
self.engine = kwargs.pop('engine', engines[Engines.MAKO])
|
||||
if kwargs.get('origin') is None:
|
||||
self.origin = Origin(UNKNOWN_SOURCE)
|
||||
if len(args) and isinstance(args[0], MakoTemplate):
|
||||
if len(args) and isinstance(args[0], MakoTemplate): # lint-amnesty, pylint: disable=len-as-condition
|
||||
self.mako_template = args[0]
|
||||
else:
|
||||
kwargs['lookup'] = LOOKUP['main']
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
# lint-amnesty, pylint: disable=cyclic-import, missing-module-docstring
|
||||
|
||||
import unittest
|
||||
|
||||
@@ -29,6 +29,7 @@ class ShortcutsTests(UrlResetMixin, TestCase):
|
||||
"""
|
||||
Test the edxmako shortcuts file
|
||||
"""
|
||||
|
||||
@override_settings(MKTG_URLS={'ROOT': 'https://dummy-root', 'ABOUT': '/about-us'})
|
||||
def test_marketing_link(self):
|
||||
with override_settings(MKTG_URL_LINK_MAP={'ABOUT': self._get_test_url_name()}):
|
||||
@@ -69,7 +70,7 @@ class ShortcutsTests(UrlResetMixin, TestCase):
|
||||
self.assertTrue(is_any_marketing_link_set(['ABOUT', 'NOT_CONFIGURED']))
|
||||
self.assertFalse(is_any_marketing_link_set(['NOT_CONFIGURED']))
|
||||
|
||||
def _get_test_url_name(self):
|
||||
def _get_test_url_name(self): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
if settings.ROOT_URLCONF == 'lms.urls':
|
||||
# return any lms url name
|
||||
return 'dashboard'
|
||||
@@ -123,6 +124,7 @@ class AddLookupTests(TestCase):
|
||||
"""
|
||||
Test the `add_lookup` function.
|
||||
"""
|
||||
|
||||
@patch('common.djangoapps.edxmako.LOOKUP', {})
|
||||
def test_with_package(self):
|
||||
add_lookup('test', 'management', __name__)
|
||||
@@ -137,7 +139,7 @@ class MakoRequestContextTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(MakoRequestContextTest, self).setUp()
|
||||
super(MakoRequestContextTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.create()
|
||||
self.url = "/"
|
||||
self.request = RequestFactory().get(self.url)
|
||||
|
||||
Reference in New Issue
Block a user