From d06457bccba5977f24e9811e86706c9a3c98d74c Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 30 Sep 2024 15:03:18 +0900 Subject: [PATCH] Drop unicode prefix It is no longer required in Python 3 because strings are by default unicode strings. Change-Id: I0269ce5f4be61133a7244bb2fc386dc5f2ec736c --- api-ref/source/conf.py | 8 ++-- doc/source/conf.py | 38 +++++++++---------- doc/source/ext/resources.py | 2 +- heat/common/context.py | 4 +- heat/common/template_format.py | 4 +- heat/engine/check_resource.py | 4 +- heat/engine/constraints.py | 2 +- .../openstack/heat/instance_group.py | 2 +- heat/engine/sync_point.py | 4 +- releasenotes/source/conf.py | 14 +++---- 10 files changed, 41 insertions(+), 41 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 5f1657cb2b..51249b9fdd 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -61,7 +61,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -copyright = u'2010-present, OpenStack Foundation' +copyright = '2010-present, OpenStack Foundation' # openstackdocstheme options openstackdocs_repo_name = 'openstack/heat' @@ -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 = 'heatdoc' # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ - ('index', 'Heat.tex', u'OpenStack Orchestration API Documentation', - u'OpenStack Foundation', 'manual'), + ('index', 'Heat.tex', 'OpenStack Orchestration API Documentation', + 'OpenStack Foundation', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/source/conf.py b/doc/source/conf.py index 933b0f3cbc..a42c92b3f9 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -128,7 +128,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -copyright = u'(c) 2012- Heat Developers' +copyright = '(c) 2012- Heat Developers' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -274,8 +274,8 @@ htmlhelp_basename = 'Heatdoc' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]) latex_documents = [ - ('index', 'doc-heat.tex', u'Heat Documentation', - u'Heat Developers', 'manual'), + ('index', 'doc-heat.tex', 'Heat Documentation', + 'Heat Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -313,26 +313,26 @@ latex_elements = { # (source start file, name, description, authors, manual section). man_pages = [ ('man/heat-api', 'heat-api', - u'REST API service to the heat project.', - [u'Heat Developers'], 1), + 'REST API service to the heat project.', + ['Heat Developers'], 1), ('man/heat-api-cfn', 'heat-api-cfn', - u'CloudFormation compatible API service to the heat project.', - [u'Heat Developers'], 1), + 'CloudFormation compatible API service to the heat project.', + ['Heat Developers'], 1), ('man/heat-db-setup', 'heat-db-setup', - u'Command line utility to setup the Heat database', - [u'Heat Developers'], 1), + 'Command line utility to setup the Heat database', + ['Heat Developers'], 1), ('man/heat-engine', 'heat-engine', - u'Service which performs the actions from the API calls made by the user', - [u'Heat Developers'], 1), + 'Service which performs the actions from the API calls made by the user', + ['Heat Developers'], 1), ('man/heat-keystone-setup-domain', 'heat-keystone-setup-domain', - u'Script which sets up a keystone domain for heat users and projects', - [u'Heat Developers'], 1), + 'Script which sets up a keystone domain for heat users and projects', + ['Heat Developers'], 1), ('man/heat-manage', 'heat-manage', - u'Script which helps manage specific database operations', - [u'Heat Developers'], 1), + 'Script which helps manage specific database operations', + ['Heat Developers'], 1), ('man/heat-status', 'heat-status', - u'Script to check status of Heat deployment.', - [u'Heat Developers'], 1), + 'Script to check status of Heat deployment.', + ['Heat Developers'], 1), ] @@ -346,8 +346,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Heat', u'Heat Documentation', - u'Heat Developers', 'Heat', 'One line description of project.', + ('index', 'Heat', 'Heat Documentation', + 'Heat Developers', 'Heat', 'One line description of project.', 'Miscellaneous'), ] diff --git a/doc/source/ext/resources.py b/doc/source/ext/resources.py index a7432b556b..1a6e12b805 100644 --- a/doc/source/ext/resources.py +++ b/doc/source/ext/resources.py @@ -172,7 +172,7 @@ class ResourcePages(rst.Directive): # Ignore title generated for list items if title != '*': title = nodes.term('', title) - ref = nodes.reference('', u'\xb6') + ref = nodes.reference('', '\xb6') ref['classes'] = ['headerlink'] ref['refid'] = id title.append(ref) diff --git a/heat/common/context.py b/heat/common/context.py index 7d55fdaf60..8176f9e0aa 100644 --- a/heat/common/context.py +++ b/heat/common/context.py @@ -139,8 +139,8 @@ class RequestContext(context.RequestContext): return self._clients def to_dict(self): - user_idt = u'{user} {project}'.format(user=self.user_id or '-', - project=self.project_id or '-') + user_idt = '{user} {project}'.format(user=self.user_id or '-', + project=self.project_id or '-') return {'auth_token': self.auth_token, 'username': self.username, diff --git a/heat/common/template_format.py b/heat/common/template_format.py index 9978bf0ab1..d55339ea90 100644 --- a/heat/common/template_format.py +++ b/heat/common/template_format.py @@ -44,13 +44,13 @@ class yaml_dumper(_yaml_dumper_base): return self.represent_dict(data.items()) -yaml_loader.add_constructor(u'tag:yaml.org,2002:str', +yaml_loader.add_constructor('tag:yaml.org,2002:str', yaml_loader._construct_yaml_str) # Unquoted dates like 2013-05-23 in yaml files get loaded as objects of type # datetime.data which causes problems in API layer when being processed by # openstack.common.jsonutils. Therefore, make unicode string out of timestamps # until jsonutils can handle dates. -yaml_loader.add_constructor(u'tag:yaml.org,2002:timestamp', +yaml_loader.add_constructor('tag:yaml.org,2002:timestamp', yaml_loader._construct_yaml_str) yaml_dumper.add_representer(collections.OrderedDict, diff --git a/heat/engine/check_resource.py b/heat/engine/check_resource.py index 4bbdb5890c..87dd7cf70d 100644 --- a/heat/engine/check_resource.py +++ b/heat/engine/check_resource.py @@ -109,7 +109,7 @@ class CheckResource(object): self.retrigger_check_resource(cnxt, rsrc_id, latest_stack) def _handle_stack_timeout(self, cnxt, stack): - failure_reason = u'Timed out' + failure_reason = 'Timed out' stack.mark_failed(failure_reason) def _handle_resource_replacement(self, cnxt, @@ -179,7 +179,7 @@ class CheckResource(object): stack, reason) except scheduler.Timeout: self._handle_resource_failure(cnxt, is_update, rsrc.id, - stack, u'Timed out') + stack, 'Timed out') except CancelOperation: # Stack is already marked FAILED, so we just need to retrigger # in case a new traversal has started and is waiting on us. diff --git a/heat/engine/constraints.py b/heat/engine/constraints.py index dfed2c9693..c0e94d7e4e 100644 --- a/heat/engine/constraints.py +++ b/heat/engine/constraints.py @@ -294,7 +294,7 @@ class Constraint(collections.abc.Mapping): yield self.description yield self._str() - return u'\n'.join(desc()) + return '\n'.join(desc()) def validate(self, value, schema=None, context=None): if not self._is_valid(value, schema, context): diff --git a/heat/engine/resources/openstack/heat/instance_group.py b/heat/engine/resources/openstack/heat/instance_group.py index 345e56daea..076a7574b2 100644 --- a/heat/engine/resources/openstack/heat/instance_group.py +++ b/heat/engine/resources/openstack/heat/instance_group.py @@ -446,7 +446,7 @@ class InstanceGroup(stack_resource.StackResource): """ if name == self.INSTANCE_LIST: def listify(ips): - return u','.join(ips) or None + return ','.join(ips) or None try: output = self.get_output(name) diff --git a/heat/engine/sync_point.py b/heat/engine/sync_point.py index fb5ecb0f55..92de18ef84 100644 --- a/heat/engine/sync_point.py +++ b/heat/engine/sync_point.py @@ -72,7 +72,7 @@ def update_input_data(context, entity_id, current_traversal, def str_pack_tuple(t): - return u'tuple:' + str(tuple(t)) + return 'tuple:' + str(tuple(t)) def _str_unpack_tuple(s): @@ -83,7 +83,7 @@ def _str_unpack_tuple(s): def _deserialize(d): d2 = {} for k, v in d.items(): - if isinstance(k, str) and k.startswith(u'tuple:('): + if isinstance(k, str) and k.startswith('tuple:('): k = _str_unpack_tuple(k) if isinstance(v, dict): v = _deserialize(v) diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index b60748bb9e..6a5ab6cb59 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'2015, Heat Developers' +copyright = '2015, Heat Developers' # Release notes are version independent, no need to set version and release release = '' @@ -191,8 +191,8 @@ htmlhelp_basename = 'HeatReleaseNotesdoc' # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'HeatReleaseNotes.tex', u'Heat Release Notes Documentation', - u'Heat Developers', 'manual'), + ('index', 'HeatReleaseNotes.tex', 'Heat Release Notes Documentation', + 'Heat Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -221,8 +221,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'heatreleasenotes', u'Heat Release Notes Documentation', - [u'Heat Developers'], 1) + ('index', 'heatreleasenotes', 'Heat Release Notes Documentation', + ['Heat Developers'], 1) ] # If true, show URL addresses after external links. @@ -235,8 +235,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'HeatReleaseNotes', u'Heat Release Notes Documentation', - u'Heat Developers', 'HeatReleaseNotes', + ('index', 'HeatReleaseNotes', 'Heat Release Notes Documentation', + 'Heat Developers', 'HeatReleaseNotes', 'One line description of project.', 'Miscellaneous'), ]