From 342d3888037ebd14b6d4fbfdd6c6b658c8da68b0 Mon Sep 17 00:00:00 2001 From: songwenping Date: Tue, 19 Apr 2022 19:30:47 +0800 Subject: [PATCH] Remove unnecessary unicode prefixes Change-Id: Ia75cc0c9fd5117b22b54fe872b28a4164faedf9a --- doc/source/conf.py | 4 ++-- oslo_i18n/_message.py | 4 ++-- oslo_i18n/tests/test_fixture.py | 2 +- oslo_i18n/tests/test_message.py | 2 +- oslo_i18n/tests/test_public_api.py | 2 +- releasenotes/source/conf.py | 16 ++++++++-------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 4c6b394..e06ebfa 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -33,8 +33,8 @@ openstackdocs_bug_tag = '' master_doc = 'index' # General information about the project. -project = u'oslo.i18n' -copyright = u'2014, OpenStack Foundation' +project = 'oslo.i18n' +copyright = '2014, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True diff --git a/oslo_i18n/_message.py b/oslo_i18n/_message.py index a73992e..5ad08e4 100644 --- a/oslo_i18n/_message.py +++ b/oslo_i18n/_message.py @@ -168,8 +168,8 @@ class Message(str): # Do not translate this log message even if it is used as a # warning message as a wrong translation of this message could # cause infinite recursion - msg = (u'Failed to insert replacement values into translated ' - u'message %s (Original: %r): %s') + msg = ('Failed to insert replacement values into translated ' + 'message %s (Original: %r): %s') warnings.warn(msg % (translated_message, self.msgid, err)) LOG.debug(msg, translated_message, self.msgid, err) diff --git a/oslo_i18n/tests/test_fixture.py b/oslo_i18n/tests/test_fixture.py index 5b4eaa5..a1dc3b8 100644 --- a/oslo_i18n/tests/test_fixture.py +++ b/oslo_i18n/tests/test_fixture.py @@ -38,7 +38,7 @@ class TranslationFixtureTest(test_base.BaseTestCase): msg = self.trans_fixture.immediate('this is a lazy message') self.assertNotIsInstance(msg, _message.Message) self.assertIsInstance(msg, str) - self.assertEqual(u'this is a lazy message', msg) + self.assertEqual('this is a lazy message', msg) class ToggleLazyFixtureText(test_base.BaseTestCase): diff --git a/oslo_i18n/tests/test_message.py b/oslo_i18n/tests/test_message.py index 85dbd67..2436a25 100644 --- a/oslo_i18n/tests/test_message.py +++ b/oslo_i18n/tests/test_message.py @@ -166,7 +166,7 @@ class MessageTestCase(test_base.BaseTestCase): result = _message.Message(msgid) % params # Now set up ugettext to return the translated version of # the original message, with a bad format string. - wrong_type = u'Wrong type %(arg1)d' + wrong_type = 'Wrong type %(arg1)d' trans.return_value.gettext.return_value = wrong_type trans_result = result.translation() expected = msgid % params diff --git a/oslo_i18n/tests/test_public_api.py b/oslo_i18n/tests/test_public_api.py index bf7a89a..6fbc84d 100644 --- a/oslo_i18n/tests/test_public_api.py +++ b/oslo_i18n/tests/test_public_api.py @@ -37,4 +37,4 @@ class PublicAPITest(unittest.TestCase): oslo_i18n.enable_lazy(original) def test_translate(self): - oslo_i18n.translate(u'string') + oslo_i18n.translate('string') diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index d5c4cb8..9b6d083 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -58,8 +58,8 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'oslo.i18n Release Notes' -copyright = u'2016, oslo.i18n Developers' +project = 'oslo.i18n Release Notes' +copyright = '2016, oslo.i18n Developers' # Release notes do not need a version in the title, they span # multiple versions. @@ -210,8 +210,8 @@ latex_elements = { # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'oslo.i18nReleaseNotes.tex', - u'oslo.i18n Release Notes Documentation', - u'oslo.i18n Developers', 'manual'), + 'oslo.i18n Release Notes Documentation', + 'oslo.i18n Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -241,8 +241,8 @@ latex_documents = [ # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'oslo.i18nReleaseNotes', - u'oslo.i18n Release Notes Documentation', - [u'oslo.i18n Developers'], 1) + 'oslo.i18n Release Notes Documentation', + ['oslo.i18n Developers'], 1) ] # If true, show URL addresses after external links. @@ -256,8 +256,8 @@ man_pages = [ # dir menu entry, description, category) texinfo_documents = [ ('index', 'oslo.i18nReleaseNotes', - u'oslo.i18n Release Notes Documentation', - u'oslo.i18n Developers', 'oslo.i18nReleaseNotes', + 'oslo.i18n Release Notes Documentation', + 'oslo.i18n Developers', 'oslo.i18nReleaseNotes', 'One line description of project.', 'Miscellaneous'), ]