[PATCH 02/10] trivial: Remove unnecessary unicode prefixes

Stephen Finucane stephen at that.guru
Sat Oct 1 02:19:13 AEST 2022


Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 docs/conf.py                        |  6 +++---
 patchwork/forms.py                  |  8 +++++---
 patchwork/tests/test_parser.py      | 12 ++++++------
 patchwork/tests/views/test_mail.py  | 16 ++++++++--------
 patchwork/tests/views/test_patch.py |  2 +-
 patchwork/tests/views/test_utils.py |  6 +++---
 6 files changed, 26 insertions(+), 24 deletions(-)

diff --git docs/conf.py docs/conf.py
index 30a6b006..0b303c73 100644
--- docs/conf.py
+++ docs/conf.py
@@ -29,9 +29,9 @@ html_theme = 'sphinx_rtd_theme'
 master_doc = 'index'
 
 # General information about the project.
-project = u'Patchwork'
-copyright = u'2018-2019, Patchwork Developers'
-author = u'Patchwork Developers'
+project = 'Patchwork'
+copyright = '2018-, Patchwork Developers'
+author = 'Patchwork Developers'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
diff --git patchwork/forms.py patchwork/forms.py
index 7c9781af..84448586 100644
--- patchwork/forms.py
+++ patchwork/forms.py
@@ -18,9 +18,11 @@ class RegistrationForm(forms.Form):
     first_name = forms.CharField(max_length=30, required=False)
     last_name = forms.CharField(max_length=30, required=False)
     username = forms.RegexField(
-        regex=r'^\w+$', max_length=30, label=u'Username'
+        regex=r'^\w+$',
+        max_length=30,
+        label='Username',
     )
-    email = forms.EmailField(max_length=100, label=u'Email address')
+    email = forms.EmailField(max_length=100, label='Email address')
     password = forms.CharField(widget=forms.PasswordInput(), label='Password')
 
     def clean_username(self):
@@ -57,7 +59,7 @@ class BundleForm(forms.ModelForm):
         regex=r'^[^/]+$',
         min_length=1,
         max_length=50,
-        label=u'Name',
+        label='Name',
         error_messages={'invalid': 'Bundle names can\'t contain slashes'},
     )
 
diff --git patchwork/tests/test_parser.py patchwork/tests/test_parser.py
index 108d8b9b..b731fe78 100644
--- patchwork/tests/test_parser.py
+++ patchwork/tests/test_parser.py
@@ -279,25 +279,25 @@ class SenderEncodingTest(TestCase):
 
     def test_ascii_encoding(self):
         from_header = 'example user <user at example.com>'
-        sender_name = u'example user'
+        sender_name = 'example user'
         sender_email = 'user at example.com'
         self._test_encoding(from_header, sender_name, sender_email)
 
     def test_utf8qp_encoding(self):
         from_header = '=?utf-8?q?=C3=A9xample=20user?= <user at example.com>'
-        sender_name = u'\xe9xample user'
+        sender_name = '\xe9xample user'
         sender_email = 'user at example.com'
         self._test_encoding(from_header, sender_name, sender_email)
 
     def test_utf8qp_split_encoding(self):
         from_header = '=?utf-8?q?=C3=A9xample?= user <user at example.com>'
-        sender_name = u'\xe9xample user'
+        sender_name = '\xe9xample user'
         sender_email = 'user at example.com'
         self._test_encoding(from_header, sender_name, sender_email)
 
     def test_utf8b64_encoding(self):
         from_header = '=?utf-8?B?w6l4YW1wbGUgdXNlcg==?= <user at example.com>'
-        sender_name = u'\xe9xample user'
+        sender_name = '\xe9xample user'
         sender_email = 'user at example.com'
         self._test_encoding(from_header, sender_name, sender_email)
 
@@ -552,12 +552,12 @@ class SubjectEncodingTest(TestCase):
 
     def test_subject_utf8qp_encoding(self):
         subject_header = '=?utf-8?q?test=20s=c3=bcbject?='
-        subject = u'test s\xfcbject'
+        subject = 'test s\xfcbject'
         self._test_encoding(subject_header, subject)
 
     def test_subject_utf8qp_multiple_encoding(self):
         subject_header = 'test =?utf-8?q?s=c3=bcbject?='
-        subject = u'test s\xfcbject'
+        subject = 'test s\xfcbject'
         self._test_encoding(subject_header, subject)
 
 
diff --git patchwork/tests/views/test_mail.py patchwork/tests/views/test_mail.py
index f2b19973..de9df3d2 100644
--- patchwork/tests/views/test_mail.py
+++ patchwork/tests/views/test_mail.py
@@ -23,7 +23,7 @@ class MailSettingsTest(TestCase):
         self.assertTrue(response.context['form'])
 
     def test_post(self):
-        email = u'foo at example.com'
+        email = 'foo at example.com'
         response = self.client.post(reverse('mail-settings'), {'email': email})
         self.assertEqual(response.status_code, 200)
         self.assertTemplateUsed(response, 'patchwork/mail-settings.html')
@@ -44,7 +44,7 @@ class MailSettingsTest(TestCase):
         self.assertFormError(response, 'form', 'email', error_strings['email'])
 
     def test_post_optin(self):
-        email = u'foo at example.com'
+        email = 'foo at example.com'
         response = self.client.post(reverse('mail-settings'), {'email': email})
         self.assertEqual(response.status_code, 200)
         self.assertTemplateUsed(response, 'patchwork/mail-settings.html')
@@ -53,7 +53,7 @@ class MailSettingsTest(TestCase):
         self.assertContains(response, 'action="%s"' % reverse('mail-optout'))
 
     def test_post_optout(self):
-        email = u'foo at example.com'
+        email = 'foo at example.com'
         EmailOptout(email=email).save()
         response = self.client.post(reverse('mail-settings'), {'email': email})
         self.assertEqual(response.status_code, 200)
@@ -69,7 +69,7 @@ class OptoutRequestTest(TestCase):
         self.assertRedirects(response, reverse('mail-settings'))
 
     def test_post(self):
-        email = u'foo at example.com'
+        email = 'foo at example.com'
         response = self.client.post(reverse('mail-optout'), {'email': email})
 
         # check for a confirmation object
@@ -109,7 +109,7 @@ class OptoutRequestTest(TestCase):
 
 class OptoutTest(TestCase):
     def setUp(self):
-        self.email = u'foo at example.com'
+        self.email = 'foo at example.com'
         self.conf = EmailConfirmation(type='optout', email=self.email)
         self.conf.save()
 
@@ -139,7 +139,7 @@ class OptoutPreexistingTest(OptoutTest):
 
 
 class OptinRequestTest(TestCase):
-    email = u'foo at example.com'
+    email = 'foo at example.com'
 
     def setUp(self):
         EmailOptout(email=self.email).save()
@@ -190,7 +190,7 @@ class OptinRequestTest(TestCase):
 
 class OptinTest(TestCase):
     def setUp(self):
-        self.email = u'foo at example.com'
+        self.email = 'foo at example.com'
         self.optout = EmailOptout(email=self.email)
         self.optout.save()
         self.conf = EmailConfirmation(type='optin', email=self.email)
@@ -217,7 +217,7 @@ class OptinWithoutOptoutTest(TestCase):
     """Test an opt-in with no existing opt-out."""
 
     def test_opt_in_without_optout(self):
-        email = u'foo at example.com'
+        email = 'foo at example.com'
         response = self.client.post(reverse('mail-optin'), {'email': email})
 
         # check for an error message
diff --git patchwork/tests/views/test_patch.py patchwork/tests/views/test_patch.py
index 97b0e97e..9cea8a0b 100644
--- patchwork/tests/views/test_patch.py
+++ patchwork/tests/views/test_patch.py
@@ -530,6 +530,6 @@ class UTF8PatchViewTest(TestCase):
 
 class UTF8HeaderPatchViewTest(UTF8PatchViewTest):
     def setUp(self):
-        author = create_person(name=u'P\xe4tch Author')
+        author = create_person(name='P\xe4tch Author')
         patch_content = read_patch('0002-utf-8.patch', encoding='utf-8')
         self.patch = create_patch(submitter=author, diff=patch_content)
diff --git patchwork/tests/views/test_utils.py patchwork/tests/views/test_utils.py
index e10c3bde..6b980f9d 100644
--- patchwork/tests/views/test_utils.py
+++ patchwork/tests/views/test_utils.py
@@ -37,11 +37,11 @@ class MboxPatchResponseTest(TestCase):
         """Test that UTF-8 NBSP characters are correctly handled."""
         patch = create_patch(content='patch text\n')
         create_patch_comment(
-            patch=patch, content=u'comment\nAcked-by:\u00A0 foo'
+            patch=patch, content='comment\nAcked-by:\u00A0 foo'
         )
 
         mbox = utils.patch_to_mbox(patch)
-        self.assertIn(u'\u00A0 foo\n', mbox)
+        self.assertIn('\u00A0 foo\n', mbox)
 
     def test_multiple_tags(self):
         """Test that the mbox view appends tags correct.
@@ -145,7 +145,7 @@ class MboxPatchResponseTest(TestCase):
         the <user at domain.tld> format for the mail while the name part
         may be coded in some ways.
         """
-        person = create_person(name=u'©ool guŷ')
+        person = create_person(name='©ool guŷ')
         patch = create_patch(submitter=person)
         from_email = f'<{person.email}>'
         mbox = utils.patch_to_mbox(patch)
-- 
2.37.3



More information about the Patchwork mailing list