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
This commit is contained in:
Oleg Khavroshin 2016-01-15 17:55:01 +03:00
parent 7361b9ec49
commit f5beab9f8a
5 changed files with 22 additions and 22 deletions

View File

@ -161,12 +161,13 @@ def find_resource(manager, name_or_id):
try: try:
return manager.find(name=name_or_id) return manager.find(name=name_or_id)
except exc.NotFound: except exc.NotFound:
msg = _("No %(name)s with a name or ID of " msg = (
"'%(name_or_id)s' exists.") % \ _("No %(name)s with a name or ID of "
{ "'%(name_or_id)s' exists.")
% {
'name': manager.resource_class.__name__.lower(), 'name': manager.resource_class.__name__.lower(),
'name_or_id': name_or_id 'name_or_id': name_or_id
} })
raise exc.CommandError(msg) raise exc.CommandError(msg)

View File

@ -405,8 +405,8 @@ class TestGetTemplateContents(testtools.TestCase):
def test_get_template_contents_file(self): def test_get_template_contents_file(self):
with tempfile.NamedTemporaryFile() as tmpl_file: with tempfile.NamedTemporaryFile() as tmpl_file:
tmpl = b'{"AWSTemplateFormatVersion" : "2010-09-09",' \ tmpl = (b'{"AWSTemplateFormatVersion" : "2010-09-09",'
b' "foo": "bar"}' b' "foo": "bar"}')
tmpl_file.write(tmpl) tmpl_file.write(tmpl)
tmpl_file.flush() tmpl_file.flush()

View File

@ -198,8 +198,8 @@ class ShellTestParameterFiles(testtools.TestCase):
tmpl_file = '/opt/stack/template.yaml' tmpl_file = '/opt/stack/template.yaml'
contents = 'DBUsername=wp\nDBPassword=verybadpassword' contents = 'DBUsername=wp\nDBPassword=verybadpassword'
utils.read_url_content = mock.MagicMock() utils.read_url_content = mock.MagicMock()
utils.read_url_content.return_value = 'DBUsername=wp\n' \ utils.read_url_content.return_value = ('DBUsername=wp\n'
'DBPassword=verybadpassword' 'DBPassword=verybadpassword')
p = utils.format_parameter_file([ p = utils.format_parameter_file([
'env_file1=test_file1'], tmpl_file) 'env_file1=test_file1'], tmpl_file)
@ -210,8 +210,8 @@ class ShellTestParameterFiles(testtools.TestCase):
tmpl_file = None tmpl_file = None
contents = 'DBUsername=wp\nDBPassword=verybadpassword' contents = 'DBUsername=wp\nDBPassword=verybadpassword'
utils.read_url_content = mock.MagicMock() utils.read_url_content = mock.MagicMock()
utils.read_url_content.return_value = 'DBUsername=wp\n' \ utils.read_url_content.return_value = ('DBUsername=wp\n'
'DBPassword=verybadpassword' 'DBPassword=verybadpassword')
p = utils.format_parameter_file([ p = utils.format_parameter_file([
'env_file1=test_file1'], tmpl_file) 'env_file1=test_file1'], tmpl_file)
self.assertEqual({'env_file1': contents self.assertEqual({'env_file1': contents
@ -222,8 +222,8 @@ class ShellTestParameterFiles(testtools.TestCase):
contents = 'DBUsername=wp\nDBPassword=verybadpassword' contents = 'DBUsername=wp\nDBPassword=verybadpassword'
params = ['KeyName=heat_key;UpstreamDNS=8.8.8.8'] params = ['KeyName=heat_key;UpstreamDNS=8.8.8.8']
utils.read_url_content = mock.MagicMock() utils.read_url_content = mock.MagicMock()
utils.read_url_content.return_value = 'DBUsername=wp\n' \ utils.read_url_content.return_value = ('DBUsername=wp\n'
'DBPassword=verybadpassword' 'DBPassword=verybadpassword')
p = utils.format_all_parameters(params, [ p = utils.format_all_parameters(params, [
'env_file1=test_file1'], template_file=tmpl_file) 'env_file1=test_file1'], template_file=tmpl_file)
self.assertEqual({'KeyName': 'heat_key', self.assertEqual({'KeyName': 'heat_key',

View File

@ -32,8 +32,8 @@ class TestHooks(testtools.TestCase):
type(self.args).id = stack_name_p type(self.args).id = stack_name_p
shell.template_utils.get_template_contents = mock.Mock( shell.template_utils.get_template_contents = mock.Mock(
return_value=({}, "")) return_value=({}, ""))
shell.template_utils.process_multiple_environments_and_files = \ shell.template_utils.process_multiple_environments_and_files = (
mock.Mock(return_value=({}, {})) mock.Mock(return_value=({}, {})))
shell.utils.format_all_parameters = mock.Mock(return_value=[]) shell.utils.format_all_parameters = mock.Mock(return_value=[])
shell.do_stack_list = mock.Mock() shell.do_stack_list = mock.Mock()
shell.logger = mock.Mock() shell.logger = mock.Mock()
@ -100,8 +100,8 @@ class TestHooks(testtools.TestCase):
} }
} }
} }
shell.template_utils.process_multiple_environments_and_files = \ shell.template_utils.process_multiple_environments_and_files = (
mock.Mock(return_value=({}, env)) mock.Mock(return_value=({}, env)))
shell.do_stack_create(self.client, self.args) shell.do_stack_create(self.client, self.args)
self.assertEqual(1, self.client.stacks.create.call_count) 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 = \ shell.template_utils.process_multiple_environments_and_files = (
mock.Mock(return_value=({}, env)) mock.Mock(return_value=({}, env)))
shell.do_stack_update(self.client, self.args) shell.do_stack_update(self.client, self.args)
self.assertEqual(1, self.client.stacks.update.call_count) self.assertEqual(1, self.client.stacks.update.call_count)
@ -220,8 +220,7 @@ class TestHooks(testtools.TestCase):
self.assertEqual(expected_hooks, actual_hooks) self.assertEqual(expected_hooks, actual_hooks)
def test_clear_all_hooks(self): def test_clear_all_hooks(self):
shell._get_hook_type_via_status =\ shell._get_hook_type_via_status = mock.Mock(return_value='pre-create')
mock.Mock(return_value='pre-create')
type(self.args).hook = mock.PropertyMock( type(self.args).hook = mock.PropertyMock(
return_value=['bp']) return_value=['bp'])
type(self.args).pre_create = mock.PropertyMock(return_value=True) type(self.args).pre_create = mock.PropertyMock(return_value=True)

View File

@ -46,9 +46,9 @@ class Client(object):
self.events = events.EventManager(self.http_client) self.events = events.EventManager(self.http_client)
self.actions = actions.ActionManager(self.http_client) self.actions = actions.ActionManager(self.http_client)
self.build_info = build_info.BuildInfoManager(self.http_client) self.build_info = build_info.BuildInfoManager(self.http_client)
self.software_deployments = \ self.software_deployments = (
software_deployments.SoftwareDeploymentManager( software_deployments.SoftwareDeploymentManager(
self.http_client) self.http_client))
self.software_configs = software_configs.SoftwareConfigManager( self.software_configs = software_configs.SoftwareConfigManager(
self.http_client) self.http_client)
self.services = services.ServiceManager(self.http_client) self.services = services.ServiceManager(self.http_client)