From b29324318500aa7403a6327fe66bf50dbb5faa00 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Fri, 10 Jan 2014 21:09:46 +0100 Subject: [PATCH] Fix some trivial py3 errors Change-Id: I72334d2ca82057e591dca4fcfa9ef7ecdd3b6878 --- doc/source/conf.py | 2 +- heatclient/tests/test_shell.py | 2 +- heatclient/v1/shell.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index aafb0c1b..54f8a9a5 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -30,7 +30,7 @@ import os # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) -execfile(os.path.join("ext", "gen_ref.py")) +exec(open(os.path.join("ext", "gen_ref.py")).read()) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be diff --git a/heatclient/tests/test_shell.py b/heatclient/tests/test_shell.py index 8a78e5e0..1bbb385f 100644 --- a/heatclient/tests/test_shell.py +++ b/heatclient/tests/test_shell.py @@ -56,7 +56,7 @@ class TestCase(testtools.TestCase): # required for testing with Python 2.6 def assertRegexpMatches(self, text, expected_regexp, msg=None): """Fail the test unless the text matches the regular expression.""" - if isinstance(expected_regexp, basestring): + if isinstance(expected_regexp, six.string_types): expected_regexp = re.compile(expected_regexp) if not expected_regexp.search(text): msg = msg or "Regexp didn't match" diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 47847912..698f234c 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -361,9 +361,9 @@ def do_template_show(hc, args): raise exc.CommandError('Stack not found: %s' % args.id) else: if 'heat_template_version' in template: - print yaml.safe_dump(template, indent=2) + print(yaml.safe_dump(template, indent=2)) else: - print jsonutils.dumps(template, indent=2) + print(jsonutils.dumps(template, indent=2)) @utils.arg('-u', '--template-url', metavar='', @@ -404,7 +404,7 @@ def do_template_validate(hc, args): _process_environment_and_files(args, fields) validation = hc.stacks.validate(**fields) - print jsonutils.dumps(validation, indent=2) + print(jsonutils.dumps(validation, indent=2)) @utils.arg('id', metavar='', @@ -471,9 +471,9 @@ def do_resource_template(hc, args): raise exc.CommandError('Resource %s not found.' % args.resource) else: if args.format: - print utils.format_output(template, format=args.format) + print(utils.format_output(template, format=args.format)) else: - print utils.format_output(template) + print(utils.format_output(template)) @utils.arg('id', metavar='', @@ -490,7 +490,7 @@ def do_resource_metadata(hc, args): raise exc.CommandError('Stack or resource not found: %s %s' % (args.id, args.resource)) else: - print jsonutils.dumps(metadata, indent=2) + print(jsonutils.dumps(metadata, indent=2)) @utils.arg('id', metavar='',