diff --git a/lms/djangoapps/rss_proxy/migrations/0001_initial.py b/lms/djangoapps/rss_proxy/migrations/0001_initial.py index db125c2bc0..e08e6133c2 100644 --- a/lms/djangoapps/rss_proxy/migrations/0001_initial.py +++ b/lms/djangoapps/rss_proxy/migrations/0001_initial.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- - - - from django.db import migrations, models import django.utils.timezone import model_utils.fields diff --git a/lms/djangoapps/rss_proxy/models.py b/lms/djangoapps/rss_proxy/models.py index f9712f152b..de44f1ae4e 100644 --- a/lms/djangoapps/rss_proxy/models.py +++ b/lms/djangoapps/rss_proxy/models.py @@ -1,9 +1,6 @@ """ Models for the rss_proxy djangoapp. """ - - -import six from django.db import models from django.utils.encoding import python_2_unicode_compatible from model_utils.models import TimeStampedModel @@ -19,9 +16,9 @@ class WhitelistedRssUrl(TimeStampedModel): """ url = models.CharField(max_length=255, unique=True, db_index=True) - class Meta(object): + class Meta: """ Meta class for this Django model """ app_label = "rss_proxy" def __str__(self): - return six.text_type(self.url) + return str(self.url) diff --git a/lms/djangoapps/rss_proxy/tests/test_models.py b/lms/djangoapps/rss_proxy/tests/test_models.py index 2cb6a34ad6..f31ffa75dd 100644 --- a/lms/djangoapps/rss_proxy/tests/test_models.py +++ b/lms/djangoapps/rss_proxy/tests/test_models.py @@ -1,9 +1,6 @@ """ Tests for the rss_proxy models """ - - -import six from django.test import TestCase from lms.djangoapps.rss_proxy.models import WhitelistedRssUrl @@ -13,11 +10,11 @@ class WhitelistedRssUrlTests(TestCase): """ Tests for the rss_proxy.WhitelistedRssUrl model """ def setUp(self): - super(WhitelistedRssUrlTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.whitelisted_rss_url = WhitelistedRssUrl.objects.create(url='http://www.example.com') def test_unicode(self): """ Test the unicode function returns the url """ - assert six.text_type(self.whitelisted_rss_url) == self.whitelisted_rss_url.url + assert str(self.whitelisted_rss_url) == self.whitelisted_rss_url.url diff --git a/lms/djangoapps/rss_proxy/tests/test_views.py b/lms/djangoapps/rss_proxy/tests/test_views.py index 052d9800a6..b238f42303 100644 --- a/lms/djangoapps/rss_proxy/tests/test_views.py +++ b/lms/djangoapps/rss_proxy/tests/test_views.py @@ -3,9 +3,10 @@ Tests for the rss_proxy views """ +from unittest.mock import Mock, patch + from django.test import TestCase from django.urls import reverse -from mock import Mock, patch from lms.djangoapps.rss_proxy.models import WhitelistedRssUrl @@ -14,7 +15,7 @@ class RssProxyViewTests(TestCase): """ Tests for the rss_proxy views """ def setUp(self): - super(RssProxyViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments + super().setUp() self.whitelisted_url1 = 'http://www.example.com' self.whitelisted_url2 = 'http://www.example.org' @@ -45,7 +46,7 @@ class RssProxyViewTests(TestCase): Test the proxy view with a whitelisted URL """ mock_requests_get.return_value = Mock(status_code=200, content=self.rss) - resp = self.client.get('%s?url=%s' % (reverse('rss_proxy:proxy'), self.whitelisted_url1)) + resp = self.client.get('{}?url={}'.format(reverse('rss_proxy:proxy'), self.whitelisted_url1)) assert resp.status_code == 200 assert resp['Content-Type'] == 'application/xml' assert resp.content.decode('utf-8') == self.rss @@ -56,7 +57,7 @@ class RssProxyViewTests(TestCase): Test the proxy view with a whitelisted URL that is not found """ mock_requests_get.return_value = Mock(status_code=404) - resp = self.client.get('%s?url=%s' % (reverse('rss_proxy:proxy'), self.whitelisted_url2)) + resp = self.client.get('{}?url={}'.format(reverse('rss_proxy:proxy'), self.whitelisted_url2)) print(resp.status_code) print(resp.content) print(resp['Content-Type']) @@ -68,5 +69,5 @@ class RssProxyViewTests(TestCase): """ Test the proxy view with a non-whitelisted URL """ - resp = self.client.get('%s?url=%s' % (reverse('rss_proxy:proxy'), self.non_whitelisted_url)) + resp = self.client.get('{}?url={}'.format(reverse('rss_proxy:proxy'), self.non_whitelisted_url)) assert resp.status_code == 404 diff --git a/lms/djangoapps/rss_proxy/views.py b/lms/djangoapps/rss_proxy/views.py index a27299b16d..9d10f233df 100644 --- a/lms/djangoapps/rss_proxy/views.py +++ b/lms/djangoapps/rss_proxy/views.py @@ -25,7 +25,7 @@ def proxy(request): status_code = 200 rss = cache.get(cache_key, '') print(cache_key) - print(u'Cached rss: %s' % rss) + print('Cached rss: %s' % rss) if not rss: # Go get the RSS from the URL if it was not cached resp = requests.get(url) diff --git a/lms/djangoapps/shoppingcart/migrations/0001_initial.py b/lms/djangoapps/shoppingcart/migrations/0001_initial.py index f0917ab38d..4987b8a120 100644 --- a/lms/djangoapps/shoppingcart/migrations/0001_initial.py +++ b/lms/djangoapps/shoppingcart/migrations/0001_initial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - import django.db.models.deletion import django.utils.timezone import model_utils.fields @@ -116,7 +113,7 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('qty', models.IntegerField(default=1, help_text='The number of items sold.')), ('unit_price', models.DecimalField(default=0.0, help_text='The price per item sold, including discounts.', max_digits=30, decimal_places=2)), - ('currency', models.CharField(default=u'usd', help_text='Lower-case ISO currency codes', max_length=8)), + ('currency', models.CharField(default='usd', help_text='Lower-case ISO currency codes', max_length=8)), ], ), migrations.CreateModel( @@ -126,9 +123,9 @@ class Migration(migrations.Migration): ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('amount', models.DecimalField(default=0.0, help_text='The amount of the transaction. Use positive amounts for payments and negative amounts for refunds.', max_digits=30, decimal_places=2)), - ('currency', models.CharField(default=u'usd', help_text='Lower-case ISO currency codes', max_length=8)), + ('currency', models.CharField(default='usd', help_text='Lower-case ISO currency codes', max_length=8)), ('comments', models.TextField(help_text='Optional: provide additional information for this transaction', null=True, blank=True)), - ('status', models.CharField(default=u'started', help_text="The status of the payment or refund. 'started' means that payment is expected, but money has not yet been transferred. 'completed' means that the payment or refund was received. 'cancelled' means that payment or refund was expected, but was cancelled before money was transferred. ", max_length=32, choices=[(u'started', u'started'), (u'completed', u'completed'), (u'cancelled', u'cancelled')])), + ('status', models.CharField(default='started', help_text="The status of the payment or refund. 'started' means that payment is expected, but money has not yet been transferred. 'completed' means that the payment or refund was received. 'cancelled' means that payment or refund was expected, but was cancelled before money was transferred. ", max_length=32, choices=[('started', 'started'), ('completed', 'completed'), ('cancelled', 'cancelled')])), ('created_by', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ('invoice', models.ForeignKey(to='shoppingcart.Invoice', on_delete=models.CASCADE)), ('last_modified_by', models.ForeignKey(related_name='last_modified_by_user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), @@ -138,8 +135,8 @@ class Migration(migrations.Migration): name='Order', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('currency', models.CharField(default=u'usd', max_length=8)), - ('status', models.CharField(default=u'cart', max_length=32, choices=[(u'cart', u'cart'), (u'paying', u'paying'), (u'purchased', u'purchased'), (u'refunded', u'refunded'), (u'defunct-cart', u'defunct-cart'), (u'defunct-paying', u'defunct-paying')])), + ('currency', models.CharField(default='usd', max_length=8)), + ('status', models.CharField(default='cart', max_length=32, choices=[('cart', 'cart'), ('paying', 'paying'), ('purchased', 'purchased'), ('refunded', 'refunded'), ('defunct-cart', 'defunct-cart'), ('defunct-paying', 'defunct-paying')])), ('purchase_time', models.DateTimeField(null=True, blank=True)), ('refunded_time', models.DateTimeField(null=True, blank=True)), ('bill_to_first', models.CharField(max_length=64, blank=True)), @@ -159,7 +156,7 @@ class Migration(migrations.Migration): ('recipient_name', models.CharField(max_length=255, null=True, blank=True)), ('recipient_email', models.CharField(max_length=255, null=True, blank=True)), ('customer_reference_number', models.CharField(max_length=63, null=True, blank=True)), - ('order_type', models.CharField(default=u'personal', max_length=32, choices=[(u'personal', u'personal'), (u'business', u'business')])), + ('order_type', models.CharField(default='personal', max_length=32, choices=[('personal', 'personal'), ('business', 'business')])), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), @@ -169,16 +166,16 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('status', models.CharField(default=u'cart', max_length=32, db_index=True, choices=[(u'cart', u'cart'), (u'paying', u'paying'), (u'purchased', u'purchased'), (u'refunded', u'refunded'), (u'defunct-cart', u'defunct-cart'), (u'defunct-paying', u'defunct-paying')])), + ('status', models.CharField(default='cart', max_length=32, db_index=True, choices=[('cart', 'cart'), ('paying', 'paying'), ('purchased', 'purchased'), ('refunded', 'refunded'), ('defunct-cart', 'defunct-cart'), ('defunct-paying', 'defunct-paying')])), ('qty', models.IntegerField(default=1)), ('unit_cost', models.DecimalField(default=0.0, max_digits=30, decimal_places=2)), ('list_price', models.DecimalField(null=True, max_digits=30, decimal_places=2)), - ('line_desc', models.CharField(default=u'Misc. Item', max_length=1024)), - ('currency', models.CharField(default=u'usd', max_length=8)), + ('line_desc', models.CharField(default='Misc. Item', max_length=1024)), + ('currency', models.CharField(default='usd', max_length=8)), ('fulfilled_time', models.DateTimeField(null=True, db_index=True)), ('refund_requested_time', models.DateTimeField(null=True, db_index=True)), ('service_fee', models.DecimalField(default=0.0, max_digits=30, decimal_places=2)), - ('report_comments', models.TextField(default=u'')), + ('report_comments', models.TextField(default='')), ], ), migrations.CreateModel( @@ -231,7 +228,7 @@ class Migration(migrations.Migration): name='Donation', fields=[ ('orderitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.OrderItem', on_delete=models.CASCADE)), - ('donation_type', models.CharField(default=u'general', max_length=32, choices=[(u'general', u'A general donation'), (u'course', u'A donation to a particular course')])), + ('donation_type', models.CharField(default='general', max_length=32, choices=[('general', 'A general donation'), ('course', 'A donation to a particular course')])), ('course_id', CourseKeyField(max_length=255, db_index=True)), ], bases=('shoppingcart.orderitem',), diff --git a/lms/djangoapps/shoppingcart/migrations/0002_auto_20151208_1034.py b/lms/djangoapps/shoppingcart/migrations/0002_auto_20151208_1034.py index d394e88e41..28110125ac 100644 --- a/lms/djangoapps/shoppingcart/migrations/0002_auto_20151208_1034.py +++ b/lms/djangoapps/shoppingcart/migrations/0002_auto_20151208_1034.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models diff --git a/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py b/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py index 15a5fcfb01..5fa93922af 100644 --- a/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py +++ b/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from django.db import migrations, models @@ -14,11 +11,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseregcodeitem', name='mode', - field=models.SlugField(default=u'honor'), + field=models.SlugField(default='honor'), ), migrations.AlterField( model_name='paidcourseregistration', name='mode', - field=models.SlugField(default=u'honor'), + field=models.SlugField(default='honor'), ), ] diff --git a/lms/djangoapps/shoppingcart/migrations/0004_change_meta_options.py b/lms/djangoapps/shoppingcart/migrations/0004_change_meta_options.py index ddf578d3c7..fb9890b3ac 100644 --- a/lms/djangoapps/shoppingcart/migrations/0004_change_meta_options.py +++ b/lms/djangoapps/shoppingcart/migrations/0004_change_meta_options.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-05-14 20:37