From b73046ff74376bc0acd3e52fe1faf13c8a613383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Wed, 20 Apr 2022 12:57:34 +0200 Subject: [PATCH] Remove unnecessary unicode prefixes Change-Id: I87ee686a86be738ee96edf647a33fc3ce0510853 --- api-guide/source/conf.py | 20 +++++++++---------- barbican/queue/keystone_listener.py | 2 +- .../tests/api/test_transport_keys_resource.py | 8 ++++---- barbican/tests/common/test_quota.py | 2 +- barbican/tests/common/test_validators.py | 4 ++-- .../test_repositories_order_retry_tasks.py | 6 +++--- barbican/tests/plugin/crypto/test_crypto.py | 2 +- barbican/tests/plugin/crypto/test_pkcs11.py | 2 +- doc/source/install/verify.rst | 2 +- .../api/v1/functional/test_secrets.py | 18 ++++++++--------- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/api-guide/source/conf.py b/api-guide/source/conf.py index 26f20022c..43d21433d 100644 --- a/api-guide/source/conf.py +++ b/api-guide/source/conf.py @@ -45,13 +45,13 @@ source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. -project = u'Key Manager API Guide' -openstackdocs_bug_tag = u'api-guide' +project = 'Key Manager API Guide' +openstackdocs_bug_tag = 'api-guide' openstackdocs_repo_name = 'openstack/barbican' openstackdocs_auto_name = False openstackdocs_bug_project = 'barbican' -copyright = u'2016, OpenStack contributors' +copyright = '2016, OpenStack contributors' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -190,8 +190,8 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'KeyManagerAPI.tex', u'Key Manager API Documentation', - u'OpenStack contributors', 'manual'), + ('index', 'KeyManagerAPI.tex', 'Key Manager API Documentation', + 'OpenStack contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -220,8 +220,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'keymanagerapi', u'Key Manager API Documentation', - [u'OpenStack contributors'], 1) + ('index', 'keymanagerapi', 'Key Manager API Documentation', + ['OpenStack contributors'], 1) ] # If true, show URL addresses after external links. @@ -234,8 +234,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'KeyManagerAPIGuide', u'Key Manager API Guide', - u'OpenStack contributors', 'APIGuide', + ('index', 'KeyManagerAPIGuide', 'Key Manager API Guide', + 'OpenStack contributors', 'APIGuide', 'This guide teaches OpenStack Key Manager service users concepts about ' 'managing keys in an OpenStack cloud with the Key Manager API.', 'Miscellaneous'), @@ -259,6 +259,6 @@ locale_dirs = ['locale/'] # -- Options for PDF output -------------------------------------------------- pdf_documents = [ - ('index', u'KeyManagerAPIGuide', u'Key Manager API Guide', u'OpenStack ' + ('index', 'KeyManagerAPIGuide', 'Key Manager API Guide', 'OpenStack ' 'contributors') ] diff --git a/barbican/queue/keystone_listener.py b/barbican/queue/keystone_listener.py index f80f0630c..afab568d9 100644 --- a/barbican/queue/keystone_listener.py +++ b/barbican/queue/keystone_listener.py @@ -130,7 +130,7 @@ class NotificationTask(object): """Gets project resource identifier from payload Sample payload is provided below:: - {'resource_info': u'2b99a94ad02741978e613fb52dd1f4cd'} + {'resource_info': '2b99a94ad02741978e613fb52dd1f4cd'} """ if payload_s: return payload_s.get('resource_info') diff --git a/barbican/tests/api/test_transport_keys_resource.py b/barbican/tests/api/test_transport_keys_resource.py index 6c7aec8b2..5e8b29493 100644 --- a/barbican/tests/api/test_transport_keys_resource.py +++ b/barbican/tests/api/test_transport_keys_resource.py @@ -150,8 +150,8 @@ class WhenGettingTransKeysListUsingTransportKeysResource(FunctionalTest): self.repo.get_by_create_date.assert_called_once_with( plugin_name=None, - offset_arg=u'{0}'.format(self.offset), - limit_arg=u'{0}'.format(self.limit), + offset_arg='{0}'.format(self.offset), + limit_arg='{0}'.format(self.limit), suppress_exception=True ) @@ -185,8 +185,8 @@ class WhenGettingTransKeysListUsingTransportKeysResource(FunctionalTest): self.repo.get_by_create_date.assert_called_once_with( plugin_name=None, - offset_arg=u'{0}'.format(self.offset), - limit_arg=u'{0}'.format(self.limit), + offset_arg='{0}'.format(self.offset), + limit_arg='{0}'.format(self.limit), suppress_exception=True ) diff --git a/barbican/tests/common/test_quota.py b/barbican/tests/common/test_quota.py index 59de62ea2..e6593c23b 100644 --- a/barbican/tests/common/test_quota.py +++ b/barbican/tests/common/test_quota.py @@ -84,7 +84,7 @@ class WhenTestingQuotaDriverFunctions(database_utils.RepositoryTestCase): self.create_a_test_project_quotas() project_quotas = self.quota_driver.get_project_quotas_list() self.assertEqual({'project_quotas': [{ - 'project_id': u'project1', + 'project_id': 'project1', 'project_quotas': {'consumers': 105, 'containers': 103, 'orders': 102, diff --git a/barbican/tests/common/test_validators.py b/barbican/tests/common/test_validators.py index e94f66f5b..38d05b89e 100644 --- a/barbican/tests/common/test_validators.py +++ b/barbican/tests/common/test_validators.py @@ -103,9 +103,9 @@ class WhenTestingValidatorsFunctions(utils.BaseTestCase): self.assertTrue(is_too_big) def test_secret_too_big_is_true_for_big_unicode_secrets(self): - beer = u'\U0001F37A' + beer = '\U0001F37A' data = beer * (validators.CONF.max_allowed_secret_in_bytes // 4) - data += u'1' + data += '1' is_too_big = validators.secret_too_big(data) diff --git a/barbican/tests/model/repositories/test_repositories_order_retry_tasks.py b/barbican/tests/model/repositories/test_repositories_order_retry_tasks.py index 821d98247..ab159c8ce 100644 --- a/barbican/tests/model/repositories/test_repositories_order_retry_tasks.py +++ b/barbican/tests/model/repositories/test_repositories_order_retry_tasks.py @@ -47,7 +47,7 @@ class WhenTestingOrderRetryTaskRepository(database_utils.RepositoryTestCase): self.assertEqual(order_retry_task.id, order_retry_task_from_get.id) self.assertEqual( self.date_time_now, order_retry_task_from_get.retry_at) - self.assertEqual(u'retry-task', order_retry_task_from_get.retry_task) + self.assertEqual('retry-task', order_retry_task_from_get.retry_task) self.assertEqual(self.test_args, order_retry_task_from_get.retry_args) self.assertEqual(self.test_kwargs, order_retry_task_from_get.retry_kwargs) @@ -88,7 +88,7 @@ class WhenTestingOrderRetryTaskRepository(database_utils.RepositoryTestCase): order_retry_task_from_get = entities[0] self.assertEqual(order_retry_task.id, order_retry_task_from_get.id) self.assertEqual(date_time_future, order_retry_task_from_get.retry_at) - self.assertEqual(u'retry-task', order_retry_task_from_get.retry_task) + self.assertEqual('retry-task', order_retry_task_from_get.retry_task) self.assertEqual(self.test_args, order_retry_task_from_get.retry_args) self.assertEqual(self.test_kwargs, order_retry_task_from_get.retry_kwargs) @@ -120,7 +120,7 @@ class WhenTestingOrderRetryTaskRepository(database_utils.RepositoryTestCase): order_retry_task = models.OrderRetryTask() order_retry_task.order_id = order.id - order_retry_task.retry_task = u'retry-task' + order_retry_task.retry_task = 'retry-task' order_retry_task.retry_at = retry_at or self.date_time_now order_retry_task.retry_args = self.test_args order_retry_task.retry_kwargs = self.test_kwargs diff --git a/barbican/tests/plugin/crypto/test_crypto.py b/barbican/tests/plugin/crypto/test_crypto.py index e733b4b1c..9ade6fa3c 100644 --- a/barbican/tests/plugin/crypto/test_crypto.py +++ b/barbican/tests/plugin/crypto/test_crypto.py @@ -42,7 +42,7 @@ class WhenTestingSimpleCryptoPlugin(utils.BaseTestCase): return self.plugin.bind_kek_metadata(kek_meta_dto) def test_encrypt_unicode_raises_value_error(self): - unencrypted = u'unicode_beer\U0001F37A' + unencrypted = 'unicode_beer\U0001F37A' encrypt_dto = plugin.EncryptDTO(unencrypted) secret = mock.MagicMock() secret.mime_type = 'text/plain' diff --git a/barbican/tests/plugin/crypto/test_pkcs11.py b/barbican/tests/plugin/crypto/test_pkcs11.py index b192caedd..37ea3502c 100644 --- a/barbican/tests/plugin/crypto/test_pkcs11.py +++ b/barbican/tests/plugin/crypto/test_pkcs11.py @@ -474,7 +474,7 @@ class WhenTestingPKCS11(utils.BaseTestCase): self.pkcs11._check_error, 0xe0) def test_converting_unicode_to_bytes(self): - self.assertEqual(b'foo', pkcs11._to_bytes(u'foo')) + self.assertEqual(b'foo', pkcs11._to_bytes('foo')) def test_converting_default_str_type_to_bytes(self): self.assertEqual(b'foo', pkcs11._to_bytes('foo')) diff --git a/doc/source/install/verify.rst b/doc/source/install/verify.rst index b3a47c26d..e527b1fe8 100644 --- a/doc/source/install/verify.rst +++ b/doc/source/install/verify.rst @@ -68,7 +68,7 @@ Verify operation of the Key Manager (barbican) service. | Name | mysecret | | Created | 2016-08-16 16:04:10+00:00 | | Status | ACTIVE | - | Content types | {u'default': u'application/octet-stream'} | + | Content types | {'default': 'application/octet-stream'} | | Algorithm | aes | | Bit length | 256 | | Secret type | opaque | diff --git a/functionaltests/api/v1/functional/test_secrets.py b/functionaltests/api/v1/functional/test_secrets.py index afc2cbe04..ff5c13c9d 100644 --- a/functionaltests/api/v1/functional/test_secrets.py +++ b/functionaltests/api/v1/functional/test_secrets.py @@ -465,7 +465,7 @@ class SecretsTestCase(base.TestCase): Launchpad bug #1315498 """ - data = u'\U0001F37A' + data = '\U0001F37A' data = data.encode('utf-8') test_model = secret_models.SecretModel( **self.default_secret_create_two_phase_data) @@ -1034,16 +1034,16 @@ class SecretsTestCase(base.TestCase): @utils.parameterized_dataset({ 'invalid_http_content_type_characaters_latin': { - 'http_content_type': u'\u00c4'.encode('utf-8')}, + 'http_content_type': '\u00c4'.encode('utf-8')}, 'invalid_http_content_type_characaters_arabic': { - 'http_content_type': u'\u060f'.encode('utf-8')}, + 'http_content_type': '\u060f'.encode('utf-8')}, 'invalid_http_content_type_characaters_cyrillic': { - 'http_content_type': u'\u0416'.encode('utf-8')}, + 'http_content_type': '\u0416'.encode('utf-8')}, 'invalid_http_content_type_characaters_replacement_character': { - 'http_content_type': u'\ufffd'.encode('utf-8')}, + 'http_content_type': '\ufffd'.encode('utf-8')}, }) @testcase.attr('negative') def test_secret_create_with_invalid_http_content_type_characters( @@ -1062,16 +1062,16 @@ class SecretsTestCase(base.TestCase): @utils.parameterized_dataset({ 'invalid_http_content_type_characaters_latin': { - 'payload_content_type': u'\u00c4'.encode('utf-8')}, + 'payload_content_type': '\u00c4'.encode('utf-8')}, 'invalid_http_content_type_characaters_arabic': { - 'payload_content_type': u'\u060f'.encode('utf-8')}, + 'payload_content_type': '\u060f'.encode('utf-8')}, 'invalid_http_content_type_characaters_cyrillic': { - 'payload_content_type': u'\u0416'.encode('utf-8')}, + 'payload_content_type': '\u0416'.encode('utf-8')}, 'invalid_http_content_type_characaters_replacement_character': { - 'payload_content_type': u'\ufffd'.encode('utf-8')}, + 'payload_content_type': '\ufffd'.encode('utf-8')}, }) @testcase.attr('negative') def test_secret_create_with_invalid_payload_content_type_characters(