Dropping explicit unicode literal

In python 3, all strings are considered as unicode string.

This patch drops the explicit unicode literal (u'...')
or (u"..") appearances from the unicode strings.

Note: The scope of the patch is to drop unicode literal prefix
from python source code files, documentation and comment are overlook.

Co-Authored-By: Manpreet Kaur kaurmanpreet2620@gmail.com
Change-Id: I5316037871109838a03ff4561b7b38dcc56bc447
This commit is contained in:
zhangboye
2021-01-03 16:38:00 +08:00
committed by Manpreet Kaur
parent 76da3dbd9d
commit 68df82918a
7 changed files with 21 additions and 21 deletions

View File

@@ -71,8 +71,8 @@ htmlhelp_basename = 'tackerclientdoc'
# -- Options for manual page output -------------------------------------------
man_pages = [
('cli/index', 'tacker', u'Client for Tacker API',
[u'OpenStack Contributors'], 1),
('cli/index', 'tacker', 'Client for Tacker API',
['OpenStack Contributors'], 1),
]
# -- Options for openstackdocstheme -------------------------------------------

View File

@@ -53,8 +53,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Tacker Client Release Notes'
copyright = u'2016, Tacker Developers'
project = 'Tacker Client Release Notes'
copyright = '2016, Tacker Developers'
# Release notes are version independent.
release = ''
@@ -190,8 +190,8 @@ latex_elements = {
# [howto/manual]).
latex_documents = [
('index', 'TackerClientReleaseNotes.tex',
u'Tacker Client Release Notes Documentation',
u'Tacker Developers', 'manual'),
'Tacker Client Release Notes Documentation',
'Tacker Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -221,8 +221,8 @@ latex_documents = [
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'tackerreleasenotes',
u'Tacker Client Release Notes Documentation',
[u'Tacker Developers'], 1)
'Tacker Client Release Notes Documentation',
['Tacker Developers'], 1)
]
# If true, show URL addresses after external links.
@@ -236,8 +236,8 @@ man_pages = [
# dir menu entry, description, category)
texinfo_documents = [
('index', 'TackerClientReleaseNotes',
u'Tacker Client Release Notes Documentation',
u'Tacker Developers', 'TackerClientReleaseNotes',
'Tacker Client Release Notes Documentation',
'Tacker Developers', 'TackerClientReleaseNotes',
'Tacker Client Project.',
'Miscellaneous'),
]

View File

@@ -217,7 +217,7 @@ class ShowTemplateNSD(command.ShowOne):
obj[_NSD]['attributes']['nsd'])
data = utils.get_item_properties(
sdk_utils.DictModel(obj[_NSD]),
(u'attributes',),
('attributes',),
formatters=_formatters)
data = (data or _('Unable to display NSD template!'))
return ((u'attributes',), data)
return (('attributes',), data)

View File

@@ -211,7 +211,7 @@ class ShowTemplateVNFFGD(command.ShowOne):
obj = client.show_vnffgd(obj_id)
data = utils.get_item_properties(
sdk_utils.DictModel(obj[_VNFFGD]),
(u'template',),
('template',),
formatters=_formatters)
data = (data or _('Unable to display VNFFGD template!'))
return ((u'template',), data)
return (('template',), data)

View File

@@ -218,7 +218,7 @@ class ShowTemplateVNFD(command.ShowOne):
obj[_VNFD]['attributes']['vnfd'])
data = utils.get_item_properties(
sdk_utils.DictModel(obj[_VNFD]),
(u'attributes',),
('attributes',),
formatters=_formatters)
data = (data or _('Unable to display VNFD template!'))
return ((u'attributes',), data)
return (('attributes',), data)

View File

@@ -653,8 +653,8 @@ class CLITestV10Base(testtools.TestCase):
class ClientV1TestJson(CLITestV10Base):
def test_do_request_unicode(self):
self.client.format = self.format
unicode_text = u'\u7f51\u7edc'
action = u'/test'
unicode_text = '\u7f51\u7edc'
action = '/test'
params = {'test': unicode_text}
body = params
expect_body = self.client.serialize(body)
@@ -663,7 +663,7 @@ class ClientV1TestJson(CLITestV10Base):
mock_req.return_value = (MyResp(200), expect_body)
res_body = self.client.do_request('PUT', action, body=body,
params=params)
expected_uri = u'localurl/v1.0/test.json?test=%E7%BD%91%E7%BB%9C'
expected_uri = 'localurl/v1.0/test.json?test=%E7%BD%91%E7%BB%9C'
mock_req.assert_called_with(
expected_uri, 'PUT', body=expect_body,
headers={'X-Auth-Token': unicode_text,

View File

@@ -154,10 +154,10 @@ class ShellTest(testtools.TestCase):
@mock.patch.object(openstack_shell.TackerShell, 'run')
def test_main_with_unicode(self, mock_run):
mock_run.return_value = 0
unicode_text = u'\u7f51\u7edc'
unicode_text = '\u7f51\u7edc'
argv = ['net-list', unicode_text, unicode_text.encode('utf-8')]
ret = openstack_shell.main(argv=argv)
mock_run.assert_called_once_with([u'net-list', unicode_text,
mock_run.assert_called_once_with(['net-list', unicode_text,
unicode_text])
self.assertEqual(0, ret)