diff --git a/openedx/core/djangoapps/schedules/migrations/0001_initial.py b/openedx/core/djangoapps/schedules/migrations/0001_initial.py index b4d9a85816..9708fd674c 100644 --- a/openedx/core/djangoapps/schedules/migrations/0001_initial.py +++ b/openedx/core/djangoapps/schedules/migrations/0001_initial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - import django.utils.timezone import model_utils.fields from django.db import migrations, models diff --git a/openedx/core/djangoapps/schedules/migrations/0002_auto_20170816_1532.py b/openedx/core/djangoapps/schedules/migrations/0002_auto_20170816_1532.py index 4450739eee..bc58849d91 100644 --- a/openedx/core/djangoapps/schedules/migrations/0002_auto_20170816_1532.py +++ b/openedx/core/djangoapps/schedules/migrations/0002_auto_20170816_1532.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/openedx/core/djangoapps/schedules/migrations/0003_scheduleconfig.py b/openedx/core/djangoapps/schedules/migrations/0003_scheduleconfig.py index d824dd0a8c..2a69298ecc 100644 --- a/openedx/core/djangoapps/schedules/migrations/0003_scheduleconfig.py +++ b/openedx/core/djangoapps/schedules/migrations/0003_scheduleconfig.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - import django.db.models.deletion from django.conf import settings from django.db import migrations, models diff --git a/openedx/core/djangoapps/schedules/migrations/0004_auto_20170922_1428.py b/openedx/core/djangoapps/schedules/migrations/0004_auto_20170922_1428.py index 382768cadb..bd85d894af 100644 --- a/openedx/core/djangoapps/schedules/migrations/0004_auto_20170922_1428.py +++ b/openedx/core/djangoapps/schedules/migrations/0004_auto_20170922_1428.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/openedx/core/djangoapps/schedules/migrations/0005_auto_20171010_1722.py b/openedx/core/djangoapps/schedules/migrations/0005_auto_20171010_1722.py index ce3667e9af..165bdd7e8a 100644 --- a/openedx/core/djangoapps/schedules/migrations/0005_auto_20171010_1722.py +++ b/openedx/core/djangoapps/schedules/migrations/0005_auto_20171010_1722.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/openedx/core/djangoapps/schedules/migrations/0006_scheduleexperience.py b/openedx/core/djangoapps/schedules/migrations/0006_scheduleexperience.py index dca76c9c74..d65725c831 100644 --- a/openedx/core/djangoapps/schedules/migrations/0006_scheduleexperience.py +++ b/openedx/core/djangoapps/schedules/migrations/0006_scheduleexperience.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -15,7 +12,7 @@ class Migration(migrations.Migration): name='ScheduleExperience', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('experience_type', models.PositiveSmallIntegerField(default=0, choices=[(0, u'Recurring Nudge and Upgrade Reminder'), (1, u'Course Updates')])), + ('experience_type', models.PositiveSmallIntegerField(default=0, choices=[(0, 'Recurring Nudge and Upgrade Reminder'), (1, 'Course Updates')])), ('schedule', models.OneToOneField(related_name='experience', to='schedules.Schedule', on_delete=models.CASCADE)), ], ), diff --git a/openedx/core/djangoapps/schedules/migrations/0007_scheduleconfig_hold_back_ratio.py b/openedx/core/djangoapps/schedules/migrations/0007_scheduleconfig_hold_back_ratio.py index 87f1619f21..a68aa3ac06 100644 --- a/openedx/core/djangoapps/schedules/migrations/0007_scheduleconfig_hold_back_ratio.py +++ b/openedx/core/djangoapps/schedules/migrations/0007_scheduleconfig_hold_back_ratio.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py b/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py index 9e5ee207aa..07dc5d43b6 100644 --- a/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py +++ b/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.26 on 2019-11-21 18:00 diff --git a/openedx/core/djangoapps/schedules/migrations/0009_schedule_copy_column_values.py b/openedx/core/djangoapps/schedules/migrations/0009_schedule_copy_column_values.py index fa9f25e35d..788e5aea99 100644 --- a/openedx/core/djangoapps/schedules/migrations/0009_schedule_copy_column_values.py +++ b/openedx/core/djangoapps/schedules/migrations/0009_schedule_copy_column_values.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.26 on 2019-11-24 20:52 diff --git a/openedx/core/djangoapps/schedules/migrations/0010_remove_null_blank_from_schedules_date.py b/openedx/core/djangoapps/schedules/migrations/0010_remove_null_blank_from_schedules_date.py index 3f580f794b..7ffcf7bac3 100644 --- a/openedx/core/djangoapps/schedules/migrations/0010_remove_null_blank_from_schedules_date.py +++ b/openedx/core/djangoapps/schedules/migrations/0010_remove_null_blank_from_schedules_date.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.26 on 2019-12-18 16:18 diff --git a/openedx/core/djangoapps/schedules/migrations/0011_auto_20200228_2018.py b/openedx/core/djangoapps/schedules/migrations/0011_auto_20200228_2018.py index 2b68df16ba..1702f82b87 100644 --- a/openedx/core/djangoapps/schedules/migrations/0011_auto_20200228_2018.py +++ b/openedx/core/djangoapps/schedules/migrations/0011_auto_20200228_2018.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-02-28 20:18 diff --git a/openedx/core/djangoapps/schedules/migrations/0012_auto_20200302_1914.py b/openedx/core/djangoapps/schedules/migrations/0012_auto_20200302_1914.py index f82f7f3682..97f37dd8ac 100644 --- a/openedx/core/djangoapps/schedules/migrations/0012_auto_20200302_1914.py +++ b/openedx/core/djangoapps/schedules/migrations/0012_auto_20200302_1914.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-02 19:14 diff --git a/openedx/core/djangoapps/schedules/migrations/0013_historicalschedule.py b/openedx/core/djangoapps/schedules/migrations/0013_historicalschedule.py index 8fc49d168b..59c1665736 100644 --- a/openedx/core/djangoapps/schedules/migrations/0013_historicalschedule.py +++ b/openedx/core/djangoapps/schedules/migrations/0013_historicalschedule.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-03 18:36 diff --git a/openedx/core/djangoapps/schedules/migrations/0014_historicalschedule_drop_fk.py b/openedx/core/djangoapps/schedules/migrations/0014_historicalschedule_drop_fk.py index 3c2eabf554..210e3acaf6 100644 --- a/openedx/core/djangoapps/schedules/migrations/0014_historicalschedule_drop_fk.py +++ b/openedx/core/djangoapps/schedules/migrations/0014_historicalschedule_drop_fk.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-09 17:02 diff --git a/openedx/core/djangoapps/schedules/migrations/0015_schedules_start_nullable.py b/openedx/core/djangoapps/schedules/migrations/0015_schedules_start_nullable.py index e28df77c58..43366618f2 100644 --- a/openedx/core/djangoapps/schedules/migrations/0015_schedules_start_nullable.py +++ b/openedx/core/djangoapps/schedules/migrations/0015_schedules_start_nullable.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-04 21:49 diff --git a/openedx/core/djangoapps/schedules/migrations/0016_remove_start_from_schedules.py b/openedx/core/djangoapps/schedules/migrations/0016_remove_start_from_schedules.py index 43b68216a1..17b0c83233 100644 --- a/openedx/core/djangoapps/schedules/migrations/0016_remove_start_from_schedules.py +++ b/openedx/core/djangoapps/schedules/migrations/0016_remove_start_from_schedules.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.27 on 2020-01-07 18:46 diff --git a/openedx/core/djangoapps/schedules/migrations/0017_remove_start_from_historicalschedule.py b/openedx/core/djangoapps/schedules/migrations/0017_remove_start_from_historicalschedule.py index 38181ab3da..f0f128e915 100644 --- a/openedx/core/djangoapps/schedules/migrations/0017_remove_start_from_historicalschedule.py +++ b/openedx/core/djangoapps/schedules/migrations/0017_remove_start_from_historicalschedule.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-12 20:29 diff --git a/openedx/core/djangoapps/schedules/migrations/0018_readd_historicalschedule_fks.py b/openedx/core/djangoapps/schedules/migrations/0018_readd_historicalschedule_fks.py index c5fd3a36c0..e268c735ea 100644 --- a/openedx/core/djangoapps/schedules/migrations/0018_readd_historicalschedule_fks.py +++ b/openedx/core/djangoapps/schedules/migrations/0018_readd_historicalschedule_fks.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-16 14:00 diff --git a/openedx/core/djangoapps/schedules/migrations/0019_auto_20200316_1935.py b/openedx/core/djangoapps/schedules/migrations/0019_auto_20200316_1935.py index ec29135381..04d59fb137 100644 --- a/openedx/core/djangoapps/schedules/migrations/0019_auto_20200316_1935.py +++ b/openedx/core/djangoapps/schedules/migrations/0019_auto_20200316_1935.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-16 19:35 diff --git a/openedx/core/djangoapps/schedules/tests/factories.py b/openedx/core/djangoapps/schedules/tests/factories.py index 580cf44018..560e3d6689 100644 --- a/openedx/core/djangoapps/schedules/tests/factories.py +++ b/openedx/core/djangoapps/schedules/tests/factories.py @@ -12,14 +12,14 @@ from common.djangoapps.student.tests.factories import CourseEnrollmentFactory class ScheduleExperienceFactory(factory.DjangoModelFactory): - class Meta(object): + class Meta: model = models.ScheduleExperience experience_type = models.ScheduleExperience.EXPERIENCES.default class ScheduleFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring - class Meta(object): + class Meta: model = models.Schedule start_date = factory.Faker('future_datetime', tzinfo=pytz.UTC) @@ -29,7 +29,7 @@ class ScheduleFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disa class ScheduleConfigFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring - class Meta(object): + class Meta: model = models.ScheduleConfig site = factory.SubFactory(SiteFactory) diff --git a/openedx/core/djangoapps/schedules/tests/test_content_highlights.py b/openedx/core/djangoapps/schedules/tests/test_content_highlights.py index c38b888e1f..f6c47031d5 100644 --- a/openedx/core/djangoapps/schedules/tests/test_content_highlights.py +++ b/openedx/core/djangoapps/schedules/tests/test_content_highlights.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring - import datetime from unittest.mock import patch import pytest @@ -85,8 +83,8 @@ class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disab def test_course_with_no_highlights(self): with self.store.bulk_operations(self.course_key): - self._create_chapter(display_name=u"Week 1") - self._create_chapter(display_name=u"Week 2") + self._create_chapter(display_name="Week 1") + self._create_chapter(display_name="Week 2") self.course = self.store.get_course(self.course_key) # lint-amnesty, pylint: disable=attribute-defined-outside-init assert len(self.course.get_children()) == 2 @@ -158,7 +156,7 @@ class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disab assert get_next_section_highlights(self.user, self.course_key, two_days_ago, three_days.date()) == (None, None) assert get_next_section_highlights(self.user, self.course_key, two_days_ago, four_days.date()) ==\ (['final week!'], 4) - exception_message = 'Last section was reached. There are no more highlights for {}'.format(self.course_key) + exception_message = f'Last section was reached. There are no more highlights for {self.course_key}' with pytest.raises(CourseUpdateDoesNotExist): get_next_section_highlights(self.user, self.course_key, two_days_ago, six_days.date()) diff --git a/openedx/core/djangoapps/schedules/tests/test_resolvers.py b/openedx/core/djangoapps/schedules/tests/test_resolvers.py index 957f779369..226502e328 100644 --- a/openedx/core/djangoapps/schedules/tests/test_resolvers.py +++ b/openedx/core/djangoapps/schedules/tests/test_resolvers.py @@ -87,9 +87,9 @@ class TestBinnedSchedulesBaseResolver(SchedulesResolverTestMixin, TestCase): @ddt.unpack @ddt.data( - (None, set([])), - ('course1', set(['course1'])), - (['course1', 'course2'], set(['course1', 'course2'])) + (None, set()), + ('course1', {'course1'}), + (['course1', 'course2'], {'course1', 'course2'}) ) def test_get_course_org_filter_exclude__in(self, course_org_filter, expected_org_list): SiteConfigurationFactory.create( @@ -168,7 +168,7 @@ class TestCourseUpdateResolver(SchedulesResolverTestMixin, ModuleStoreTestCase): 'contact_mailing_address': '123 Sesame Street', 'course_ids': [str(self.course.id)], 'course_name': self.course.display_name, - 'course_url': '/courses/{}/course/'.format(self.course.id), + 'course_url': f'/courses/{self.course.id}/course/', 'dashboard_url': '/dashboard', 'homepage_url': '/', 'mobile_store_urls': {}, @@ -257,7 +257,7 @@ class TestCourseNextSectionUpdateResolver(SchedulesResolverTestMixin, ModuleStor 'contact_mailing_address': '123 Sesame Street', 'course_ids': [str(self.course.id)], 'course_name': self.course.display_name, - 'course_url': '/courses/{}/course/'.format(self.course.id), + 'course_url': f'/courses/{self.course.id}/course/', 'dashboard_url': '/dashboard', 'homepage_url': '/', 'mobile_store_urls': {}, diff --git a/openedx/core/djangoapps/schedules/tests/test_signals.py b/openedx/core/djangoapps/schedules/tests/test_signals.py index 0739a5e7d6..048fb4ab7e 100644 --- a/openedx/core/djangoapps/schedules/tests/test_signals.py +++ b/openedx/core/djangoapps/schedules/tests/test_signals.py @@ -4,10 +4,10 @@ Tests for schedules signals import datetime +from unittest.mock import patch import ddt import pytest -from mock import patch from pytz import utc from common.djangoapps.course_modes.models import CourseMode @@ -99,7 +99,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: d VERIFICATION_DEADLINE_DAYS = 14 def setUp(self): - super(UpdateScheduleTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.site = SiteFactory.create() ScheduleConfigFactory.create(site=self.site) DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True, deadline_days=self.VERIFICATION_DEADLINE_DAYS) diff --git a/openedx/core/djangoapps/schedules/tests/test_tasks.py b/openedx/core/djangoapps/schedules/tests/test_tasks.py index 2594f787b7..412a625217 100644 --- a/openedx/core/djangoapps/schedules/tests/test_tasks.py +++ b/openedx/core/djangoapps/schedules/tests/test_tasks.py @@ -5,10 +5,10 @@ Tests for schedules tasks import datetime from unittest import skipUnless +from unittest.mock import DEFAULT, Mock, patch import ddt from django.conf import settings -from mock import DEFAULT, Mock, patch from openedx.core.djangoapps.schedules.resolvers import DEFAULT_NUM_BINS from openedx.core.djangoapps.schedules.tasks import BinnedScheduleMessageBaseTask @@ -23,7 +23,7 @@ from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_un "Can't test schedules if the app isn't installed") class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty, pylint: disable=missing-class-docstring def setUp(self): - super(TestBinnedScheduleMessageBaseTask, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.site = SiteFactory.create() self.schedule_config = ScheduleConfigFactory.create(site=self.site) @@ -43,7 +43,7 @@ class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty day_offset=2 ) patches['log_info'].assert_called_once_with( - u'Message queuing disabled for site %s', self.site.domain) + 'Message queuing disabled for site %s', self.site.domain) send.apply_async.assert_not_called() @ddt.data(0, 2, -3) @@ -64,7 +64,7 @@ class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty target_date = current_date.replace(hour=0, minute=0, second=0, microsecond=0) + \ datetime.timedelta(day_offset) patches['log_info'].assert_any_call( - u'Target date = %s', target_date.isoformat()) + 'Target date = %s', target_date.isoformat()) assert send.call_count == DEFAULT_NUM_BINS @ddt.data(True, False)