remove unicode prefix from code

All strings are considered as unicode string from Python 3.

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

Change-Id: I2985c088d25201edcb0f31fa4a1223a9c840e050
This commit is contained in:
niuke 2022-08-27 14:49:57 +08:00 committed by Ivan Anfimov
parent 65d801845c
commit 8b5b8c17a0
6 changed files with 44 additions and 44 deletions

View File

@ -170,7 +170,7 @@ to use the same cache like the example below.::
CACHES = { CACHES = {
'default': { 'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': [u'10.2.100.133:11211', u'10.2.100.134:11211''] 'LOCATION': ['10.2.100.133:11211', '10.2.100.134:11211'']
}, },
} }

View File

@ -54,9 +54,9 @@ openstackdocs_bug_tag = ''
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Trove Dashboard Release Notes' project = 'Trove Dashboard Release Notes'
copyright = u'2016, Trove developers' copyright = '2016, Trove developers'
author = u'Trove developers' author = 'Trove developers'
# Release notes are version independent. # Release notes are version independent.
# The short X.Y version. # The short X.Y version.
@ -126,7 +126,7 @@ html_theme = 'openstackdocs'
# The name for this set of Sphinx documents. # The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default. # "<project> v<release> documentation" by default.
#html_title = u'Trove Dashboard Release Notes vblah' #html_title = 'Trove Dashboard Release Notes vblah'
# A shorter title for the navigation bar. Default is the same as html_title. # A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None #html_short_title = None
@ -230,8 +230,8 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'TroveDashboardReleaseNotes.tex', u'Trove Dashboard Release Notes Documentation', (master_doc, 'TroveDashboardReleaseNotes.tex', 'Trove Dashboard Release Notes Documentation',
u'Trove developers', 'manual'), 'Trove developers', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -260,7 +260,7 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
(master_doc, 'trovedashboardreleasenotes', u'Trove Dashboard Release Notes Documentation', (master_doc, 'trovedashboardreleasenotes', 'Trove Dashboard Release Notes Documentation',
[author], 1) [author], 1)
] ]
@ -274,7 +274,7 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
(master_doc, 'TroveDashboardReleaseNotes', u'Trove Dashboard Release Notes Documentation', (master_doc, 'TroveDashboardReleaseNotes', 'Trove Dashboard Release Notes Documentation',
author, 'TroveDashboardReleaseNotes', 'One line description of project.', author, 'TroveDashboardReleaseNotes', 'One line description of project.',
'Miscellaneous'), 'Miscellaneous'),
] ]

View File

@ -208,13 +208,13 @@ class ClustersTests(test.TestCase):
self.mock_cluster_create.return_value = self.trove_clusters.first() self.mock_cluster_create.return_value = self.trove_clusters.first()
cluster_name = u'MyCluster' cluster_name = 'MyCluster'
cluster_volume = 1 cluster_volume = 1
cluster_flavor = u'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' cluster_flavor = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
cluster_instances = 3 cluster_instances = 3
cluster_datastore = u'mongodb' cluster_datastore = 'mongodb'
cluster_datastore_version = u'2.6' cluster_datastore_version = '2.6'
cluster_network = u'' cluster_network = ''
field_name = self._build_flavor_widget_name(cluster_datastore, field_name = self._build_flavor_widget_name(cluster_datastore,
cluster_datastore_version) cluster_datastore_version)
@ -268,13 +268,13 @@ class ClustersTests(test.TestCase):
self.mock_cluster_create.return_value = self.trove_clusters.first() self.mock_cluster_create.return_value = self.trove_clusters.first()
cluster_name = u'MyCluster' cluster_name = 'MyCluster'
cluster_volume = 1 cluster_volume = 1
cluster_flavor = u'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' cluster_flavor = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
cluster_instances = 3 cluster_instances = 3
cluster_datastore = u'mongodb' cluster_datastore = 'mongodb'
cluster_datastore_version = u'2.6' cluster_datastore_version = '2.6'
cluster_network = u'82288d84-e0a5-42ac-95be-e6af08727e42' cluster_network = '82288d84-e0a5-42ac-95be-e6af08727e42'
field_name = self._build_flavor_widget_name(cluster_datastore, field_name = self._build_flavor_widget_name(cluster_datastore,
cluster_datastore_version) cluster_datastore_version)
@ -329,13 +329,13 @@ class ClustersTests(test.TestCase):
self.mock_cluster_create.side_effect = self.exceptions.trove self.mock_cluster_create.side_effect = self.exceptions.trove
cluster_name = u'MyCluster' cluster_name = 'MyCluster'
cluster_volume = 1 cluster_volume = 1
cluster_flavor = u'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' cluster_flavor = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
cluster_instances = 3 cluster_instances = 3
cluster_datastore = u'mongodb' cluster_datastore = 'mongodb'
cluster_datastore_version = u'2.6' cluster_datastore_version = '2.6'
cluster_network = u'' cluster_network = ''
field_name = self._build_flavor_widget_name(cluster_datastore, field_name = self._build_flavor_widget_name(cluster_datastore,
cluster_datastore_version) cluster_datastore_version)

View File

@ -92,7 +92,7 @@ class DatabaseConfigurationsTests(test.TestCase):
@test.create_mocks({ @test.create_mocks({
api.trove: ('datastore_list', 'datastore_version_list', api.trove: ('datastore_list', 'datastore_version_list',
'configuration_create')}) 'configuration_create')})
def _test_create_test_configuration(self, config_description=u''): def _test_create_test_configuration(self, config_description=''):
self.mock_datastore_list.return_value = self.datastores.list() self.mock_datastore_list.return_value = self.datastores.list()
self.mock_datastore_version_list.return_value = ( self.mock_datastore_version_list.return_value = (
self.datastore_versions.list()) self.datastore_versions.list())
@ -100,7 +100,7 @@ class DatabaseConfigurationsTests(test.TestCase):
self.mock_configuration_create.return_value = ( self.mock_configuration_create.return_value = (
self.database_configurations.first()) self.database_configurations.first())
name = u'config1' name = 'config1'
values = "{}" values = "{}"
ds = self._get_test_datastore('mysql') ds = self._get_test_datastore('mysql')
dsv = self._get_test_datastore_version(ds.id, '5.5') dsv = self._get_test_datastore_version(ds.id, '5.5')
@ -129,7 +129,7 @@ class DatabaseConfigurationsTests(test.TestCase):
self.assertMessageCount(success=1) self.assertMessageCount(success=1)
def test_create_test_configuration(self): def test_create_test_configuration(self):
self._test_create_test_configuration(u'description of config1') self._test_create_test_configuration('description of config1')
def test_create_test_configuration_with_no_description(self): def test_create_test_configuration_with_no_description(self):
self._test_create_test_configuration() self._test_create_test_configuration()
@ -144,9 +144,9 @@ class DatabaseConfigurationsTests(test.TestCase):
self.mock_configuration_create.side_effect = self.exceptions.trove self.mock_configuration_create.side_effect = self.exceptions.trove
name = u'config1' name = 'config1'
values = "{}" values = "{}"
config_description = u'description of config1' config_description = 'description of config1'
ds = self._get_test_datastore('mysql') ds = self._get_test_datastore('mysql')
dsv = self._get_test_datastore_version(ds.id, '5.5') dsv = self._get_test_datastore_version(ds.id, '5.5')
config_datastore = ds.name config_datastore = ds.name

View File

@ -188,7 +188,7 @@ class CreateUserForm(forms.SelfHandlingForm):
def _get_databases(self, data): def _get_databases(self, data):
databases = [] databases = []
db_value = data['databases'] db_value = data['databases']
if db_value and db_value != u'': if db_value and db_value != '':
dbs = data['databases'] dbs = data['databases']
databases = [{'name': d.strip()} for d in dbs.split(',')] databases = [{'name': d.strip()} for d in dbs.split(',')]
return databases return databases

View File

@ -488,8 +488,8 @@ class DatabaseTests(test.TestCase):
res = self.client.post(url, post) res = self.client.post(url, post)
self.mock_database_create.assert_called_once_with( self.mock_database_create.assert_called_once_with(
test.IsHttpRequest(), u'id', u'NewDB', character_set=u'', test.IsHttpRequest(), 'id', 'NewDB', character_set='',
collation=u'') collation='')
self.assertNoFormErrors(res) self.assertNoFormErrors(res)
self.assertMessageCount(success=1) self.assertMessageCount(success=1)
@ -506,14 +506,14 @@ class DatabaseTests(test.TestCase):
res = self.client.post(url, post) res = self.client.post(url, post)
self.mock_database_create.assert_called_once_with( self.mock_database_create.assert_called_once_with(
test.IsHttpRequest(), u'id', u'NewDB', character_set=u'', test.IsHttpRequest(), 'id', 'NewDB', character_set='',
collation=u'') collation='')
self.assertEqual(res.status_code, 302) self.assertEqual(res.status_code, 302)
@test.create_mocks({api.trove: ('instance_get', 'root_show')}) @test.create_mocks({api.trove: ('instance_get', 'root_show')})
def test_show_root(self): def test_show_root(self):
database = self.databases.first() database = self.databases.first()
database.id = u'id' database.id = 'id'
user = self.database_user_roots.first() user = self.database_user_roots.first()
self.mock_instance_get.return_value = database self.mock_instance_get.return_value = database
@ -543,7 +543,7 @@ class DatabaseTests(test.TestCase):
self.mock_instance_get.assert_called_once_with( self.mock_instance_get.assert_called_once_with(
test.IsHttpRequest(), test.IsA(str)) test.IsHttpRequest(), test.IsA(str))
self.mock_root_show.assert_called_once_with( self.mock_root_show.assert_called_once_with(
test.IsHttpRequest(), u'id') test.IsHttpRequest(), 'id')
self.assertRedirectsNoFollow(res, DETAILS_URL) self.assertRedirectsNoFollow(res, DETAILS_URL)
@test.create_mocks({api.trove: ('root_enable',)}) @test.create_mocks({api.trove: ('root_enable',)})
@ -565,7 +565,7 @@ class DatabaseTests(test.TestCase):
table.maybe_handle() table.maybe_handle()
self.mock_root_enable.assert_called_once_with( self.mock_root_enable.assert_called_once_with(
test.IsHttpRequest(), [u'id']) test.IsHttpRequest(), ['id'])
self.assertEqual(table.data[0].enabled, True) self.assertEqual(table.data[0].enabled, True)
self.assertEqual(table.data[0].password, "password") self.assertEqual(table.data[0].password, "password")
@ -588,7 +588,7 @@ class DatabaseTests(test.TestCase):
table.maybe_handle() table.maybe_handle()
self.mock_root_enable.assert_called_once_with( self.mock_root_enable.assert_called_once_with(
test.IsHttpRequest(), [u'id']) test.IsHttpRequest(), ['id'])
self.assertNotEqual(table.data[0].enabled, True) self.assertNotEqual(table.data[0].enabled, True)
self.assertNotEqual(table.data[0].password, "password") self.assertNotEqual(table.data[0].password, "password")
@ -610,7 +610,7 @@ class DatabaseTests(test.TestCase):
table.maybe_handle() table.maybe_handle()
self.mock_root_disable.assert_called_once_with( self.mock_root_disable.assert_called_once_with(
test.IsHttpRequest(), u'id') test.IsHttpRequest(), 'id')
self.assertEqual(table.data[0].enabled, True) self.assertEqual(table.data[0].enabled, True)
self.assertIsNone(table.data[0].password) self.assertIsNone(table.data[0].password)
@ -634,7 +634,7 @@ class DatabaseTests(test.TestCase):
table.maybe_handle() table.maybe_handle()
self.mock_root_disable.assert_called_once_with( self.mock_root_disable.assert_called_once_with(
test.IsHttpRequest(), u'id') test.IsHttpRequest(), 'id')
self.assertEqual(table.data[0].enabled, True) self.assertEqual(table.data[0].enabled, True)
self.assertEqual(table.data[0].password, "password") self.assertEqual(table.data[0].password, "password")
@ -713,8 +713,8 @@ class DatabaseTests(test.TestCase):
res = self.client.post(url, post) res = self.client.post(url, post)
self.mock_user_create.assert_called_once_with( self.mock_user_create.assert_called_once_with(
test.IsHttpRequest(), database.id, user.name, u'password', test.IsHttpRequest(), database.id, user.name, 'password',
host=u'', databases=[]) host='', databases=[])
self.assertNoFormErrors(res) self.assertNoFormErrors(res)
self.assertMessageCount(success=1) self.assertMessageCount(success=1)
@ -732,8 +732,8 @@ class DatabaseTests(test.TestCase):
res = self.client.post(url, post) res = self.client.post(url, post)
self.mock_user_create.assert_called_once_with( self.mock_user_create.assert_called_once_with(
test.IsHttpRequest(), u'id', u'name', u'password', test.IsHttpRequest(), 'id', 'name', 'password',
host=u'', databases=[]) host='', databases=[])
self.assertEqual(res.status_code, 302) self.assertEqual(res.status_code, 302)
@test.create_mocks({api.trove: ('user_update_attributes',)}) @test.create_mocks({api.trove: ('user_update_attributes',)})