python: Modernize legacy Python 2 syntax with pyupgrade.

Generated by `pyupgrade --py3-plus --keep-percent-format` on all our
Python code except `zthumbor` and `zulip-ec2-configure-interfaces`,
followed by manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-04-09 12:51:58 -07:00
committed by Tim Abbott
parent fff2d3958a
commit c734bbd95d
567 changed files with 1877 additions and 2564 deletions

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from typing import Any
import mock
@@ -73,10 +71,10 @@ class TranslationTestCase(ZulipTestCase):
return response
def test_accept_language_header(self) -> None:
languages = [('en', u'Sign up'),
('de', u'Registrieren'),
('sr', u'Упишите се'),
('zh-hans', u'注册'),
languages = [('en', 'Sign up'),
('de', 'Registrieren'),
('sr', 'Упишите се'),
('zh-hans', '注册'),
]
for lang, word in languages:
@@ -85,10 +83,10 @@ class TranslationTestCase(ZulipTestCase):
self.assert_in_response(word, response)
def test_cookie(self) -> None:
languages = [('en', u'Sign up'),
('de', u'Registrieren'),
('sr', u'Упишите се'),
('zh-hans', u'注册'),
languages = [('en', 'Sign up'),
('de', 'Registrieren'),
('sr', 'Упишите се'),
('zh-hans', '注册'),
]
for lang, word in languages:
@@ -100,10 +98,10 @@ class TranslationTestCase(ZulipTestCase):
self.assert_in_response(word, response)
def test_i18n_urls(self) -> None:
languages = [('en', u'Sign up'),
('de', u'Registrieren'),
('sr', u'Упишите се'),
('zh-hans', u'注册'),
languages = [('en', 'Sign up'),
('de', 'Registrieren'),
('sr', 'Упишите се'),
('zh-hans', '注册'),
]
for lang, word in languages:
@@ -125,7 +123,7 @@ class JsonTranslationTestCase(ZulipTestCase):
result = self.client_post("/json/invites",
HTTP_ACCEPT_LANGUAGE='de')
expected_error = u"this arg is bad: 'invitee_emails' (translated to German)"
expected_error = "this arg is bad: 'invitee_emails' (translated to German)"
self.assert_json_error_contains(result,
expected_error,
status_code=400)