remove unicode from code

Implements: blueprint remove-unicode
Change-Id: Ib7eb517f404fe87b880f7091366721d2cfc5cdf8
This commit is contained in:
likui 2021-01-03 16:42:29 +08:00
parent bcb8992f99
commit 5d641033d4
9 changed files with 53 additions and 53 deletions

View File

@ -64,8 +64,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Database API Reference'
copyright = u'2010-present, OpenStack Foundation'
project = 'Database API Reference'
copyright = '2010-present, OpenStack Foundation'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -99,7 +99,7 @@ pygments_style = 'native'
# -- Options for man page output ----------------------------------------------
# Grouping the document tree for man pages.
# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual'
# List of tuples 'sourcefile', 'target', 'title', 'Authors name', 'manual'
# -- Options for HTML output --------------------------------------------------
@ -185,8 +185,8 @@ htmlhelp_basename = 'trovedoc'
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'Trove.tex', u'OpenStack Database API Documentation',
u'OpenStack Foundation', 'manual'),
('index', 'Trove.tex', 'OpenStack Database API Documentation',
'OpenStack Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of

View File

@ -38,8 +38,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Trove'
copyright = u'2013, OpenStack Foundation'
project = 'Trove'
copyright = '2013, OpenStack Foundation'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -164,8 +164,8 @@ latex_documents = [
(
'index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation',
'%s Documentation' % project,
'OpenStack Foundation',
'manual'
),
]
@ -199,8 +199,8 @@ latex_documents = [
# (
# 'index',
# '%s' % project,
# u'%s Documentation' % project,
# u'OpenStack Foundation',
# '%s Documentation' % project,
# 'OpenStack Foundation',
# 1
# ),
# ]
@ -218,8 +218,8 @@ texinfo_documents = [
(
'index',
'%s' % project,
u'%s Documentation' % project,
u'OpenStack Foundation',
'%s Documentation' % project,
'OpenStack Foundation',
'%s' % project,
'Database as a service.',
'Miscellaneous'
@ -243,10 +243,10 @@ texinfo_documents = [
# -- Options for Epub output --------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'%s' % project
epub_author = u'OpenStack Foundation'
epub_publisher = u'OpenStack Foundation'
epub_copyright = u'2013, OpenStack Foundation'
epub_title = '%s' % project
epub_author = 'OpenStack Foundation'
epub_publisher = 'OpenStack Foundation'
epub_copyright = '2013, OpenStack Foundation'
# The language of the text. It defaults to the language option
# or en if the language is not set.

View File

@ -62,8 +62,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Trove Release Notes'
copyright = u'2015, Trove Developers'
project = 'Trove Release Notes'
copyright = '2015, Trove Developers'
# Release notes are version independent.
# The short X.Y version.
@ -214,8 +214,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'TroveReleaseNotes.tex', u'Trove Release Notes Documentation',
u'Trove Developers', 'manual'),
('index', 'TroveReleaseNotes.tex', 'Trove Release Notes Documentation',
'Trove Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -244,8 +244,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'trovereleasenotes', u'Trove Release Notes Documentation',
[u'Trove Developers'], 1)
('index', 'trovereleasenotes', 'Trove Release Notes Documentation',
['Trove Developers'], 1)
]
# If true, show URL addresses after external links.
@ -258,8 +258,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'TroveReleaseNotes', u'Trove Release Notes Documentation',
u'Trove Developers', 'TroveReleaseNotes',
('index', 'TroveReleaseNotes', 'Trove Release Notes Documentation',
'Trove Developers', 'TroveReleaseNotes',
'One line description of project.',
'Miscellaneous'),
]

View File

@ -224,8 +224,8 @@ class MongoDbCluster(models.Cluster):
required=True))
volume_size = int(_check_option('volume', required=True)['size'])
instance_type = _check_option('type', required=True,
valid_values=[u'replica',
u'query_router'])
valid_values=['replica',
'query_router'])
name = _check_option('name')
related_to = _check_option('related_to')
nics = _check_option('nics')

View File

@ -55,14 +55,14 @@ class FakeSwiftConnection(object):
def get_auth(self):
return (
u"http://127.0.0.1:8080/v1/AUTH_c7b038976df24d96bf1980f5da17bd89",
u'MIINrwYJKoZIhvcNAQcCoIINoDCCDZwCAQExCTAHBgUrDgMCGjCCDIgGCSqGSIb3'
u'DQEHAaCCDHkEggx1eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAi'
u'MjAxMy0wMy0xOFQxODoxMzoyMC41OTMyNzYiLCAiZXhwaXJlcyI6ICIyMDEzLTAz'
u'LTE5VDE4OjEzOjIwWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7'
u'ImVuYWJsZWQiOiB0cnVlLCAiZGVzY3JpcHRpb24iOiBudWxsLCAibmFtZSI6ICJy'
u'ZWRkd2FyZiIsICJpZCI6ICJjN2IwMzg5NzZkZjI0ZDk2YmYxOTgwZjVkYTE3YmQ4'
u'OSJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5')
"http://127.0.0.1:8080/v1/AUTH_c7b038976df24d96bf1980f5da17bd89",
'MIINrwYJKoZIhvcNAQcCoIINoDCCDZwCAQExCTAHBgUrDgMCGjCCDIgGCSqGSIb3'
'DQEHAaCCDHkEggx1eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAi'
'MjAxMy0wMy0xOFQxODoxMzoyMC41OTMyNzYiLCAiZXhwaXJlcyI6ICIyMDEzLTAz'
'LTE5VDE4OjEzOjIwWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7'
'ImVuYWJsZWQiOiB0cnVlLCAiZGVzY3JpcHRpb24iOiBudWxsLCAibmFtZSI6ICJy'
'ZWRkd2FyZiIsICJpZCI6ICJjN2IwMzg5NzZkZjI0ZDk2YmYxOTgwZjVkYTE3YmQ4'
'OSJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5')
def get_account(self):
return ({'content-length': '2', 'accept-ranges': 'bytes',
@ -337,14 +337,14 @@ class SwiftClientStub(Patcher):
'x-account-object-count': '0'}, self._containers_list)
get_auth_return_value = (
u"http://127.0.0.1:8080/v1/AUTH_c7b038976df24d96bf1980f5da17bd89",
u'MIINrwYJKoZIhvcNAQcCoIINoDCCDZwCAQExCTAHBgUrDgMCGjCCDIgGCSqGSIb3'
u'DQEHAaCCDHkEggx1eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAi'
u'MjAxMy0wMy0xOFQxODoxMzoyMC41OTMyNzYiLCAiZXhwaXJlcyI6ICIyMDEzLTAz'
u'LTE5VDE4OjEzOjIwWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7'
u'ImVuYWJsZWQiOiB0cnVlLCAiZGVzY3JpcHRpb24iOiBudWxsLCAibmFtZSI6ICJy'
u'ZWRkd2FyZiIsICJpZCI6ICJjN2IwMzg5NzZkZjI0ZDk2YmYxOTgwZjVkYTE3YmQ4'
u'OSJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5')
"http://127.0.0.1:8080/v1/AUTH_c7b038976df24d96bf1980f5da17bd89",
'MIINrwYJKoZIhvcNAQcCoIINoDCCDZwCAQExCTAHBgUrDgMCGjCCDIgGCSqGSIb3'
'DQEHAaCCDHkEggx1eyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAi'
'MjAxMy0wMy0xOFQxODoxMzoyMC41OTMyNzYiLCAiZXhwaXJlcyI6ICIyMDEzLTAz'
'LTE5VDE4OjEzOjIwWiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7'
'ImVuYWJsZWQiOiB0cnVlLCAiZGVzY3JpcHRpb24iOiBudWxsLCAibmFtZSI6ICJy'
'ZWRkd2FyZiIsICJpZCI6ICJjN2IwMzg5NzZkZjI0ZDk2YmYxOTgwZjVkYTE3YmQ4'
'OSJ9fSwgInNlcnZpY2VDYXRhbG9nIjogW3siZW5kcG9pbnRzIjogW3siYWRtaW5')
get_auth_patcher = patch.object(
swift_client.Connection, 'get_auth',

View File

@ -547,7 +547,7 @@ class OrderingTests(trove_testtools.TestCase):
backups, marker = models.Backup.list(self.context)
self.assertIsNone(marker)
actual = [b.name for b in backups]
expected = [u'one', u'two', u'three', u'four']
expected = ['one', 'two', 'three', 'four']
self.assertEqual(expected, actual)
def test_list_for_instance(self):
@ -555,7 +555,7 @@ class OrderingTests(trove_testtools.TestCase):
self.instance_id)
self.assertIsNone(marker)
actual = [b.name for b in backups]
expected = [u'one', u'two', u'three', u'four']
expected = ['one', 'two', 'three', 'four']
self.assertEqual(expected, actual)

View File

@ -26,7 +26,7 @@ class TestAuth(trove_testtools.TestCase):
req = webob.Request.blank(url)
# test string with chinese characters
test_str = u'\u6d4b\u8bd5'
test_str = '\u6d4b\u8bd5'
req.headers = {
'X-Tenant-ID': tenant_id,
'X-Auth-Project-Id': test_str

View File

@ -33,7 +33,7 @@ class TestEncryptUtils(trove_testtools.TestCase):
def test_encode_decode_string(self):
random_data = bytearray(os.urandom(12))
data = [b'abc', b'numbers01234', b'\x00\xFF\x00\xFF\xFF\x00',
random_data, u'Unicode:\u20ac']
random_data, 'Unicode:\u20ac']
for datum in data:
encoded_data = crypto_utils.encode_data(datum)
@ -81,7 +81,7 @@ class TestEncryptUtils(trove_testtools.TestCase):
'P/RRPT'),
# Unicoded string (encoded to UTF-8)
(u'Unicode:\u20ac',
('Unicode:\u20ac',
'eHh4eHh4eHh4eHh4eHh4eAMsI5YsrtMNAPJfVF0j9NegXML7OsJ0LuAy66'
'LKv5F4'),
):
@ -99,7 +99,7 @@ class TestEncryptUtils(trove_testtools.TestCase):
'KNN0NH',
b'Hello World!'),
# Unicoded string: u'Unicode:\u20ac'
# Unicoded string: 'Unicode:\u20ac'
('ZUhoNGVIaDRlSGg0ZUhoNIHZLIuIcQCRwWY7PR2y7JcqoDf4ViqXIfh0uE'
'Rbg9BA',
b'Unicode:\xe2\x82\xac'),

View File

@ -177,12 +177,12 @@ class TestUtils(trove_testtools.TestCase):
def test_req_to_text(self):
req = webob.Request.blank('/')
expected = u'GET / HTTP/1.0\r\nHost: localhost:80'
expected = 'GET / HTTP/1.0\r\nHost: localhost:80'
self.assertEqual(expected, utils.req_to_text(req))
# add a header containing unicode characters
req.headers.update({
'X-Auth-Project-Id': u'\u6d4b\u8bd5'})
expected = (u'GET / HTTP/1.0\r\nHost: localhost:80\r\n'
u'X-Auth-Project-Id: \u6d4b\u8bd5')
'X-Auth-Project-Id': '\u6d4b\u8bd5'})
expected = ('GET / HTTP/1.0\r\nHost: localhost:80\r\n'
'X-Auth-Project-Id: \u6d4b\u8bd5')
self.assertEqual(expected, utils.req_to_text(req))