From c7845314f5602c5d7e074944fa7a391bf2de2fdd Mon Sep 17 00:00:00 2001 From: songwenping Date: Mon, 4 Jan 2021 02:57:38 +0000 Subject: [PATCH] Remove unicode from code 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. Change-Id: I64af1c7c7415cd4ab99b6a913fb84fecbc0a3bf1 --- doc/source/conf.py | 6 +- releasenotes/source/conf.py | 14 ++--- tempest/api/compute/servers/test_servers.py | 2 +- tempest/tests/cmd/test_cleanup_services.py | 58 +++++++++---------- .../compute/test_aggregates_client.py | 6 +- .../compute/test_availability_zone_client.py | 2 +- .../compute/test_extensions_client.py | 2 +- .../compute/test_floating_ip_pools_client.py | 4 +- .../services/compute/test_keypairs_client.py | 2 +- .../services/compute/test_networks_client.py | 2 +- .../compute/test_quota_classes_client.py | 2 +- .../compute/test_tenant_networks_client.py | 2 +- 12 files changed, 51 insertions(+), 51 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 59a2f64a46..b738fde7f7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -86,7 +86,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -copyright = u'2013, OpenStack QA Team' +copyright = '2013, OpenStack QA Team' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -206,8 +206,8 @@ suppress_warnings = ['image.nonlocal_uri'] # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ - ('index', 'doc-tempest.tex', u'Tempest Testing Project', - u'OpenStack Foundation', 'manual'), + ('index', 'doc-tempest.tex', 'Tempest Testing Project', + 'OpenStack Foundation', 'manual'), ] latex_use_xindy = False diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 9a9de43a5f..b353a18623 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -59,7 +59,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -copyright = u'2016, tempest Developers' +copyright = '2016, tempest Developers' # Release do not need a version number in the title, they # cover multiple versions. @@ -194,8 +194,8 @@ htmlhelp_basename = 'tempestReleaseNotesdoc' # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'olso.configReleaseNotes.tex', - u'olso.config Release Notes Documentation', - u'tempest Developers', 'manual'), + 'olso.config Release Notes Documentation', + 'tempest Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -225,8 +225,8 @@ latex_documents = [ # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'olso.configreleasenotes', - u'tempest Release Notes Documentation', - [u'tempest Developers'], 1) + 'tempest Release Notes Documentation', + ['tempest Developers'], 1) ] # If true, show URL addresses after external links. @@ -240,8 +240,8 @@ man_pages = [ # dir menu entry, description, category) texinfo_documents = [ ('index', 'tempestReleaseNotes', - u'tempest Release Notes Documentation', - u'tempest Developers', 'olso.configReleaseNotes', + 'tempest Release Notes Documentation', + 'tempest Developers', 'olso.configReleaseNotes', 'An OpenStack library for parsing configuration options from the command' ' line and configuration files.', 'Miscellaneous'), diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py index cc013e3b00..1c839eb1f0 100644 --- a/tempest/api/compute/servers/test_servers.py +++ b/tempest/api/compute/servers/test_servers.py @@ -103,7 +103,7 @@ class ServersTestJSON(base.BaseV2ComputeTest): server = self.create_test_server(wait_until='ACTIVE') self.addCleanup(self.delete_server, server['id']) # Update instance name with non-ASCII characters - prefix_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9' + prefix_name = '\u00CD\u00F1st\u00E1\u00F1c\u00E9' self._update_server_name(server['id'], 'ACTIVE', prefix_name) # stop server and check server name update again diff --git a/tempest/tests/cmd/test_cleanup_services.py b/tempest/tests/cmd/test_cleanup_services.py index fc44793209..2301be6ed8 100644 --- a/tempest/tests/cmd/test_cleanup_services.py +++ b/tempest/tests/cmd/test_cleanup_services.py @@ -143,40 +143,40 @@ class BaseCmdServiceTests(MockFunctionsBase): saved_state = { # Static list to ensure global service saved items are not deleted - "users": {u'32rwef64245tgr20121qw324bgg': u'Lightning'}, - "flavors": {u'42': u'm1.tiny'}, - "images": {u'34yhwr-4t3q': u'stratus-0.3.2-x86_64-disk'}, - "roles": {u'3efrt74r45hn': u'president'}, - "projects": {u'f38ohgp93jj032': u'manhattan'}, - "domains": {u'default': u'Default'}, + "users": {'32rwef64245tgr20121qw324bgg': 'Lightning'}, + "flavors": {'42': 'm1.tiny'}, + "images": {'34yhwr-4t3q': 'stratus-0.3.2-x86_64-disk'}, + "roles": {'3efrt74r45hn': 'president'}, + "projects": {'f38ohgp93jj032': 'manhattan'}, + "domains": {'default': 'Default'}, # Static list to ensure project service saved items are not deleted - "snapshots": {u'1ad4c789-7e8w-4dwg-afc5': u'saved-snapshot'}, - "servers": {u'7a6d4v7w-36ds-4216': u'saved-server'}, - "server_groups": {u'as6d5f7g-46ca-475e': u'saved-server-group'}, - "keypairs": {u'saved-key-pair': { - u'fingerprint': u'7e:eb:ab:24', - u'name': u'saved-key-pair' + "snapshots": {'1ad4c789-7e8w-4dwg-afc5': 'saved-snapshot'}, + "servers": {'7a6d4v7w-36ds-4216': 'saved-server'}, + "server_groups": {'as6d5f7g-46ca-475e': 'saved-server-group'}, + "keypairs": {'saved-key-pair': { + 'fingerprint': '7e:eb:ab:24', + 'name': 'saved-key-pair' }}, - "volumes": {u'aa77asdf-1234': u'saved-volume'}, - "networks": {u'6722fc13-4319': { - u'id': u'6722fc13-4319', - u'name': u'saved-network' + "volumes": {'aa77asdf-1234': 'saved-volume'}, + "networks": {'6722fc13-4319': { + 'id': '6722fc13-4319', + 'name': 'saved-network' }}, - "floatingips": {u'9e82d248-408a': { - u'id': u'9e82d248-408a', - u'status': u'ACTIVE' + "floatingips": {'9e82d248-408a': { + 'id': '9e82d248-408a', + 'status': 'ACTIVE' }}, - "routers": {u'4s5w34hj-id44': u'saved-router'}, - "metering_label_rules": {u'93a973ce-4dc5': { - u'direction': u'ingress', - u'id': u'93a973ce-4dc5' + "routers": {'4s5w34hj-id44': 'saved-router'}, + "metering_label_rules": {'93a973ce-4dc5': { + 'direction': 'ingress', + 'id': '93a973ce-4dc5' }}, - "metering_labels": {u'723b346ce866-4c7q': u'saved-label'}, - "ports": {u'aa74aa4v-741a': u'saved-port'}, - "security_groups": {u'7q844add-3697': u'saved-sec-group'}, - "subnets": {u'55ttda4a-2584': u'saved-subnet'}, - "subnetpools": {u'8acf64c1-43fc': u'saved-subnet-pool'}, - "regions": {u'RegionOne': {}} + "metering_labels": {'723b346ce866-4c7q': 'saved-label'}, + "ports": {'aa74aa4v-741a': 'saved-port'}, + "security_groups": {'7q844add-3697': 'saved-sec-group'}, + "subnets": {'55ttda4a-2584': 'saved-subnet'}, + "subnetpools": {'8acf64c1-43fc': 'saved-subnet-pool'}, + "regions": {'RegionOne': {}} } # Mocked methods get_method = 'tempest.lib.common.rest_client.RestClient.get' diff --git a/tempest/tests/lib/services/compute/test_aggregates_client.py b/tempest/tests/lib/services/compute/test_aggregates_client.py index 674d92a35e..1448a4db5e 100644 --- a/tempest/tests/lib/services/compute/test_aggregates_client.py +++ b/tempest/tests/lib/services/compute/test_aggregates_client.py @@ -37,7 +37,7 @@ class TestAggregatesClient(base.BaseServiceTest): FAKE_CREATE_AGGREGATE = { "aggregate": { - "name": u'\xf4', + "name": '\xf4', "availability_zone": None, "deleted": False, "created_at": "2015-07-21T04:11:18.000000", @@ -50,7 +50,7 @@ class TestAggregatesClient(base.BaseServiceTest): FAKE_UPDATE_AGGREGATE = { "aggregate": { - "name": u'\xe9', + "name": '\xe9', "availability_zone": None, "deleted": False, "created_at": "2015-07-16T03:07:32.000000", @@ -74,7 +74,7 @@ class TestAggregatesClient(base.BaseServiceTest): "metadata": { "availability_zone": "nova" }, - "name": u'\xe9', + "name": '\xe9', "updated_at": None } diff --git a/tempest/tests/lib/services/compute/test_availability_zone_client.py b/tempest/tests/lib/services/compute/test_availability_zone_client.py index 6608592da9..aef98fc3a3 100644 --- a/tempest/tests/lib/services/compute/test_availability_zone_client.py +++ b/tempest/tests/lib/services/compute/test_availability_zone_client.py @@ -27,7 +27,7 @@ class TestAvailabilityZoneClient(base.BaseServiceTest): "available": True }, "hosts": None, - "zoneName": u'\xf4' + "zoneName": '\xf4' } ] } diff --git a/tempest/tests/lib/services/compute/test_extensions_client.py b/tempest/tests/lib/services/compute/test_extensions_client.py index d7e217e527..053b84cb89 100644 --- a/tempest/tests/lib/services/compute/test_extensions_client.py +++ b/tempest/tests/lib/services/compute/test_extensions_client.py @@ -27,7 +27,7 @@ class TestExtensionsClient(base.BaseServiceTest): "namespace": "http://docs.openstack.org/compute/ext/multinic/api/v1.1", "alias": "NMN", - "description": u'\u2740(*\xb4\u25e1`*)\u2740' + "description": '\u2740(*\xb4\u25e1`*)\u2740' } } diff --git a/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py b/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py index b0c00f0991..6278df48a1 100644 --- a/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py +++ b/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py @@ -22,8 +22,8 @@ class TestFloatingIPPoolsClient(base.BaseServiceTest): FAKE_FLOATING_IP_POOLS = { "floating_ip_pools": [ - {"name": u'\u3042'}, - {"name": u'\u3044'} + {"name": '\u3042'}, + {"name": '\u3044'} ] } diff --git a/tempest/tests/lib/services/compute/test_keypairs_client.py b/tempest/tests/lib/services/compute/test_keypairs_client.py index ed3b9dd7ff..214d0e5303 100644 --- a/tempest/tests/lib/services/compute/test_keypairs_client.py +++ b/tempest/tests/lib/services/compute/test_keypairs_client.py @@ -23,7 +23,7 @@ class TestKeyPairsClient(base.BaseServiceTest): FAKE_KEYPAIR = {"keypair": { "public_key": "ssh-rsa foo Generated-by-Nova", - "name": u'\u2740(*\xb4\u25e1`*)\u2740', + "name": '\u2740(*\xb4\u25e1`*)\u2740', "user_id": "525d55f98980415ba98e634972fa4a10", "fingerprint": "76:24:66:49:d7:ca:6e:5c:77:ea:8e:bb:9c:15:5f:98" }} diff --git a/tempest/tests/lib/services/compute/test_networks_client.py b/tempest/tests/lib/services/compute/test_networks_client.py index 1908b5754f..5a8867111f 100644 --- a/tempest/tests/lib/services/compute/test_networks_client.py +++ b/tempest/tests/lib/services/compute/test_networks_client.py @@ -31,7 +31,7 @@ class TestNetworksClient(base.BaseServiceTest): "deleted_at": None, "gateway": None, "rxtx_base": None, - "label": u'30d7', + "label": '30d7', "priority": None, "project_id": None, "vpn_private_address": None, diff --git a/tempest/tests/lib/services/compute/test_quota_classes_client.py b/tempest/tests/lib/services/compute/test_quota_classes_client.py index 22d8b91a3d..6921365170 100644 --- a/tempest/tests/lib/services/compute/test_quota_classes_client.py +++ b/tempest/tests/lib/services/compute/test_quota_classes_client.py @@ -29,7 +29,7 @@ class TestQuotaClassesClient(base.BaseServiceTest): "ram": 51200, "floating_ips": 10, "key_pairs": 100, - "id": u'\u2740(*\xb4\u25e1`*)\u2740', + "id": '\u2740(*\xb4\u25e1`*)\u2740', "instances": 10, "security_group_rules": 20, "security_groups": 10, diff --git a/tempest/tests/lib/services/compute/test_tenant_networks_client.py b/tempest/tests/lib/services/compute/test_tenant_networks_client.py index f71aad9b00..a042a1a1ce 100644 --- a/tempest/tests/lib/services/compute/test_tenant_networks_client.py +++ b/tempest/tests/lib/services/compute/test_tenant_networks_client.py @@ -22,7 +22,7 @@ class TestTenantNetworksClient(base.BaseServiceTest): FAKE_NETWORK = { "cidr": "None", "id": "c2329eb4-cc8e-4439-ac4c-932369309e36", - "label": u'\u30d7' + "label": '\u30d7' } FAKE_NETWORKS = [FAKE_NETWORK]