diff --git a/cms/djangoapps/contentstore/views/session_kv_store.py b/cms/djangoapps/contentstore/views/session_kv_store.py index 7654f78a06..e39753c725 100644 --- a/cms/djangoapps/contentstore/views/session_kv_store.py +++ b/cms/djangoapps/contentstore/views/session_kv_store.py @@ -11,7 +11,7 @@ def stringify(key): class SessionKeyValueStore(KeyValueStore): # lint-amnesty, pylint: disable=missing-class-docstring - def __init__(self, request): + def __init__(self, request): # lint-amnesty, pylint: disable=super-init-not-called self._session = request.session def get(self, key): diff --git a/openedx/core/djangoapps/safe_sessions/middleware.py b/openedx/core/djangoapps/safe_sessions/middleware.py index 5f7f25202a..612ae6e6f1 100644 --- a/openedx/core/djangoapps/safe_sessions/middleware.py +++ b/openedx/core/djangoapps/safe_sessions/middleware.py @@ -85,7 +85,7 @@ class SafeCookieError(Exception): An exception class for safe cookie related errors. """ def __init__(self, error_message): - super(SafeCookieError, self).__init__(error_message) + super(SafeCookieError, self).__init__(error_message) # lint-amnesty, pylint: disable=super-with-arguments log.error(error_message) @@ -152,7 +152,7 @@ class SafeCookieData(object): raw_cookie_components = six.text_type(safe_cookie_string).split(cls.SEPARATOR) safe_cookie_data = SafeCookieData(*raw_cookie_components) except TypeError: - raise SafeCookieError( + raise SafeCookieError( # lint-amnesty, pylint: disable=raise-missing-from u"SafeCookieData BWC parse error: {0!r}.".format(safe_cookie_string) ) else: @@ -282,7 +282,7 @@ class SafeSessionMiddleware(SessionMiddleware, MiddlewareMixin): else: request.COOKIES[settings.SESSION_COOKIE_NAME] = safe_cookie_data.session_id # Step 2 - process_request_response = super(SafeSessionMiddleware, self).process_request(request) # Step 3 + process_request_response = super(SafeSessionMiddleware, self).process_request(request) # Step 3 # lint-amnesty, pylint: disable=assignment-from-no-return, super-with-arguments if process_request_response: # The process_request pipeline has been short circuited so # return the response. @@ -321,7 +321,7 @@ class SafeSessionMiddleware(SessionMiddleware, MiddlewareMixin): Step 4. Delete the cookie, if it's marked for deletion. """ - response = super(SafeSessionMiddleware, self).process_response(request, response) # Step 1 + response = super(SafeSessionMiddleware, self).process_response(request, response) # Step 1 # lint-amnesty, pylint: disable=super-with-arguments if not _is_cookie_marked_for_deletion(request) and _is_cookie_present(response): try: diff --git a/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py b/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py index 8b1d249838..e21ac617f1 100644 --- a/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py +++ b/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py @@ -27,7 +27,7 @@ class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase): """ def setUp(self): - super(TestSafeSessionProcessRequest, self).setUp() + super(TestSafeSessionProcessRequest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() self.addCleanup(set_current_request, None) self.request = get_mock_request() @@ -130,7 +130,7 @@ class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase): """ def setUp(self): - super(TestSafeSessionProcessResponse, self).setUp() + super(TestSafeSessionProcessResponse, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() self.addCleanup(set_current_request, None) self.request = get_mock_request() @@ -235,7 +235,7 @@ class TestSafeSessionMiddleware(TestSafeSessionsLogMixin, TestCase): """ def setUp(self): - super(TestSafeSessionMiddleware, self).setUp() + super(TestSafeSessionMiddleware, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() self.addCleanup(set_current_request, None) self.request = get_mock_request() diff --git a/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py b/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py index 4d9f87f920..feff67e829 100644 --- a/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py +++ b/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py @@ -24,7 +24,7 @@ class TestSafeCookieData(TestSafeSessionsLogMixin, TestCase): """ def setUp(self): - super(TestSafeCookieData, self).setUp() + super(TestSafeCookieData, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.session_id = 'test_session_id' self.user_id = 'test_user_id' self.safe_cookie_data = SafeCookieData.create(self.session_id, self.user_id) diff --git a/openedx/core/djangoapps/schedules/__init__.py b/openedx/core/djangoapps/schedules/__init__.py index 1813393f87..989b2b2e16 100644 --- a/openedx/core/djangoapps/schedules/__init__.py +++ b/openedx/core/djangoapps/schedules/__init__.py @@ -1 +1,2 @@ +# lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring default_app_config = 'openedx.core.djangoapps.schedules.apps.SchedulesConfig' diff --git a/openedx/core/djangoapps/schedules/admin.py b/openedx/core/djangoapps/schedules/admin.py index a2b3d12d13..9e27d7c315 100644 --- a/openedx/core/djangoapps/schedules/admin.py +++ b/openedx/core/djangoapps/schedules/admin.py @@ -1,4 +1,4 @@ - +# lint-amnesty, pylint: disable=missing-module-docstring import functools @@ -20,7 +20,7 @@ class ScheduleExperienceAdminInline(admin.StackedInline): model = models.ScheduleExperience -def _set_experience(db_name, human_name, modeladmin, request, queryset): +def _set_experience(db_name, human_name, modeladmin, request, queryset): # lint-amnesty, pylint: disable=redefined-outer-name """ A django action which will set all selected schedules to the supplied experience. The intended usage is with functools.partial to generate the action for each experience type @@ -83,12 +83,12 @@ class CourseIdFilter(admin.SimpleListFilter): parameter_name = "course_id" def __init__(self, request, params, model, model_admin): - super(CourseIdFilter, self).__init__(request, params, model, model_admin) + super(CourseIdFilter, self).__init__(request, params, model, model_admin) # lint-amnesty, pylint: disable=super-with-arguments self.unused_parameters = params.copy() self.unused_parameters.pop(self.parameter_name, None) def value(self): - value = super(CourseIdFilter, self).value() + value = super(CourseIdFilter, self).value() # lint-amnesty, pylint: disable=super-with-arguments if value == "None" or value is None: return None else: @@ -121,7 +121,7 @@ class CourseIdFilter(admin.SimpleListFilter): @admin.register(models.Schedule) -class ScheduleAdmin(admin.ModelAdmin): +class ScheduleAdmin(admin.ModelAdmin): # lint-amnesty, pylint: disable=missing-class-docstring list_display = ('username', 'course_id', 'start_date', 'upgrade_deadline', 'experience_display') list_display_links = ('start_date', 'upgrade_deadline', 'experience_display') list_filter = ( @@ -160,12 +160,12 @@ class ScheduleAdmin(admin.ModelAdmin): course_id.short_description = _('Course ID') def get_queryset(self, request): - qs = super(ScheduleAdmin, self).get_queryset(request) + qs = super(ScheduleAdmin, self).get_queryset(request) # lint-amnesty, pylint: disable=super-with-arguments qs = qs.select_related('enrollment', 'enrollment__user') return qs -class ScheduleConfigAdminForm(forms.ModelForm): +class ScheduleConfigAdminForm(forms.ModelForm): # lint-amnesty, pylint: disable=missing-class-docstring def clean_hold_back_ratio(self): hold_back_ratio = self.cleaned_data["hold_back_ratio"] @@ -175,7 +175,7 @@ class ScheduleConfigAdminForm(forms.ModelForm): @admin.register(models.ScheduleConfig) -class ScheduleConfigAdmin(admin.ModelAdmin): +class ScheduleConfigAdmin(admin.ModelAdmin): # lint-amnesty, pylint: disable=missing-class-docstring search_fields = ('site',) list_display = ( 'site', 'create_schedules', diff --git a/openedx/core/djangoapps/schedules/apps.py b/openedx/core/djangoapps/schedules/apps.py index d13e3ab665..cfd3834925 100644 --- a/openedx/core/djangoapps/schedules/apps.py +++ b/openedx/core/djangoapps/schedules/apps.py @@ -1,16 +1,16 @@ - +# lint-amnesty, pylint: disable=missing-module-docstring from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ -from edx_django_utils.plugins import PluginSignals +from edx_django_utils.plugins import PluginSignals # lint-amnesty, pylint: disable=unused-import -from openedx.core.djangoapps.plugins.constants import ProjectType +from openedx.core.djangoapps.plugins.constants import ProjectType # lint-amnesty, pylint: disable=unused-import -class SchedulesConfig(AppConfig): +class SchedulesConfig(AppConfig): # lint-amnesty, pylint: disable=missing-class-docstring name = 'openedx.core.djangoapps.schedules' verbose_name = _('Schedules') def ready(self): # noinspection PyUnresolvedReferences - from . import signals, tasks # pylint: disable=unused-variable + from . import signals, tasks # lint-amnesty, pylint: disable=unused-import, unused-variable diff --git a/openedx/core/djangoapps/schedules/config.py b/openedx/core/djangoapps/schedules/config.py index 82c3188810..5b2f383544 100644 --- a/openedx/core/djangoapps/schedules/config.py +++ b/openedx/core/djangoapps/schedules/config.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Contains configuration for schedules app """ diff --git a/openedx/core/djangoapps/schedules/content_highlights.py b/openedx/core/djangoapps/schedules/content_highlights.py index d329c3f38f..282e4aff82 100644 --- a/openedx/core/djangoapps/schedules/content_highlights.py +++ b/openedx/core/djangoapps/schedules/content_highlights.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Contains methods for accessing course highlights. Course highlights is a schedule experience built on the Schedules app. """ diff --git a/openedx/core/djangoapps/schedules/exceptions.py b/openedx/core/djangoapps/schedules/exceptions.py index 335ad8b726..46061ef6e2 100644 --- a/openedx/core/djangoapps/schedules/exceptions.py +++ b/openedx/core/djangoapps/schedules/exceptions.py @@ -1,2 +1,3 @@ +# lint-amnesty, pylint: disable=missing-module-docstring class CourseUpdateDoesNotExist(Exception): pass diff --git a/openedx/core/djangoapps/schedules/management/commands/__init__.py b/openedx/core/djangoapps/schedules/management/commands/__init__.py index 9f1fff5d52..76b168b7b0 100644 --- a/openedx/core/djangoapps/schedules/management/commands/__init__.py +++ b/openedx/core/djangoapps/schedules/management/commands/__init__.py @@ -13,7 +13,7 @@ from django.core.management.base import BaseCommand from openedx.core.djangoapps.schedules.utils import PrefixedDebugLoggerMixin -class SendEmailBaseCommand(PrefixedDebugLoggerMixin, BaseCommand): +class SendEmailBaseCommand(PrefixedDebugLoggerMixin, BaseCommand): # lint-amnesty, pylint: disable=missing-class-docstring async_send_task = None # define in subclass # An iterable of day offsets (e.g. -7, -14, -21, -28, ...) that defines the days for diff --git a/openedx/core/djangoapps/schedules/management/commands/send_course_next_section_update.py b/openedx/core/djangoapps/schedules/management/commands/send_course_next_section_update.py index 7d117640d4..53e2100649 100644 --- a/openedx/core/djangoapps/schedules/management/commands/send_course_next_section_update.py +++ b/openedx/core/djangoapps/schedules/management/commands/send_course_next_section_update.py @@ -4,7 +4,7 @@ Management command to send Schedule course updates import datetime import pytz -from textwrap import dedent +from textwrap import dedent # lint-amnesty, pylint: disable=wrong-import-order from django.contrib.sites.models import Site diff --git a/openedx/core/djangoapps/schedules/management/commands/setup_models_to_send_test_emails.py b/openedx/core/djangoapps/schedules/management/commands/setup_models_to_send_test_emails.py index a8206f6685..a66d806e98 100644 --- a/openedx/core/djangoapps/schedules/management/commands/setup_models_to_send_test_emails.py +++ b/openedx/core/djangoapps/schedules/management/commands/setup_models_to_send_test_emails.py @@ -49,7 +49,7 @@ class ContentHighlightSchedule(ScheduleFactory): A ScheduleFactory that creates a Schedule set up for a course highlights email. """ start_date = factory.Faker('date_time_between', start_date='-7d', end_date='-7d', tzinfo=pytz.UTC) - experience = factory.RelatedFactory(ScheduleExperienceFactory, 'schedule', experience_type=ScheduleExperience.EXPERIENCES.course_updates) + experience = factory.RelatedFactory(ScheduleExperienceFactory, 'schedule', experience_type=ScheduleExperience.EXPERIENCES.course_updates) # lint-amnesty, pylint: disable=line-too-long class Command(BaseCommand): diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py b/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py index cc2b6ff481..3d94fabc4b 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/send_email_base.py @@ -12,7 +12,7 @@ import attr import ddt import pytz from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db.models import Max from edx_ace.channel import ChannelMap, ChannelType from edx_ace.test_utils import StubPolicy, patch_policies @@ -83,7 +83,7 @@ ExperienceTest = namedtuple('ExperienceTest', 'experience offset email_sent') @ddt.ddt @freeze_time('2017-08-01 00:00:00', tz_offset=0, tick=True) -class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): +class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): # lint-amnesty, pylint: disable=missing-class-docstring __test__ = False @@ -93,7 +93,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): consolidates_emails_for_learner = False def setUp(self): - super(ScheduleSendEmailTestMixin, self).setUp() + super(ScheduleSendEmailTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments site = SiteFactory.create() self.site_config = SiteConfigurationFactory.create(site=site) @@ -119,7 +119,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): num_bins = self.task.num_bins return max_user_id + num_bins - (max_user_id % num_bins) - def _get_dates(self, offset=None): + def _get_dates(self, offset=None): # lint-amnesty, pylint: disable=missing-function-docstring current_day = _get_datetime_beginning_of_day(datetime.datetime.now(pytz.UTC)) offset = offset or self.expected_offsets[0] target_day = current_day + datetime.timedelta(days=offset) @@ -134,7 +134,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): templates_override[0]['OPTIONS']['string_if_invalid'] = u"TEMPLATE WARNING - MISSING VARIABLE [%s]" return templates_override - def _schedule_factory(self, offset=None, **factory_kwargs): + def _schedule_factory(self, offset=None, **factory_kwargs): # lint-amnesty, pylint: disable=missing-function-docstring _, _, target_day, upgrade_deadline = self._get_dates(offset=offset) factory_kwargs.setdefault('start_date', target_day) factory_kwargs.setdefault('upgrade_deadline', upgrade_deadline) @@ -199,7 +199,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): @patch.object(resolvers, 'set_custom_attribute') def test_schedule_bin(self, schedule_count, mock_attribute, mock_ace): with patch.object(self.task, 'async_send_task') as mock_schedule_send: - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable schedules = [ self._schedule_factory() for _ in range(schedule_count) ] @@ -236,7 +236,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): self.assertFalse(mock_ace.send.called) def test_no_course_overview(self): - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable # Don't use CourseEnrollmentFactory since it creates a course overview enrollment = CourseEnrollment.objects.create( course_id=CourseKey.from_string('edX/toy/Not_2012_Fall'), @@ -318,7 +318,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): user1 = UserFactory.create(id=self._next_user_id()) user2 = UserFactory.create(id=user1.id + self.task.num_bins) - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable self._schedule_factory( enrollment__course__org=filtered_org, @@ -344,7 +344,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): @ddt.data(True, False) def test_course_end(self, has_course_ended): user1 = UserFactory.create(id=self._next_user_id()) - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable end_date_offset = -2 if has_course_ended else 2 self._schedule_factory( @@ -366,7 +366,7 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): @patch.object(tasks, 'ace') def test_multiple_target_schedules(self, mock_ace): user = UserFactory.create() - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable num_courses = 3 for course_index in range(num_courses): self._schedule_factory( @@ -397,8 +397,8 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): self._assert_template_for_offset(offset, message_count) self.clear_caches() - def _assert_template_for_offset(self, offset, message_count): - current_day, offset, target_day, upgrade_deadline = self._get_dates(offset) + def _assert_template_for_offset(self, offset, message_count): # lint-amnesty, pylint: disable=missing-function-docstring + current_day, offset, target_day, upgrade_deadline = self._get_dates(offset) # lint-amnesty, pylint: disable=unused-variable user = UserFactory.create() for course_index in range(message_count): @@ -455,8 +455,8 @@ class ScheduleSendEmailTestMixin(FilteredQueryCountMixin): return mock_channel.deliver.mock_calls - def _check_if_email_sent_for_experience(self, test_config): - current_day, offset, target_day, _ = self._get_dates(offset=test_config.offset) + def _check_if_email_sent_for_experience(self, test_config): # lint-amnesty, pylint: disable=missing-function-docstring + current_day, offset, target_day, _ = self._get_dates(offset=test_config.offset) # lint-amnesty, pylint: disable=unused-variable kwargs = { 'offset': offset diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py index 52dd962ee0..245bddcd59 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_course_update.py @@ -53,7 +53,7 @@ class TestSendCourseUpdate(ScheduleUpsellTestMixin, ScheduleSendEmailTestMixin, queries_deadline_for_each_course = True def setUp(self): - super(TestSendCourseUpdate, self).setUp() + super(TestSendCourseUpdate, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.highlights_patcher = patch('openedx.core.djangoapps.schedules.resolvers.get_week_highlights') mock_highlights = self.highlights_patcher.start() mock_highlights.return_value = [u'Highlight {}'.format(num + 1) for num in range(3)] @@ -90,7 +90,7 @@ class TestSendCourseUpdate(ScheduleUpsellTestMixin, ScheduleSendEmailTestMixin, @ddt.data( ExperienceTest(experience=ScheduleExperience.EXPERIENCES.default, offset=expected_offsets[0], email_sent=False), - ExperienceTest(experience=ScheduleExperience.EXPERIENCES.course_updates, offset=expected_offsets[0], email_sent=True), + ExperienceTest(experience=ScheduleExperience.EXPERIENCES.course_updates, offset=expected_offsets[0], email_sent=True), # lint-amnesty, pylint: disable=line-too-long ExperienceTest(experience=None, offset=expected_offsets[0], email_sent=False), ) def test_schedule_in_different_experience(self, test_config): diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_email_base_command.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_email_base_command.py index deea102316..2ab0323ea7 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_email_base_command.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_email_base_command.py @@ -20,9 +20,9 @@ from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_un @skip_unless_lms @skipUnless('openedx.core.djangoapps.schedules.apps.SchedulesConfig' in settings.INSTALLED_APPS, "Can't test schedules if the app isn't installed") -class TestSendEmailBaseCommand(CacheIsolationTestCase): +class TestSendEmailBaseCommand(CacheIsolationTestCase): # lint-amnesty, pylint: disable=missing-class-docstring - def setUp(self): + def setUp(self): # lint-amnesty, pylint: disable=super-method-not-called self.command = SendEmailBaseCommand() self.site = SiteFactory() self.site_config = SiteConfigurationFactory.create(site=self.site) @@ -54,4 +54,4 @@ class TestSendEmailBaseCommand(CacheIsolationTestCase): self.assertFalse(kwarg.called) for offset in self.command.offsets: - self.command.enqueue.assert_any_call(offset, arg, kwarg=kwarg) + self.command.enqueue.assert_any_call(offset, arg, kwarg=kwarg) # lint-amnesty, pylint: disable=no-member diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py index 698427643f..2f6edea486 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py @@ -25,7 +25,7 @@ from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_un 'openedx.core.djangoapps.schedules.apps.SchedulesConfig' in settings.INSTALLED_APPS, "Can't test schedules if the app isn't installed", ) -class TestSendRecurringNudge(ScheduleUpsellTestMixin, ScheduleSendEmailTestMixin, CacheIsolationTestCase): +class TestSendRecurringNudge(ScheduleUpsellTestMixin, ScheduleSendEmailTestMixin, CacheIsolationTestCase): # lint-amnesty, pylint: disable=missing-class-docstring __test__ = True # pylint: disable=protected-access diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py index e3a0445172..68cc3bc3c3 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py @@ -33,12 +33,12 @@ LOG = logging.getLogger(__name__) @skip_unless_lms @skipUnless('openedx.core.djangoapps.schedules.apps.SchedulesConfig' in settings.INSTALLED_APPS, "Can't test schedules if the app isn't installed") -class TestUpgradeReminder(ScheduleSendEmailTestMixin, CacheIsolationTestCase): +class TestUpgradeReminder(ScheduleSendEmailTestMixin, CacheIsolationTestCase): # lint-amnesty, pylint: disable=missing-class-docstring __test__ = True resolver = resolvers.UpgradeReminderResolver task = tasks.ScheduleUpgradeReminder - deliver_task = tasks._upgrade_reminder_schedule_send + deliver_task = tasks._upgrade_reminder_schedule_send # lint-amnesty, pylint: disable=protected-access command = reminder.Command deliver_config = 'deliver_upgrade_reminder' enqueue_config = 'enqueue_upgrade_reminder' @@ -50,7 +50,7 @@ class TestUpgradeReminder(ScheduleSendEmailTestMixin, CacheIsolationTestCase): @ddt.data(True, False) @patch.object(tasks, 'ace') def test_verified_learner(self, is_verified, mock_ace): - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable schedule = self._schedule_factory( enrollment__mode=CourseMode.VERIFIED if is_verified else CourseMode.AUDIT, ) @@ -63,7 +63,7 @@ class TestUpgradeReminder(ScheduleSendEmailTestMixin, CacheIsolationTestCase): self.assertEqual(mock_ace.send.called, not is_verified) def test_filter_out_verified_schedules(self): - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable user = UserFactory.create() schedules = [ @@ -95,7 +95,7 @@ class TestUpgradeReminder(ScheduleSendEmailTestMixin, CacheIsolationTestCase): @patch.object(tasks, 'ace') def test_course_without_verified_mode(self, mock_ace): - current_day, offset, target_day, upgrade_deadline = self._get_dates() + current_day, offset, target_day, upgrade_deadline = self._get_dates() # lint-amnesty, pylint: disable=unused-variable schedule = self._schedule_factory() schedule.enrollment.course.modes.filter(mode_slug=CourseMode.VERIFIED).delete() @@ -107,7 +107,7 @@ class TestUpgradeReminder(ScheduleSendEmailTestMixin, CacheIsolationTestCase): @ddt.data( ExperienceTest(experience=ScheduleExperience.EXPERIENCES.default, offset=expected_offsets[0], email_sent=True), - ExperienceTest(experience=ScheduleExperience.EXPERIENCES.course_updates, offset=expected_offsets[0], email_sent=False), + ExperienceTest(experience=ScheduleExperience.EXPERIENCES.course_updates, offset=expected_offsets[0], email_sent=False), # lint-amnesty, pylint: disable=line-too-long ExperienceTest(experience=None, offset=expected_offsets[0], email_sent=True), ) def test_upgrade_reminder_experience(self, test_config): diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py b/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py index 26b52b1e01..da186ec597 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/upsell_base.py @@ -18,7 +18,7 @@ from lms.djangoapps.courseware.models import DynamicUpgradeDeadlineConfiguration @ddt.ddt @freeze_time('2017-08-01 00:00:00', tz_offset=0, tick=True) -class ScheduleUpsellTestMixin(object): +class ScheduleUpsellTestMixin(object): # lint-amnesty, pylint: disable=missing-class-docstring UpsellTestCase = namedtuple('UpsellTestCase', 'set_deadline, deadline_offset, expect_upsell') def _setup_schedule_and_dates(self, set_deadline=True, deadline_offset=7): diff --git a/openedx/core/djangoapps/schedules/message_types.py b/openedx/core/djangoapps/schedules/message_types.py index 4373875e99..efa8a34477 100644 --- a/openedx/core/djangoapps/schedules/message_types.py +++ b/openedx/core/djangoapps/schedules/message_types.py @@ -10,13 +10,13 @@ from openedx.core.djangoapps.schedules.config import DEBUG_MESSAGE_WAFFLE_FLAG class ScheduleMessageType(BaseMessageType): def __init__(self, *args, **kwargs): - super(ScheduleMessageType, self).__init__(*args, **kwargs) + super(ScheduleMessageType, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.log_level = logging.DEBUG if DEBUG_MESSAGE_WAFFLE_FLAG.is_enabled() else None class RecurringNudge(ScheduleMessageType): def __init__(self, day, *args, **kwargs): - super(RecurringNudge, self).__init__(*args, **kwargs) + super(RecurringNudge, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.name = "recurringnudge_day{}".format(day) diff --git a/openedx/core/djangoapps/schedules/models.py b/openedx/core/djangoapps/schedules/models.py index 7efbaf10fa..00f857af5f 100644 --- a/openedx/core/djangoapps/schedules/models.py +++ b/openedx/core/djangoapps/schedules/models.py @@ -1,4 +1,4 @@ - +# lint-amnesty, pylint: disable=missing-module-docstring from config_models.models import ConfigurationModel from django.contrib.sites.models import Site diff --git a/openedx/core/djangoapps/schedules/resolvers.py b/openedx/core/djangoapps/schedules/resolvers.py index 1d87b29733..3ba2cdc7c4 100644 --- a/openedx/core/djangoapps/schedules/resolvers.py +++ b/openedx/core/djangoapps/schedules/resolvers.py @@ -1,4 +1,4 @@ - +# lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring import datetime import logging @@ -6,7 +6,7 @@ from itertools import groupby import attr from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.contrib.staticfiles.templatetags.staticfiles import static from django.db.models import F, Q from django.urls import reverse @@ -80,9 +80,9 @@ class BinnedSchedulesBaseResolver(PrefixedDebugLoggerMixin, RecipientResolver): def __attrs_post_init__(self): # TODO: in the next refactor of this task, pass in current_datetime instead of reproducing it here - self.current_datetime = self.target_datetime - datetime.timedelta(days=self.day_offset) + self.current_datetime = self.target_datetime - datetime.timedelta(days=self.day_offset) # lint-amnesty, pylint: disable=attribute-defined-outside-init - def send(self, msg_type): + def send(self, msg_type): # lint-amnesty, pylint: disable=arguments-differ for (user, language, context) in self.schedules_for_bin(): msg = msg_type.personalize( Recipient( @@ -114,7 +114,7 @@ class BinnedSchedulesBaseResolver(PrefixedDebugLoggerMixin, RecipientResolver): target_day = _get_datetime_beginning_of_day(self.target_datetime) schedule_day_equals_target_day_filter = { 'courseenrollment__schedule__{}__gte'.format(self.schedule_date_field): target_day, - 'courseenrollment__schedule__{}__lt'.format(self.schedule_date_field): target_day + datetime.timedelta(days=1), + 'courseenrollment__schedule__{}__lt'.format(self.schedule_date_field): target_day + datetime.timedelta(days=1), # lint-amnesty, pylint: disable=line-too-long } users = User.objects.filter( courseenrollment__is_active=True, @@ -191,7 +191,7 @@ class BinnedSchedulesBaseResolver(PrefixedDebugLoggerMixin, RecipientResolver): return schedules.filter(enrollment__course__org__in=org_list) - def schedules_for_bin(self): + def schedules_for_bin(self): # lint-amnesty, pylint: disable=missing-function-docstring schedules = self.get_schedules_with_target_date_by_bin_and_orgs() template_context = get_base_template_context(self.site) @@ -210,7 +210,7 @@ class BinnedSchedulesBaseResolver(PrefixedDebugLoggerMixin, RecipientResolver): yield (user, first_schedule.enrollment.course.closest_released_language, template_context) - def get_template_context(self, user, user_schedules): + def get_template_context(self, user, user_schedules): # lint-amnesty, pylint: disable=unused-argument """ Given a user and their schedules, build the context needed to render the template for this message. @@ -247,7 +247,7 @@ class RecurringNudgeResolver(BinnedSchedulesBaseResolver): num_bins = RECURRING_NUDGE_NUM_BINS @property - def experience_filter(self): + def experience_filter(self): # lint-amnesty, pylint: disable=missing-function-docstring if self.day_offset == -3: experiences = [ScheduleExperience.EXPERIENCES.default, ScheduleExperience.EXPERIENCES.course_updates] return Q(experience__experience_type__in=experiences) | Q(experience__isnull=True) @@ -322,7 +322,7 @@ class UpgradeReminderResolver(BinnedSchedulesBaseResolver): return context -def _get_upsell_information_for_schedule(user, schedule): +def _get_upsell_information_for_schedule(user, schedule): # lint-amnesty, pylint: disable=missing-function-docstring template_context = {} enrollment = schedule.enrollment course = enrollment.course @@ -439,7 +439,7 @@ class CourseNextSectionUpdate(PrefixedDebugLoggerMixin, RecipientResolver): log_prefix = 'Next Section Course Update' experience_filter = Q(experience__experience_type=ScheduleExperience.EXPERIENCES.course_updates) - def send(self): + def send(self): # lint-amnesty, pylint: disable=arguments-differ schedules = self.get_schedules() for (user, language, context) in schedules: msg = CourseUpdate().personalize( diff --git a/openedx/core/djangoapps/schedules/signals.py b/openedx/core/djangoapps/schedules/signals.py index fb75409420..b1454fd9b6 100644 --- a/openedx/core/djangoapps/schedules/signals.py +++ b/openedx/core/djangoapps/schedules/signals.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured CourseEnrollment related signal handlers. """ @@ -23,7 +23,7 @@ from openedx.core.djangoapps.schedules.models import ScheduleExperience from openedx.core.djangoapps.schedules.utils import reset_self_paced_schedule from openedx.core.djangoapps.theming.helpers import get_current_site from common.djangoapps.student.models import CourseEnrollment -from common.djangoapps.student.signals import ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED +from common.djangoapps.student.signals import ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED # lint-amnesty, pylint: disable=unused-import from common.djangoapps.track import segment from .config import CREATE_SCHEDULE_WAFFLE_FLAG @@ -45,7 +45,7 @@ def create_schedule(sender, **kwargs): # pylint: disable=unused-argument schedule_details = _create_schedule(enrollment, enrollment_created) if schedule_details: - log.debug( + log.debug( # lint-amnesty, pylint: disable=logging-not-lazy 'Schedules: created a new schedule starting at ' + u'%s with an upgrade deadline of %s and experience type: %s', schedule_details['content_availability_date'], @@ -92,7 +92,7 @@ def reset_schedule_on_mode_change(sender, user, course_key, mode, **kwargs): # reset_self_paced_schedule(user, course_key, use_availability_date=use_availability_date) -def _calculate_upgrade_deadline(course_id, content_availability_date): +def _calculate_upgrade_deadline(course_id, content_availability_date): # lint-amnesty, pylint: disable=missing-function-docstring upgrade_deadline = None delta = _get_upgrade_deadline_delta_setting(course_id) @@ -114,7 +114,7 @@ def _calculate_upgrade_deadline(course_id, content_availability_date): return upgrade_deadline -def _get_upgrade_deadline_delta_setting(course_id): +def _get_upgrade_deadline_delta_setting(course_id): # lint-amnesty, pylint: disable=missing-function-docstring delta = None global_config = DynamicUpgradeDeadlineConfiguration.current() @@ -139,7 +139,7 @@ def _get_upgrade_deadline_delta_setting(course_id): return delta -def _should_randomly_suppress_schedule_creation( +def _should_randomly_suppress_schedule_creation( # lint-amnesty, pylint: disable=missing-function-docstring schedule_config, enrollment, upgrade_deadline, diff --git a/openedx/core/djangoapps/schedules/tasks.py b/openedx/core/djangoapps/schedules/tasks.py index c6ef27c9aa..721b5654c9 100644 --- a/openedx/core/djangoapps/schedules/tasks.py +++ b/openedx/core/djangoapps/schedules/tasks.py @@ -1,4 +1,4 @@ - +# lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring import datetime import logging @@ -9,7 +9,7 @@ from celery import shared_task, current_app from celery_utils.logged_task import LoggedTask from celery_utils.persist_on_failure import LoggedPersistOnFailureTask from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.db.utils import DatabaseError @@ -48,7 +48,7 @@ COURSE_NEXT_SECTION_UPDATE_LOG_PREFIX = 'Course Next Section Update' @shared_task(base=LoggedPersistOnFailureTask, bind=True, default_retry_delay=30) @set_code_owner_attribute -def update_course_schedules(self, **kwargs): +def update_course_schedules(self, **kwargs): # lint-amnesty, pylint: disable=missing-function-docstring course_key = CourseKey.from_string(kwargs['course_id']) new_start_date = deserialize(kwargs['new_start_date_str']) new_upgrade_deadline = deserialize(kwargs['new_upgrade_deadline_str']) @@ -64,7 +64,7 @@ def update_course_schedules(self, **kwargs): raise self.retry(kwargs=kwargs, exc=exc) -class ScheduleMessageBaseTask(LoggedTask): +class ScheduleMessageBaseTask(LoggedTask): # lint-amnesty, pylint: disable=abstract-method """ Base class for top-level Schedule tasks that create subtasks. """ @@ -105,9 +105,9 @@ class BinnedScheduleMessageBaseTask(ScheduleMessageBaseTask): task_instance = None @classmethod - def enqueue(cls, site, current_date, day_offset, override_recipient_email=None): + def enqueue(cls, site, current_date, day_offset, override_recipient_email=None): # lint-amnesty, pylint: disable=missing-function-docstring set_code_owner_attribute_from_module(__name__) - current_date = resolvers._get_datetime_beginning_of_day(current_date) + current_date = resolvers._get_datetime_beginning_of_day(current_date) # lint-amnesty, pylint: disable=protected-access if not cls.is_enqueue_enabled(site): cls.log_info(u'Message queuing disabled for site %s', site.domain) @@ -115,7 +115,7 @@ class BinnedScheduleMessageBaseTask(ScheduleMessageBaseTask): target_date = current_date + datetime.timedelta(days=day_offset) cls.log_info(u'Target date = %s', target_date.isoformat()) - for bin in range(cls.num_bins): + for bin in range(cls.num_bins): # lint-amnesty, pylint: disable=redefined-builtin task_args = ( site.id, serialize(target_date), @@ -129,7 +129,7 @@ class BinnedScheduleMessageBaseTask(ScheduleMessageBaseTask): retry=False, ) - def run( + def run( # lint-amnesty, pylint: disable=arguments-differ self, site_id, target_day_str, day_offset, bin_num, override_recipient_email=None, ): set_code_owner_attribute_from_module(__name__) @@ -137,7 +137,7 @@ class BinnedScheduleMessageBaseTask(ScheduleMessageBaseTask): with emulate_http_request(site=site): msg_type = self.make_message_type(day_offset) _annotate_for_monitoring(msg_type, site, bin_num, target_day_str, day_offset) - return self.resolver( + return self.resolver( # lint-amnesty, pylint: disable=not-callable self.async_send_task, site, deserialize(target_day_str), @@ -183,7 +183,7 @@ def _course_update_schedule_send(site_id, msg_str): ) -class ScheduleRecurringNudge(BinnedScheduleMessageBaseTask): +class ScheduleRecurringNudge(BinnedScheduleMessageBaseTask): # lint-amnesty, pylint: disable=missing-class-docstring num_bins = resolvers.RECURRING_NUDGE_NUM_BINS enqueue_config_var = 'enqueue_recurring_nudge' log_prefix = RECURRING_NUDGE_LOG_PREFIX @@ -197,7 +197,7 @@ ScheduleRecurringNudge.task_instance = current_app.register_task(ScheduleRecurri ScheduleRecurringNudge = ScheduleRecurringNudge.task_instance -class ScheduleUpgradeReminder(BinnedScheduleMessageBaseTask): +class ScheduleUpgradeReminder(BinnedScheduleMessageBaseTask): # lint-amnesty, pylint: disable=missing-class-docstring num_bins = resolvers.UPGRADE_REMINDER_NUM_BINS enqueue_config_var = 'enqueue_upgrade_reminder' log_prefix = UPGRADE_REMINDER_LOG_PREFIX @@ -211,7 +211,7 @@ ScheduleUpgradeReminder.task_instance = current_app.register_task(ScheduleUpgrad ScheduleUpgradeReminder = ScheduleUpgradeReminder.task_instance -class ScheduleCourseUpdate(BinnedScheduleMessageBaseTask): +class ScheduleCourseUpdate(BinnedScheduleMessageBaseTask): # lint-amnesty, pylint: disable=missing-class-docstring num_bins = resolvers.COURSE_UPDATE_NUM_BINS enqueue_config_var = 'enqueue_course_update' log_prefix = COURSE_UPDATE_LOG_PREFIX @@ -225,7 +225,7 @@ ScheduleCourseUpdate.task_instance = current_app.register_task(ScheduleCourseUpd ScheduleCourseUpdate = ScheduleCourseUpdate.task_instance -class ScheduleCourseNextSectionUpdate(ScheduleMessageBaseTask): +class ScheduleCourseNextSectionUpdate(ScheduleMessageBaseTask): # lint-amnesty, pylint: disable=missing-class-docstring enqueue_config_var = 'enqueue_course_update' log_prefix = COURSE_NEXT_SECTION_UPDATE_LOG_PREFIX resolver = resolvers.CourseNextSectionUpdate @@ -233,7 +233,7 @@ class ScheduleCourseNextSectionUpdate(ScheduleMessageBaseTask): task_instance = None @classmethod - def enqueue(cls, site, current_date, day_offset, override_recipient_email=None): + def enqueue(cls, site, current_date, day_offset, override_recipient_email=None): # lint-amnesty, pylint: disable=missing-function-docstring set_code_owner_attribute_from_module(__name__) target_datetime = (current_date - datetime.timedelta(days=day_offset)) @@ -255,7 +255,7 @@ class ScheduleCourseNextSectionUpdate(ScheduleMessageBaseTask): retry=False, ) - def run(self, site_id, target_day_str, course_key, override_recipient_email=None): + def run(self, site_id, target_day_str, course_key, override_recipient_email=None): # lint-amnesty, pylint: disable=arguments-differ set_code_owner_attribute_from_module(__name__) site = Site.objects.select_related('configuration').get(id=site_id) with emulate_http_request(site=site): @@ -272,7 +272,7 @@ ScheduleCourseNextSectionUpdate.task_instance = current_app.register_task(Schedu ScheduleCourseNextSectionUpdate = ScheduleCourseNextSectionUpdate.task_instance -def _schedule_send(msg_str, site_id, delivery_config_var, log_prefix): +def _schedule_send(msg_str, site_id, delivery_config_var, log_prefix): # lint-amnesty, pylint: disable=missing-function-docstring site = Site.objects.select_related('configuration').get(pk=site_id) if _is_delivery_enabled(site, delivery_config_var, log_prefix): msg = Message.from_string(msg_str) @@ -285,7 +285,7 @@ def _schedule_send(msg_str, site_id, delivery_config_var, log_prefix): _track_message_sent(site, user, msg) -def _track_message_sent(site, user, msg): +def _track_message_sent(site, user, msg): # lint-amnesty, pylint: disable=missing-function-docstring properties = { 'site': site.domain, 'app_label': msg.app_label, @@ -328,7 +328,7 @@ def _is_delivery_enabled(site, delivery_config_var, log_prefix): LOG.info(u'%s: Message delivery disabled for site %s', log_prefix, site.domain) -def _annotate_for_monitoring(message_type, site, bin_num=None, target_day_str=None, day_offset=None, course_key=None): +def _annotate_for_monitoring(message_type, site, bin_num=None, target_day_str=None, day_offset=None, course_key=None): # lint-amnesty, pylint: disable=missing-function-docstring # This identifies the type of message being sent, for example: schedules.recurring_nudge3. set_custom_attribute('message_name', '{0}.{1}'.format(message_type.app_label, message_type.name)) # The domain name of the site we are sending the message for. diff --git a/openedx/core/djangoapps/schedules/tests/factories.py b/openedx/core/djangoapps/schedules/tests/factories.py index d7f060a567..4e4467e85b 100644 --- a/openedx/core/djangoapps/schedules/tests/factories.py +++ b/openedx/core/djangoapps/schedules/tests/factories.py @@ -18,7 +18,7 @@ class ScheduleExperienceFactory(factory.DjangoModelFactory): experience_type = models.ScheduleExperience.EXPERIENCES.default -class ScheduleFactory(factory.DjangoModelFactory): +class ScheduleFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring class Meta(object): model = models.Schedule @@ -28,7 +28,7 @@ class ScheduleFactory(factory.DjangoModelFactory): experience = factory.RelatedFactory(ScheduleExperienceFactory, 'schedule') -class ScheduleConfigFactory(factory.DjangoModelFactory): +class ScheduleConfigFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring class Meta(object): model = models.ScheduleConfig diff --git a/openedx/core/djangoapps/schedules/tests/test_content_highlights.py b/openedx/core/djangoapps/schedules/tests/test_content_highlights.py index c9b361cd07..c8a2e270a6 100644 --- a/openedx/core/djangoapps/schedules/tests/test_content_highlights.py +++ b/openedx/core/djangoapps/schedules/tests/test_content_highlights.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring import datetime from unittest.mock import patch @@ -19,7 +19,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory @skip_unless_lms -class TestContentHighlights(ModuleStoreTestCase): +class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring MODULESTORE = TEST_DATA_SPLIT_MODULESTORE def setUp(self): @@ -98,7 +98,7 @@ class TestContentHighlights(ModuleStoreTestCase): self._create_chapter(display_name=u"Week 1") self._create_chapter(display_name=u"Week 2") - self.course = self.store.get_course(self.course_key) + self.course = self.store.get_course(self.course_key) # lint-amnesty, pylint: disable=attribute-defined-outside-init self.assertEqual(len(self.course.get_children()), 2) self.assertFalse(course_has_highlights(self.course_key)) diff --git a/openedx/core/djangoapps/schedules/tests/test_signals.py b/openedx/core/djangoapps/schedules/tests/test_signals.py index 3ff9c3b3a1..2a6da2eb13 100644 --- a/openedx/core/djangoapps/schedules/tests/test_signals.py +++ b/openedx/core/djangoapps/schedules/tests/test_signals.py @@ -32,7 +32,7 @@ from ..tests.factories import ScheduleConfigFactory @ddt.ddt @patch('openedx.core.djangoapps.schedules.signals.get_current_site') @skip_unless_lms -class CreateScheduleTests(SharedModuleStoreTestCase): +class CreateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring def assert_schedule_created(self, is_self_paced=True, experience_type=ScheduleExperience.EXPERIENCES.default): """ @@ -48,14 +48,14 @@ class CreateScheduleTests(SharedModuleStoreTestCase): assert enrollment.schedule.upgrade_deadline is None assert enrollment.schedule.experience.experience_type == experience_type - def assert_schedule_not_created(self): + def assert_schedule_not_created(self): # lint-amnesty, pylint: disable=missing-function-docstring course = _create_course_run(self_paced=True) enrollment = CourseEnrollmentFactory( course_id=course.id, mode=CourseMode.AUDIT, ) with pytest.raises(Schedule.DoesNotExist): - enrollment.schedule + enrollment.schedule # lint-amnesty, pylint: disable=pointless-statement @override_waffle_flag(CREATE_SCHEDULE_WAFFLE_FLAG, True) def test_create_schedule(self, mock_get_current_site): @@ -121,7 +121,7 @@ class CreateScheduleTests(SharedModuleStoreTestCase): self, hold_back_ratio, expect_schedule_created, - mock_random, + mock_random, # lint-amnesty, pylint: disable=unused-argument mock_track, mock_get_current_site ): @@ -174,12 +174,12 @@ class CreateScheduleTests(SharedModuleStoreTestCase): @ddt.ddt @skip_unless_lms @patch('openedx.core.djangoapps.schedules.signals.get_current_site') -class UpdateScheduleTests(SharedModuleStoreTestCase): +class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring ENABLED_SIGNALS = ['course_published'] VERIFICATION_DEADLINE_DAYS = 14 def setUp(self): - super(UpdateScheduleTests, self).setUp() + super(UpdateScheduleTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.site = SiteFactory.create() ScheduleConfigFactory.create(site=self.site) DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True, deadline_days=self.VERIFICATION_DEADLINE_DAYS) @@ -229,7 +229,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase): @skip_unless_lms @override_waffle_flag(CREATE_SCHEDULE_WAFFLE_FLAG, True) -class ResetScheduleTests(SharedModuleStoreTestCase): +class ResetScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring def setUp(self): super().setUp() diff --git a/openedx/core/djangoapps/schedules/tests/test_tasks.py b/openedx/core/djangoapps/schedules/tests/test_tasks.py index a4e9c6e7b2..2594f787b7 100644 --- a/openedx/core/djangoapps/schedules/tests/test_tasks.py +++ b/openedx/core/djangoapps/schedules/tests/test_tasks.py @@ -21,9 +21,9 @@ from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_un @skip_unless_lms @skipUnless('openedx.core.djangoapps.schedules.apps.SchedulesConfig' in settings.INSTALLED_APPS, "Can't test schedules if the app isn't installed") -class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): +class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty, pylint: disable=missing-class-docstring def setUp(self): - super(TestBinnedScheduleMessageBaseTask, self).setUp() + super(TestBinnedScheduleMessageBaseTask, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.site = SiteFactory.create() self.schedule_config = ScheduleConfigFactory.create(site=self.site) diff --git a/openedx/core/djangoapps/schedules/tests/test_utils.py b/openedx/core/djangoapps/schedules/tests/test_utils.py index f3c96d6535..13947747be 100644 --- a/openedx/core/djangoapps/schedules/tests/test_utils.py +++ b/openedx/core/djangoapps/schedules/tests/test_utils.py @@ -6,8 +6,8 @@ import datetime import ddt from common.djangoapps.course_modes.models import CourseMode -from mock import patch -from pytz import utc +from mock import patch # lint-amnesty, pylint: disable=wrong-import-order +from pytz import utc # lint-amnesty, pylint: disable=wrong-import-order from openedx.core.djangoapps.schedules.models import Schedule from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFactory @@ -20,29 +20,29 @@ from xmodule.modulestore.tests.factories import CourseFactory @ddt.ddt @skip_unless_lms -class ResetSelfPacedScheduleTests(SharedModuleStoreTestCase): - def create_schedule(self, offset=0): - self.config = ScheduleConfigFactory(create_schedules=True) +class ResetSelfPacedScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring + def create_schedule(self, offset=0): # lint-amnesty, pylint: disable=missing-function-docstring + self.config = ScheduleConfigFactory(create_schedules=True) # lint-amnesty, pylint: disable=attribute-defined-outside-init site_patch = patch('openedx.core.djangoapps.schedules.signals.get_current_site', return_value=self.config.site) self.addCleanup(site_patch.stop) site_patch.start() start = datetime.datetime.now(utc) - datetime.timedelta(days=100) - self.course = CourseFactory.create(start=start, self_paced=True) + self.course = CourseFactory.create(start=start, self_paced=True) # lint-amnesty, pylint: disable=attribute-defined-outside-init - self.enrollment = CourseEnrollmentFactory( + self.enrollment = CourseEnrollmentFactory( # lint-amnesty, pylint: disable=attribute-defined-outside-init course_id=self.course.id, mode=CourseMode.AUDIT, ) self.enrollment.created = start + datetime.timedelta(days=offset) self.enrollment.save() - self.schedule = self.enrollment.schedule + self.schedule = self.enrollment.schedule # lint-amnesty, pylint: disable=attribute-defined-outside-init self.schedule.start_date = self.enrollment.created self.schedule.save() - self.user = self.enrollment.user + self.user = self.enrollment.user # lint-amnesty, pylint: disable=attribute-defined-outside-init def test_reset_to_now(self): self.create_schedule() diff --git a/openedx/core/djangoapps/schedules/utils.py b/openedx/core/djangoapps/schedules/utils.py index 26e8f18245..007da1eae9 100644 --- a/openedx/core/djangoapps/schedules/utils.py +++ b/openedx/core/djangoapps/schedules/utils.py @@ -1,11 +1,11 @@ - +# lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring import datetime import logging import pytz -from django.db.models import F, Subquery -from django.db.models.functions import Greatest +from django.db.models import F, Subquery # lint-amnesty, pylint: disable=unused-import +from django.db.models.functions import Greatest # lint-amnesty, pylint: disable=unused-import from django.db import transaction from openedx.core.djangoapps.schedules.models import Schedule @@ -15,11 +15,11 @@ LOG = logging.getLogger(__name__) # TODO: consider using a LoggerAdapter instead of this mixin: # https://docs.python.org/2/library/logging.html#logging.LoggerAdapter -class PrefixedDebugLoggerMixin(object): +class PrefixedDebugLoggerMixin(object): # lint-amnesty, pylint: disable=missing-class-docstring log_prefix = None def __init__(self, *args, **kwargs): - super(PrefixedDebugLoggerMixin, self).__init__(*args, **kwargs) + super(PrefixedDebugLoggerMixin, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments if self.log_prefix is None: self.log_prefix = self.__class__.__name__ diff --git a/openedx/core/djangoapps/self_paced/admin.py b/openedx/core/djangoapps/self_paced/admin.py index df3ff01b25..28c0d68ad8 100644 --- a/openedx/core/djangoapps/self_paced/admin.py +++ b/openedx/core/djangoapps/self_paced/admin.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Admin site bindings for self-paced courses. """ diff --git a/openedx/core/djangoapps/service_status/__init__.py b/openedx/core/djangoapps/service_status/__init__.py index e90be0088e..72eb0e976e 100644 --- a/openedx/core/djangoapps/service_status/__init__.py +++ b/openedx/core/djangoapps/service_status/__init__.py @@ -1,3 +1,3 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Stub for a Django app to report the status of various services """ diff --git a/openedx/core/djangoapps/service_status/test.py b/openedx/core/djangoapps/service_status/test.py index 756a9d34b3..6930904b4a 100644 --- a/openedx/core/djangoapps/service_status/test.py +++ b/openedx/core/djangoapps/service_status/test.py @@ -19,7 +19,7 @@ class CeleryConfigTest(unittest.TestCase): """ Create a django test client """ - super(CeleryConfigTest, self).setUp() + super(CeleryConfigTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.client = Client() self.ping_url = reverse('status.service.celery.ping') diff --git a/openedx/core/djangoapps/service_status/views.py b/openedx/core/djangoapps/service_status/views.py index a73c0cedd0..fa14d32226 100644 --- a/openedx/core/djangoapps/service_status/views.py +++ b/openedx/core/djangoapps/service_status/views.py @@ -6,7 +6,7 @@ Django Views for service status app import json import time -from celery.exceptions import TimeoutError +from celery.exceptions import TimeoutError # lint-amnesty, pylint: disable=redefined-builtin from django.http import HttpResponse from celery import current_app as celery from openedx.core.djangoapps.service_status.tasks import delayed_ping @@ -24,7 +24,7 @@ def celery_status(_): A view that returns Celery stats """ stats = celery.control.inspect().stats() or {} - return HttpResponse(json.dumps(stats, indent=4), + return HttpResponse(json.dumps(stats, indent=4), # lint-amnesty, pylint: disable=http-response-with-content-type-json, http-response-with-json-dumps content_type="application/json") @@ -51,5 +51,5 @@ def celery_ping(_): 'time': time.time() - start, } - return HttpResponse(json.dumps(output, indent=4), + return HttpResponse(json.dumps(output, indent=4), # lint-amnesty, pylint: disable=http-response-with-content-type-json, http-response-with-json-dumps content_type="application/json")