From f5beab9f8a58ed3891e882cbc648ddc33b16d6bf Mon Sep 17 00:00:00 2001 From: Oleg Khavroshin Date: Fri, 15 Jan 2016 17:55:01 +0300 Subject: [PATCH] Edit backslashes for lines continuations It is preferred to wrap long lines in parentheses and not a backslash for line continuation due to OpenStack Style Guidelines http://docs.openstack.org/developer/hacking/#general, paragraph 2 Change-Id: I83cd72a06bcee750876fb9e127959b16107e2f79 --- heatclient/common/utils.py | 9 +++++---- heatclient/tests/unit/test_template_utils.py | 4 ++-- heatclient/tests/unit/test_utils.py | 12 ++++++------ heatclient/tests/unit/v1/test_hooks.py | 15 +++++++-------- heatclient/v1/client.py | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py index 53a84c03..a36ab38c 100644 --- a/heatclient/common/utils.py +++ b/heatclient/common/utils.py @@ -161,12 +161,13 @@ def find_resource(manager, name_or_id): try: return manager.find(name=name_or_id) except exc.NotFound: - msg = _("No %(name)s with a name or ID of " - "'%(name_or_id)s' exists.") % \ - { + msg = ( + _("No %(name)s with a name or ID of " + "'%(name_or_id)s' exists.") + % { 'name': manager.resource_class.__name__.lower(), 'name_or_id': name_or_id - } + }) raise exc.CommandError(msg) diff --git a/heatclient/tests/unit/test_template_utils.py b/heatclient/tests/unit/test_template_utils.py index 29935480..4be15186 100644 --- a/heatclient/tests/unit/test_template_utils.py +++ b/heatclient/tests/unit/test_template_utils.py @@ -405,8 +405,8 @@ class TestGetTemplateContents(testtools.TestCase): def test_get_template_contents_file(self): with tempfile.NamedTemporaryFile() as tmpl_file: - tmpl = b'{"AWSTemplateFormatVersion" : "2010-09-09",' \ - b' "foo": "bar"}' + tmpl = (b'{"AWSTemplateFormatVersion" : "2010-09-09",' + b' "foo": "bar"}') tmpl_file.write(tmpl) tmpl_file.flush() diff --git a/heatclient/tests/unit/test_utils.py b/heatclient/tests/unit/test_utils.py index 96605a52..8237b4fc 100644 --- a/heatclient/tests/unit/test_utils.py +++ b/heatclient/tests/unit/test_utils.py @@ -198,8 +198,8 @@ class ShellTestParameterFiles(testtools.TestCase): tmpl_file = '/opt/stack/template.yaml' contents = 'DBUsername=wp\nDBPassword=verybadpassword' utils.read_url_content = mock.MagicMock() - utils.read_url_content.return_value = 'DBUsername=wp\n' \ - 'DBPassword=verybadpassword' + utils.read_url_content.return_value = ('DBUsername=wp\n' + 'DBPassword=verybadpassword') p = utils.format_parameter_file([ 'env_file1=test_file1'], tmpl_file) @@ -210,8 +210,8 @@ class ShellTestParameterFiles(testtools.TestCase): tmpl_file = None contents = 'DBUsername=wp\nDBPassword=verybadpassword' utils.read_url_content = mock.MagicMock() - utils.read_url_content.return_value = 'DBUsername=wp\n' \ - 'DBPassword=verybadpassword' + utils.read_url_content.return_value = ('DBUsername=wp\n' + 'DBPassword=verybadpassword') p = utils.format_parameter_file([ 'env_file1=test_file1'], tmpl_file) self.assertEqual({'env_file1': contents @@ -222,8 +222,8 @@ class ShellTestParameterFiles(testtools.TestCase): contents = 'DBUsername=wp\nDBPassword=verybadpassword' params = ['KeyName=heat_key;UpstreamDNS=8.8.8.8'] utils.read_url_content = mock.MagicMock() - utils.read_url_content.return_value = 'DBUsername=wp\n' \ - 'DBPassword=verybadpassword' + utils.read_url_content.return_value = ('DBUsername=wp\n' + 'DBPassword=verybadpassword') p = utils.format_all_parameters(params, [ 'env_file1=test_file1'], template_file=tmpl_file) self.assertEqual({'KeyName': 'heat_key', diff --git a/heatclient/tests/unit/v1/test_hooks.py b/heatclient/tests/unit/v1/test_hooks.py index 7fc0de2e..095af908 100644 --- a/heatclient/tests/unit/v1/test_hooks.py +++ b/heatclient/tests/unit/v1/test_hooks.py @@ -32,8 +32,8 @@ class TestHooks(testtools.TestCase): type(self.args).id = stack_name_p shell.template_utils.get_template_contents = mock.Mock( return_value=({}, "")) - shell.template_utils.process_multiple_environments_and_files = \ - mock.Mock(return_value=({}, {})) + shell.template_utils.process_multiple_environments_and_files = ( + mock.Mock(return_value=({}, {}))) shell.utils.format_all_parameters = mock.Mock(return_value=[]) shell.do_stack_list = mock.Mock() shell.logger = mock.Mock() @@ -100,8 +100,8 @@ class TestHooks(testtools.TestCase): } } } - shell.template_utils.process_multiple_environments_and_files = \ - mock.Mock(return_value=({}, env)) + shell.template_utils.process_multiple_environments_and_files = ( + mock.Mock(return_value=({}, env))) shell.do_stack_create(self.client, self.args) self.assertEqual(1, self.client.stacks.create.call_count) @@ -188,8 +188,8 @@ class TestHooks(testtools.TestCase): } } } - shell.template_utils.process_multiple_environments_and_files = \ - mock.Mock(return_value=({}, env)) + shell.template_utils.process_multiple_environments_and_files = ( + mock.Mock(return_value=({}, env))) shell.do_stack_update(self.client, self.args) self.assertEqual(1, self.client.stacks.update.call_count) @@ -220,8 +220,7 @@ class TestHooks(testtools.TestCase): self.assertEqual(expected_hooks, actual_hooks) def test_clear_all_hooks(self): - shell._get_hook_type_via_status =\ - mock.Mock(return_value='pre-create') + shell._get_hook_type_via_status = mock.Mock(return_value='pre-create') type(self.args).hook = mock.PropertyMock( return_value=['bp']) type(self.args).pre_create = mock.PropertyMock(return_value=True) diff --git a/heatclient/v1/client.py b/heatclient/v1/client.py index 09a5eb87..3d3c1e9e 100644 --- a/heatclient/v1/client.py +++ b/heatclient/v1/client.py @@ -46,9 +46,9 @@ class Client(object): self.events = events.EventManager(self.http_client) self.actions = actions.ActionManager(self.http_client) self.build_info = build_info.BuildInfoManager(self.http_client) - self.software_deployments = \ + self.software_deployments = ( software_deployments.SoftwareDeploymentManager( - self.http_client) + self.http_client)) self.software_configs = software_configs.SoftwareConfigManager( self.http_client) self.services = services.ServiceManager(self.http_client)