remove unicode prefix from code

Change-Id: I2bb0aa3a7d285bade0fdf115f4afa2e37e9f9c4b
This commit is contained in:
niuke 2022-08-24 16:43:16 +08:00
parent 733ed4289a
commit 0525d54cca
9 changed files with 56 additions and 56 deletions

View File

@ -38,8 +38,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Heat Dashboard' project = 'Heat Dashboard'
copyright = u'2017, OpenStack Developers' copyright = '2017, OpenStack Developers'
# openstackdocstheme options # openstackdocstheme options
openstackdocs_repo_name = 'openstack/heat-dashboard' openstackdocs_repo_name = 'openstack/heat-dashboard'
@ -75,8 +75,8 @@ htmlhelp_basename = '%sdoc' % project
latex_documents = [ latex_documents = [
('index', ('index',
'doc-heat-dashboard.tex', 'doc-heat-dashboard.tex',
u'Heat Dashboard Documentation', 'Heat Dashboard Documentation',
u'OpenStack Developers', 'manual', True), 'OpenStack Developers', 'manual', True),
] ]
latex_domain_indices = False latex_domain_indices = False
@ -91,10 +91,10 @@ latex_elements = {
} }
man_pages = [ man_pages = [
('index', u'Heat Dashboard Documentation', ('index', 'Heat Dashboard Documentation',
'Documentation for Heat Dashboard plugin to Openstack\ 'Documentation for Heat Dashboard plugin to Openstack\
Dashboard (Horizon)', Dashboard (Horizon)',
[u'OpenStack'], 1) ['OpenStack'], 1)
] ]
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.

View File

@ -131,16 +131,16 @@ def resource_to_url(resource):
@register.filter @register.filter
def stack_output(output): def stack_output(output):
if not output: if not output:
return u'' return ''
if isinstance(output, str): if isinstance(output, str):
parts = urlparse.urlsplit(output) parts = urlparse.urlsplit(output)
if parts.netloc and parts.scheme in ('http', 'https'): if parts.netloc and parts.scheme in ('http', 'https'):
url = html.escape(output) url = html.escape(output)
safe_link = u'<a href="%s" target="_blank">%s</a>' % (url, url) safe_link = '<a href="%s" target="_blank">%s</a>' % (url, url)
return safestring.mark_safe(safe_link) return safestring.mark_safe(safe_link)
if isinstance(output, dict) or isinstance(output, list): if isinstance(output, dict) or isinstance(output, list):
output = json.dumps(output, indent=2) output = json.dumps(output, indent=2)
return safestring.mark_safe(u'<pre>%s</pre>' % html.escape(output)) return safestring.mark_safe('<pre>%s</pre>' % html.escape(output))
static_url = getattr(settings, "STATIC_URL", "/static/") static_url = getattr(settings, "STATIC_URL", "/static/")

View File

@ -55,7 +55,7 @@ def data(TEST):
{'id': "21023e92-8008-1234-8059-7f2293ff3889", {'id': "21023e92-8008-1234-8059-7f2293ff3889",
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
'display_name': u'my_volume', 'display_name': 'my_volume',
'display_description': '', 'display_description': '',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'volume_type': None, 'volume_type': None,
@ -67,7 +67,7 @@ def data(TEST):
'name': 'my_volume2', 'name': 'my_volume2',
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
'display_name': u'my_volume2', 'display_name': 'my_volume2',
'display_description': '', 'display_description': '',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'volume_type': 'vol_type_2', 'volume_type': 'vol_type_2',
@ -78,7 +78,7 @@ def data(TEST):
{'id': "21023e92-8008-1234-8059-7f2293ff3890", {'id': "21023e92-8008-1234-8059-7f2293ff3890",
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
'display_name': u'my_volume', 'display_name': 'my_volume',
'display_description': '', 'display_description': '',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'volume_type': None, 'volume_type': None,
@ -97,19 +97,19 @@ def data(TEST):
TEST.cinder_volumes.add(api.cinder.Volume(non_bootable_volume)) TEST.cinder_volumes.add(api.cinder.Volume(non_bootable_volume))
vol_type1 = volume_types.VolumeType(volume_types.VolumeTypeManager(None), vol_type1 = volume_types.VolumeType(volume_types.VolumeTypeManager(None),
{'id': u'1', {'id': '1',
'name': u'vol_type_1', 'name': 'vol_type_1',
'description': 'type 1 description', 'description': 'type 1 description',
'extra_specs': {'foo': 'bar', 'extra_specs': {'foo': 'bar',
'volume_backend_name': 'volume_backend_name':
'backend_1'}}) 'backend_1'}})
vol_type2 = volume_types.VolumeType(volume_types.VolumeTypeManager(None), vol_type2 = volume_types.VolumeType(volume_types.VolumeTypeManager(None),
{'id': u'2', {'id': '2',
'name': u'vol_type_2', 'name': 'vol_type_2',
'description': 'type 2 description'}) 'description': 'type 2 description'})
vol_type3 = volume_types.VolumeType(volume_types.VolumeTypeManager(None), vol_type3 = volume_types.VolumeType(volume_types.VolumeTypeManager(None),
{'id': u'3', {'id': '3',
'name': u'vol_type_3', 'name': 'vol_type_3',
'is_public': False, 'is_public': False,
'description': 'type 3 description'}) 'description': 'type 3 description'})
TEST.cinder_volume_types.add(vol_type1, vol_type2, vol_type3) TEST.cinder_volume_types.add(vol_type1, vol_type2, vol_type3)

View File

@ -55,28 +55,28 @@ def data(TEST):
TEST.imagesV2 = utils.TestDataContainer() TEST.imagesV2 = utils.TestDataContainer()
# Snapshots # Snapshots
snapshot_dict = {'name': u'snapshot', snapshot_dict = {'name': 'snapshot',
'container_format': u'ami', 'container_format': 'ami',
'id': 3, 'id': 3,
'status': "active", 'status': "active",
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'properties': {'image_type': u'snapshot'}, 'properties': {'image_type': 'snapshot'},
'is_public': False, 'is_public': False,
'protected': False} 'protected': False}
snapshot_dict_no_owner = {'name': u'snapshot 2', snapshot_dict_no_owner = {'name': 'snapshot 2',
'container_format': u'ami', 'container_format': 'ami',
'id': 4, 'id': 4,
'status': "active", 'status': "active",
'owner': None, 'owner': None,
'properties': {'image_type': u'snapshot'}, 'properties': {'image_type': 'snapshot'},
'is_public': False, 'is_public': False,
'protected': False} 'protected': False}
snapshot_dict_queued = {'name': u'snapshot 2', snapshot_dict_queued = {'name': 'snapshot 2',
'container_format': u'ami', 'container_format': 'ami',
'id': 5, 'id': 5,
'status': "queued", 'status': "queued",
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'properties': {'image_type': u'snapshot'}, 'properties': {'image_type': 'snapshot'},
'is_public': False, 'is_public': False,
'protected': False} 'protected': False}
snapshot = images.Image(images.ImageManager(None), snapshot_dict) snapshot = images.Image(images.ImageManager(None), snapshot_dict)
@ -89,14 +89,14 @@ def data(TEST):
# Images # Images
image_dict = {'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', image_dict = {'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822',
'name': 'public_image', 'name': 'public_image',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'status': "active", 'status': "active",
'size': 20 * 1024 ** 3, 'size': 20 * 1024 ** 3,
'virtual_size': None, 'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': 'image'},
'is_public': True, 'is_public': True,
'protected': False, 'protected': False,
'min_ram': 0, 'min_ram': 0,
@ -125,7 +125,7 @@ def data(TEST):
'virtual_size': None, 'virtual_size': None,
'min_disk': 30, 'min_disk': 30,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': 'image'},
'is_public': True, 'is_public': True,
'protected': True, 'protected': True,
'min_ram': 0, 'min_ram': 0,
@ -140,7 +140,7 @@ def data(TEST):
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': 'image'},
'is_public': True, 'is_public': True,
'protected': False, 'protected': False,
'min_ram': 0} 'min_ram': 0}
@ -209,9 +209,9 @@ def data(TEST):
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'description': u'a multi prop image', 'properties': {'description': 'a multi prop image',
'foo': u'foo val', 'foo': 'foo val',
'bar': u'bar val'}, 'bar': 'bar val'},
'is_public': True, 'is_public': True,
'protected': False} 'protected': False}
multi_prop_image = images.Image(images.ImageManager(None), image_dict) multi_prop_image = images.Image(images.ImageManager(None), image_dict)
@ -250,7 +250,7 @@ def data(TEST):
'created_at': '2014-02-14T20:56:53', 'created_at': '2014-02-14T20:56:53',
'direct_url': 'swift+config://ref1/glance/' 'direct_url': 'swift+config://ref1/glance/'
'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5', 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'file': '/v2/images/' 'file': '/v2/images/'
'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5/file', 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5/file',
'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', 'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822',
@ -261,7 +261,7 @@ def data(TEST):
'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5'}], 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5'}],
'min_ram': 0, 'min_ram': 0,
'name': 'public_image', 'name': 'public_image',
'image_type': u'image', 'image_type': 'image',
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'protected': False, 'protected': False,
@ -277,7 +277,7 @@ def data(TEST):
'container_format': 'novaImage', 'container_format': 'novaImage',
'created_at': '2014-03-16T06:22:14', 'created_at': '2014-03-16T06:22:14',
'disk_format': None, 'disk_format': None,
'image_type': u'image', 'image_type': 'image',
'file': '/v2/images/885d1cb0-9f5c-4677-9d03-175be7f9f984/file', 'file': '/v2/images/885d1cb0-9f5c-4677-9d03-175be7f9f984/file',
'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c', 'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c',
'locations': [], 'locations': [],
@ -311,9 +311,9 @@ def data(TEST):
'updated_at': '2015-09-02T00:31:17Z', 'updated_at': '2015-09-02T00:31:17Z',
'virtual_size': None, 'virtual_size': None,
'visibility': 'public', 'visibility': 'public',
'description': u'a multi prop image', 'description': 'a multi prop image',
'foo': u'foo val', 'foo': 'foo val',
'bar': u'bar val' 'bar': 'bar val'
}] }]
for fixture in image_v2_dicts: for fixture in image_v2_dicts:
apiresource = APIResourceV2(fixture) apiresource = APIResourceV2(fixture)

View File

@ -415,7 +415,7 @@ def data(TEST):
'AWS::StackName': "teststack{0}".format(i), 'AWS::StackName': "teststack{0}".format(i),
'DBPassword': '******', 'DBPassword': '******',
'AWS::Region': 'ap-southeast-1', 'AWS::Region': 'ap-southeast-1',
'DBName': u'wordpress' 'DBName': 'wordpress'
}, },
"stack_status_reason": "Stack successfully created", "stack_status_reason": "Stack successfully created",
"stack_name": "stack-test{0}".format(i), "stack_name": "stack-test{0}".format(i),

View File

@ -223,7 +223,7 @@ def data(TEST):
'domain_id': '2', 'domain_id': '2',
'domain_name': 'disabled_domain'} 'domain_name': 'disabled_domain'}
tenant_dict_3 = {'id': "3", tenant_dict_3 = {'id': "3",
'name': u'\u4e91\u89c4\u5219', 'name': '\u4e91\u89c4\u5219',
'description': "an unicode-named tenant.", 'description': "an unicode-named tenant.",
'enabled': True, 'enabled': True,
'domain_id': '2', 'domain_id': '2',

View File

@ -271,7 +271,7 @@ class HeatApiTests(test.APITestCase):
user_data: user_data:
get_file: http://test.example/example get_file: http://test.example/example
''' '''
expected_files = {u'http://test.example/example': b'echo "test"'} expected_files = {'http://test.example/example': b'echo "test"'}
url = 'http://test.example/example' url = 'http://test.example/example'
data = b'echo "test"' data = b'echo "test"'
mock_read_url_content.return_value = data mock_read_url_content.return_value = data

View File

@ -87,22 +87,22 @@ class MappingsTests(test.TestCase):
'aaa') 'aaa')
def test_stack_output(self): def test_stack_output(self):
self.assertEqual(u'<pre>foo</pre>', mappings.stack_output('foo')) self.assertEqual('<pre>foo</pre>', mappings.stack_output('foo'))
self.assertEqual(u'', mappings.stack_output(None)) self.assertEqual('', mappings.stack_output(None))
outputs = ['one', 'two', 'three'] outputs = ['one', 'two', 'three']
expected_text = """[\n "one",\n "two",\n "three"\n]""" expected_text = """[\n "one",\n "two",\n "three"\n]"""
self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text), self.assertEqual('<pre>%s</pre>' % html.escape(expected_text),
mappings.stack_output(outputs)) mappings.stack_output(outputs))
outputs = {'foo': 'bar'} outputs = {'foo': 'bar'}
expected_text = """{\n "foo": "bar"\n}""" expected_text = """{\n "foo": "bar"\n}"""
self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text), self.assertEqual('<pre>%s</pre>' % html.escape(expected_text),
mappings.stack_output(outputs)) mappings.stack_output(outputs))
self.assertEqual( self.assertEqual(
u'<a href="http://www.example.com/foo" target="_blank">' '<a href="http://www.example.com/foo" target="_blank">'
'http://www.example.com/foo</a>', 'http://www.example.com/foo</a>',
mappings.stack_output('http://www.example.com/foo')) mappings.stack_output('http://www.example.com/foo'))

View File

@ -52,8 +52,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Heat Dashboard Release Notes' project = 'Heat Dashboard Release Notes'
copyright = u'2017, OpenStack Foundation' copyright = '2017, OpenStack Foundation'
# openstackdocstheme options # openstackdocstheme options
openstackdocs_repo_name = 'openstack/heat-dashboard' openstackdocs_repo_name = 'openstack/heat-dashboard'
@ -206,8 +206,8 @@ latex_elements = {
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
('index', 'HeatDashboardReleaseNotes.tex', ('index', 'HeatDashboardReleaseNotes.tex',
u'Heat Dashboard Release Notes Documentation', 'Heat Dashboard Release Notes Documentation',
u'OpenStack Foundation', 'manual'), 'OpenStack Foundation', '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
@ -237,8 +237,8 @@ latex_documents = [
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'HeatDashboardReleaseNotes', ('index', 'HeatDashboardReleaseNotes',
u'Heat Dashboard Release Notes Documentation', 'Heat Dashboard Release Notes Documentation',
[u'OpenStack Foundation'], 1) ['OpenStack Foundation'], 1)
] ]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
@ -252,8 +252,8 @@ man_pages = [
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'HeatDashboardReleaseNotes', ('index', 'HeatDashboardReleaseNotes',
u'Heat Dashboard Release Notes Documentation', 'Heat Dashboard Release Notes Documentation',
u'OpenStack Foundation', 'HeatDashboardReleaseNotes', 'OpenStack Foundation', 'HeatDashboardReleaseNotes',
'Dashboard for Heat', 'Dashboard for Heat',
'Miscellaneous'), 'Miscellaneous'),
] ]