diff --git a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py index 57ebb0bec1..e647f55a2a 100644 --- a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py +++ b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py @@ -152,7 +152,7 @@ class KeystoneClientV2(object): if(len(username) > 64): LOG.warn(_LW("Truncating the username %s to the last 64 " "characters."), username) - #get the last 64 characters of the username + # get the last 64 characters of the username username = username[-64:] user = self.client.users.create(username, password, diff --git a/contrib/rackspace/rackspace/resources/cloud_dns.py b/contrib/rackspace/rackspace/resources/cloud_dns.py index f9f42a0c3d..dfec24614c 100644 --- a/contrib/rackspace/rackspace/resources/cloud_dns.py +++ b/contrib/rackspace/rackspace/resources/cloud_dns.py @@ -24,7 +24,7 @@ try: from pyrax.exceptions import NotFound PYRAX_INSTALLED = True except ImportError: - #Setup fake exception for testing without pyrax + # Setup fake exception for testing without pyrax class NotFound(Exception): pass diff --git a/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py b/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py index 773faa8222..8037e4458e 100644 --- a/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py +++ b/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py @@ -32,7 +32,7 @@ try: from pyrax.exceptions import NotFound # noqa PYRAX_INSTALLED = True except ImportError: - #Setup fake exception for testing without pyrax + # Setup fake exception for testing without pyrax class NotFound(Exception): pass PYRAX_INSTALLED = False @@ -860,8 +860,8 @@ class CloudLoadBalancer(resource.Resource): % self.HALF_CLOSED) raise exception.StackValidationFailed(message=message) - #health_monitor connect and http types require completely different - #schema + # health_monitor connect and http types require completely different + # schema if self.properties.get(self.HEALTH_MONITOR): prop_val = self.properties[self.HEALTH_MONITOR] health_monitor = self._remove_none(prop_val) diff --git a/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py b/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py index a2e5d13f78..7f89fa6685 100644 --- a/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py +++ b/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py @@ -404,7 +404,7 @@ class LoadBalancerTest(common.HeatTestCase): self.m.VerifyAll() def test_alter_properties(self): - #test alter properties functions + # test alter properties functions template = self._set_template(self.lb_template, sessionPersistence='HTTP_COOKIE', connectionLogging=True, @@ -455,7 +455,7 @@ class LoadBalancerTest(common.HeatTestCase): self.assertIn("Must specify VIP type and version", str(exc)) def test_validate_half_closed(self): - #test failure (invalid protocol) + # test failure (invalid protocol) template = self._set_template(self.lb_template, halfClosed=True) expected = self._set_expected(self.expected_body, halfClosed=True) rsrc, fake_loadbalancer = self._mock_loadbalancer(template, @@ -466,7 +466,7 @@ class LoadBalancerTest(common.HeatTestCase): self.assertIn('The halfClosed property is only available for the TCP' ' or TCP_CLIENT_FIRST protocols', str(exc)) - #test TCP protocol + # test TCP protocol template = self._set_template(template, protocol='TCP') expected = self._set_expected(expected, protocol='TCP') rsrc, fake_loadbalancer = self._mock_loadbalancer(template, @@ -474,7 +474,7 @@ class LoadBalancerTest(common.HeatTestCase): expected) self.assertIsNone(rsrc.validate()) - #test TCP_CLIENT_FIRST protocol + # test TCP_CLIENT_FIRST protocol template = self._set_template(template, protocol='TCP_CLIENT_FIRST') expected = self._set_expected(expected, @@ -485,7 +485,7 @@ class LoadBalancerTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) def test_validate_health_monitor(self): - #test connect success + # test connect success health_monitor = { 'type': 'CONNECT', 'attemptsBeforeDeactivation': 1, @@ -502,8 +502,8 @@ class LoadBalancerTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) - #test connect failure - #bodyRegex is only valid for type 'HTTP(S)' + # test connect failure + # bodyRegex is only valid for type 'HTTP(S)' health_monitor['bodyRegex'] = 'dfawefawe' template = self._set_template(template, healthMonitor=health_monitor) @@ -516,7 +516,7 @@ class LoadBalancerTest(common.HeatTestCase): rsrc.validate) self.assertIn('Unknown Property bodyRegex', str(exc)) - #test http fields + # test http fields health_monitor['type'] = 'HTTP' health_monitor['bodyRegex'] = 'bodyRegex' health_monitor['statusRegex'] = 'statusRegex' @@ -539,7 +539,7 @@ class LoadBalancerTest(common.HeatTestCase): 'secureTrafficOnly': True } - #test ssl termination enabled without required fields failure + # test ssl termination enabled without required fields failure template = self._set_template(self.lb_template, sslTermination=ssl_termination) expected = self._set_expected(self.expected_body, diff --git a/heat/api/openstack/v1/views/stacks_view.py b/heat/api/openstack/v1/views/stacks_view.py index 7949544b8c..1901723936 100644 --- a/heat/api/openstack/v1/views/stacks_view.py +++ b/heat/api/openstack/v1/views/stacks_view.py @@ -53,8 +53,8 @@ def format_stack(req, stack, keys=None, tenant_safe=True): yield (key, '_'.join((stack[rpc_api.STACK_ACTION], value))) else: # TODO(zaneb): ensure parameters can be formatted for XML - #elif key == rpc_api.STACK_PARAMETERS: - # return key, json.dumps(value) + # elif key == rpc_api.STACK_PARAMETERS: + # return key, json.dumps(value) yield (key, value) return dict(itertools.chain.from_iterable( diff --git a/heat/cloudinit/part_handler.py b/heat/cloudinit/part_handler.py index 81bc08f1ab..df7962e2b7 100644 --- a/heat/cloudinit/part_handler.py +++ b/heat/cloudinit/part_handler.py @@ -1,4 +1,4 @@ -#part-handler +# part-handler # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain diff --git a/heat/common/exception.py b/heat/common/exception.py index acccafa5dc..98c82107bc 100644 --- a/heat/common/exception.py +++ b/heat/common/exception.py @@ -111,8 +111,8 @@ class HeatException(Exception): self.message = self.msg_fmt % kwargs except KeyError: exc_info = sys.exc_info() - #kwargs doesn't match a variable in the message - #log the issue and the kwargs + # kwargs doesn't match a variable in the message + # log the issue and the kwargs LOG.exception(_LE('Exception in string format operation')) for name, value in six.iteritems(kwargs): LOG.error("%s: %s" % (name, value)) # noqa @@ -159,7 +159,7 @@ class Forbidden(HeatException): msg_fmt = _("You are not authorized to complete this action.") -#NOTE(bcwaldon): here for backwards-compatibility, need to deprecate. +# NOTE(bcwaldon): here for backwards-compatibility, need to deprecate. class NotAuthorized(Forbidden): msg_fmt = _("You are not authorized to complete this action.") diff --git a/heat/common/heat_keystoneclient.py b/heat/common/heat_keystoneclient.py index 94aa4776c2..eb1311649f 100644 --- a/heat/common/heat_keystoneclient.py +++ b/heat/common/heat_keystoneclient.py @@ -318,7 +318,7 @@ class KeystoneClientV3(object): if(len(username) > 64): LOG.warn(_LW("Truncating the username %s to the last 64 " "characters."), username) - #get the last 64 characters of the username + # get the last 64 characters of the username return username[-64:] def _get_domain_id_from_name(self, domain_name): diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index 86d6166e87..d6dd033ae0 100644 --- a/heat/common/wsgi.py +++ b/heat/common/wsgi.py @@ -535,12 +535,12 @@ def is_json_content_type(request): aws_content_type = request.params.get("ContentType") except Exception: aws_content_type = None - #respect aws_content_type when both available + # respect aws_content_type when both available content_type = aws_content_type or request.content_type else: content_type = request.content_type - #bug #1887882 - #for back compatible for null or plain content type + # bug #1887882 + # for back compatible for null or plain content type if not content_type or content_type.startswith('text/plain'): content_type = 'application/json' if content_type in ('JSON', 'application/json')\ diff --git a/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py b/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py index ae8a66476a..7cc67b109e 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py @@ -33,5 +33,5 @@ def downgrade(migrate_engine): try: resource.c.id.alter(sqlalchemy.Integer, primary_key=True) except Exception: - #XXX: since there is no way to downgrade just passing + # NOTE(sshturm): since there is no way to downgrade just passing pass diff --git a/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py b/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py index c473c268d8..9df1b42ed5 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py @@ -98,11 +98,11 @@ def upgrade(migrate_engine): def upgrade_sqlite(migrate_engine): meta = sqlalchemy.MetaData(bind=migrate_engine) - #(pafuent) Here it isn't recommended to import the table from the models, - #because in future migrations the model could change and this migration - #could fail. - #I know it is ugly but it's the only way that I found to 'freeze' the model - #state for this migration. + # (pafuent) Here it isn't recommended to import the table from the models, + # because in future migrations the model could change and this migration + # could fail. + # I know it is ugly but it's the only way that I found to 'freeze' + # the model state for this migration. stack_table = sqlalchemy.Table('stack', meta, autoload=True) event_table = sqlalchemy.Table( 'new_event', meta, @@ -193,11 +193,11 @@ def downgrade(migrate_engine): def downgrade_sqlite(migrate_engine): meta = sqlalchemy.MetaData(bind=migrate_engine) - #(pafuent) Here it isn't recommended to import the table from the models, - #because in future migrations the model could change and this migration - #could fail. - #I know it is ugly but it's the only way that I found to 'freeze' the model - #state for this migration. + # (pafuent) Here it isn't recommended to import the table from the models, + # because in future migrations the model could change and this migration + # could fail. + # I know it is ugly but it's the only way that I found to 'freeze' + # the model state for this migration. stack_table = sqlalchemy.Table('stack', meta, autoload=True) event_table = sqlalchemy.Table( 'new_event', meta, diff --git a/heat/engine/cfn/functions.py b/heat/engine/cfn/functions.py index 97198fe4d6..1d1c6880dc 100644 --- a/heat/engine/cfn/functions.py +++ b/heat/engine/cfn/functions.py @@ -61,7 +61,7 @@ class GetAZs(function.Function): def result(self): # TODO(therve): Implement region scoping - #region = function.resolve(self.args) + # region = function.resolve(self.args) if self.stack is None: return ['nova'] diff --git a/heat/engine/hot/template.py b/heat/engine/hot/template.py index 16d53aefb6..78b7c5f4a8 100644 --- a/heat/engine/hot/template.py +++ b/heat/engine/hot/template.py @@ -73,7 +73,7 @@ class HOTemplate20130523(template.Template): def __getitem__(self, section): """"Get the relevant section in the template.""" - #first translate from CFN into HOT terminology if necessary + # first translate from CFN into HOT terminology if necessary if section not in self.SECTIONS: section = HOTemplate20130523._translate( section, self._CFN_TO_HOT_SECTIONS, diff --git a/heat/engine/parameter_groups.py b/heat/engine/parameter_groups.py index a88b90de69..7f1d78eaaa 100644 --- a/heat/engine/parameter_groups.py +++ b/heat/engine/parameter_groups.py @@ -43,7 +43,7 @@ class ParameterGroups(object): LOG.debug('Validating Parameter Groups.') LOG.debug(self.parameter_names) if self.parameter_groups is not None: - #Loop through groups and validate parameters + # Loop through groups and validate parameters grouped_parameters = [] for group in self.parameter_groups: parameters = group.get(PARAMETERS) @@ -54,7 +54,7 @@ class ParameterGroups(object): 'each Parameter Group.')) for param in parameters: - #Check if param has been added to a previous group + # Check if param has been added to a previous group if param in grouped_parameters: raise exception.StackValidationFailed(message=_( 'The %s parameter must be assigned to one ' @@ -62,7 +62,7 @@ class ParameterGroups(object): else: grouped_parameters.append(param) - #Check that grouped parameter references a valid Parameter + # Check that grouped parameter references a valid Parameter if param not in self.parameter_names: raise exception.StackValidationFailed(message=_( 'The Parameter name (%s) does not reference ' diff --git a/heat/engine/resources/route_table.py b/heat/engine/resources/route_table.py index f3577eb20d..a0e91cfc3c 100644 --- a/heat/engine/resources/route_table.py +++ b/heat/engine/resources/route_table.py @@ -132,7 +132,7 @@ class SubnetRouteTableAssociation(resource.Resource): router_id = self.properties.get(self.ROUTE_TABLE_ID) - #remove the default router association for this subnet. + # remove the default router association for this subnet. try: previous_router = self._router_for_subnet(subnet_id) if previous_router: diff --git a/heat/engine/resources/sahara_cluster.py b/heat/engine/resources/sahara_cluster.py index 0bb08e4f49..0fe801a763 100644 --- a/heat/engine/resources/sahara_cluster.py +++ b/heat/engine/resources/sahara_cluster.py @@ -169,7 +169,7 @@ class SaharaCluster(resource.Resource): return res # check if running on neutron and MANAGEMENT_NETWORK missing - #NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present + # NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present # overall stack validation will fail due to neutron.network constraint, # although the message will be not really relevant. if (self.is_using_neutron() and diff --git a/heat/engine/resources/sahara_templates.py b/heat/engine/resources/sahara_templates.py index 04d55a3e79..23394ac4f5 100644 --- a/heat/engine/resources/sahara_templates.py +++ b/heat/engine/resources/sahara_templates.py @@ -24,7 +24,7 @@ from heat.openstack.common import log as logging LOG = logging.getLogger(__name__) -#NOTE(pshchelo): copied from sahara/utils/api_validator.py +# NOTE(pshchelo): copied from sahara/utils/api_validator.py SAHARA_NAME_REGEX = (r"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]" r"*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z]" r"[A-Za-z0-9\-]*[A-Za-z0-9])$") @@ -213,7 +213,7 @@ class SaharaNodeGroupTemplate(resource.Resource): res = super(SaharaNodeGroupTemplate, self).validate() if res: return res - #NOTE(pshchelo): floating ip pool must be set for Neutron + # NOTE(pshchelo): floating ip pool must be set for Neutron if (self.is_using_neutron() and not self.properties.get(self.FLOATING_IP_POOL)): msg = _("%s must be provided.") % self.FLOATING_IP_POOL @@ -372,7 +372,7 @@ class SaharaClusterTemplate(resource.Resource): if res: return res # check if running on neutron and MANAGEMENT_NETWORK missing - #NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present + # NOTE(pshchelo): on nova-network with MANAGEMENT_NETWORK present # overall stack validation will fail due to neutron.network constraint, # although the message will be not really relevant. if (self.is_using_neutron() and diff --git a/heat/tests/__init__.py b/heat/tests/__init__.py index 0768bf164d..0ce93b59d5 100644 --- a/heat/tests/__init__.py +++ b/heat/tests/__init__.py @@ -19,7 +19,7 @@ def fake_translate_msgid(msgid, domain, desired_locale=None): i18n.enable_lazy() -#To ensure messages don't really get translated while running tests. -#As there are lots of places where matching is expected when comparing -#exception message(translated) with raw message. +# To ensure messages don't really get translated while running tests. +# As there are lots of places where matching is expected when comparing +# exception message(translated) with raw message. i18n._translate_msgid = fake_translate_msgid diff --git a/heat/tests/db/test_migrations.py b/heat/tests/db/test_migrations.py index ddb70a5afd..1710131e9f 100644 --- a/heat/tests/db/test_migrations.py +++ b/heat/tests/db/test_migrations.py @@ -139,7 +139,7 @@ class HeatMigrationsCheckers(test_migrations.WalkVersionsMixin, self.assertColumnExists(engine, 'raw_template', 'files') def _pre_upgrade_035(self, engine): - #The stacks id are for the 33 version migration + # The stacks id are for the 33 version migration event_table = utils.get_table(engine, 'event') data = [{ 'id': '22222222-152e-405d-b13a-35d4c816390c', @@ -178,7 +178,7 @@ class HeatMigrationsCheckers(test_migrations.WalkVersionsMixin, self.assertEqual(last_id, events_in_db[index].id) self.assertEqual(event['id'], events_in_db[index].uuid) - #Check that the autoincremental id is ok + # Check that the autoincremental id is ok data = [{ 'uuid': '33333333-152e-405d-b13a-35d4c816390c', 'stack_id': '967aaefb-152e-405d-b13a-35d4c816390c', diff --git a/heat/tests/test_ceilometer_alarm.py b/heat/tests/test_ceilometer_alarm.py index ea97fcc1e7..082fa9668f 100644 --- a/heat/tests/test_ceilometer_alarm.py +++ b/heat/tests/test_ceilometer_alarm.py @@ -195,7 +195,7 @@ class CeilometerAlarmTest(common.HeatTestCase): Make sure that we can change the update-able properties without replacing the Alarm rsrc. ''' - #short circuit the alarm's references + # short circuit the alarm's references t = template_format.parse(alarm_template) properties = t['Resources']['MEMAlarmHigh']['Properties'] properties['alarm_actions'] = ['signal_handler'] diff --git a/heat/tests/test_cw_alarm.py b/heat/tests/test_cw_alarm.py index 945139726e..e24677d47f 100644 --- a/heat/tests/test_cw_alarm.py +++ b/heat/tests/test_cw_alarm.py @@ -71,7 +71,7 @@ class CloudWatchAlarmTest(common.HeatTestCase): ''' t = template_format.parse(alarm_template) - #short circuit the alarm's references + # short circuit the alarm's references properties = t['Resources']['MEMAlarmHigh']['Properties'] properties['AlarmActions'] = ['a'] properties['Dimensions'] = [{'a': 'v'}] @@ -107,7 +107,7 @@ class CloudWatchAlarmTest(common.HeatTestCase): ''' t = template_format.parse(alarm_template) - #short circuit the alarm's references + # short circuit the alarm's references properties = t['Resources']['MEMAlarmHigh']['Properties'] properties['AlarmActions'] = ['a'] properties['Dimensions'] = [{'a': 'v'}] diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py index 19f0618fcd..e4858dda07 100644 --- a/heat/tests/test_hot.py +++ b/heat/tests/test_hot.py @@ -603,11 +603,11 @@ class HOTemplateTest(common.HeatTestCase): err_str = "can not be accessed directly" - #Hot template test + # Hot template test keyError = self.assertRaises(KeyError, tmpl.__getitem__, 'parameters') self.assertIn(err_str, six.text_type(keyError)) - #CFN template test + # CFN template test keyError = self.assertRaises(KeyError, tmpl.__getitem__, 'Parameters') self.assertIn(err_str, six.text_type(keyError)) diff --git a/heat/tests/test_lifecycle_plugin_utils.py b/heat/tests/test_lifecycle_plugin_utils.py index 64e44a7950..feed8c9dc3 100644 --- a/heat/tests/test_lifecycle_plugin_utils.py +++ b/heat/tests/test_lifecycle_plugin_utils.py @@ -164,13 +164,13 @@ class LifecyclePluginUtilsTests(common.HeatTestCase): return def is_iterable(self, obj): - #special case string + # special case string if not object: return False if isinstance(obj, str): return False - #Test for iterabilityy + # Test for iterabilityy try: for m in obj: break diff --git a/heat/tests/test_loguserdata.py b/heat/tests/test_loguserdata.py index bb2854e53e..fbb569d92c 100644 --- a/heat/tests/test_loguserdata.py +++ b/heat/tests/test_loguserdata.py @@ -148,10 +148,10 @@ class LoguserdataTest(common.HeatTestCase): def test_main_fails(self): - #fail on ci version + # fail on ci version pkg_resources.get_distribution('cloud-init').AndReturn( FakeCiVersion('0.5.0')) - #fail on execute cfn-userdata + # fail on execute cfn-userdata pkg_resources.get_distribution('cloud-init').AndReturn( FakeCiVersion('0.7.0')) diff --git a/heat/tests/test_neutron_security_group.py b/heat/tests/test_neutron_security_group.py index 5f2948f047..c5997e09ae 100644 --- a/heat/tests/test_neutron_security_group.py +++ b/heat/tests/test_neutron_security_group.py @@ -198,7 +198,7 @@ Resources: 'id': 'aaaa'} } - #create script + # create script sg_name = utils.PhysName('test_stack', 'the_sg') neutronclient.Client.create_security_group({ 'security_group': { @@ -540,7 +540,7 @@ Resources: self.m.VerifyAll() def test_security_group_exception(self): - #create script + # create script sg_name = utils.PhysName('test_stack', 'the_sg') neutronclient.Client.create_security_group({ 'security_group': { diff --git a/heat/tests/test_parser.py b/heat/tests/test_parser.py index 8b8e4f272e..8470a9f481 100644 --- a/heat/tests/test_parser.py +++ b/heat/tests/test_parser.py @@ -2211,7 +2211,7 @@ class StackTest(common.HeatTestCase): def test_update_modify_ok_replace_int(self): # create - #======== + # ======== tmpl = {'heat_template_version': '2013-05-23', 'resources': {'AResource': { 'type': 'ResWithComplexPropsAndAttrs', @@ -2242,7 +2242,7 @@ class StackTest(common.HeatTestCase): self.m.ReplayAll() # update 1 - #========== + # ========== self.stack = parser.Stack.load(self.ctx, stack_id=stack_id) tmpl2 = {'heat_template_version': '2013-05-23', @@ -2257,7 +2257,7 @@ class StackTest(common.HeatTestCase): self.stack.state) # update 2 - #========== + # ========== # reload the previous stack self.stack = parser.Stack.load(self.ctx, stack_id=stack_id) tmpl3 = {'heat_template_version': '2013-05-23', diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py index 313149c888..f95b154a68 100644 --- a/heat/tests/test_provider_template.py +++ b/heat/tests/test_provider_template.py @@ -532,7 +532,7 @@ class ProviderTemplateTest(common.HeatTestCase): """ env = {'resource_registry': {'http://example.com/test.template': None, 'resources': {}}} - #A KeyError will be thrown prior to this fix. + # A KeyError will be thrown prior to this fix. environment.Environment(env=env) def test_system_template_retrieve_by_file(self): diff --git a/heat/tests/test_security_group.py b/heat/tests/test_security_group.py index 51a6e52401..be431ed91c 100644 --- a/heat/tests/test_security_group.py +++ b/heat/tests/test_security_group.py @@ -174,7 +174,7 @@ Resources: self.assertEqual(metadata, dict(rsrc.metadata_get())) def stubout_nova_create_security_group(self): - #create script + # create script self.mock_no_neutron() nova.NovaClientPlugin._create().AndReturn(self.fc) nova_sg.SecurityGroupManager.list().AndReturn([NovaSG( @@ -504,7 +504,7 @@ Resources: neutronclient.Client.delete_security_group_rule('ffff').AndReturn(None) def test_security_group_nova(self): - #create script + # create script sg_name = self.stubout_nova_create_security_group() # delete script @@ -522,7 +522,7 @@ Resources: self.m.VerifyAll() def test_security_group_nova_bad_source_group(self): - #create script + # create script self.mock_no_neutron() nova.NovaClientPlugin._create().AndReturn(self.fc) nova_sg.SecurityGroupManager.list().MultipleTimes().AndReturn([NovaSG( @@ -582,7 +582,7 @@ Resources: self.m.VerifyAll() def test_security_group_nova_exception(self): - #create script + # create script self.mock_no_neutron() nova.NovaClientPlugin._create().AndReturn(self.fc) sg_name = utils.PhysName('test_stack', 'the_sg') @@ -700,7 +700,7 @@ Resources: self.assertRaises(exception.EgressRuleNotAllowed, sg.validate) def test_security_group_neutron(self): - #create script + # create script self.stubout_neutron_create_security_group() # delete script @@ -718,7 +718,7 @@ Resources: self.m.VerifyAll() def test_security_group_neutron_exception(self): - #create script + # create script sg_name = utils.PhysName('test_stack', 'the_sg') neutronclient.Client.create_security_group({ 'security_group': { @@ -896,7 +896,7 @@ Resources: self.m.VerifyAll() def test_security_group_nova_update(self): - #create script + # create script sg_name = self.stubout_nova_create_security_group() # update script nova_sg.SecurityGroupManager.list().MultipleTimes().AndReturn([ @@ -955,7 +955,7 @@ Resources: self.m.VerifyAll() def test_security_group_neutron_update(self): - #create script + # create script self.stubout_neutron_create_security_group() # update script diff --git a/heat/tests/test_server.py b/heat/tests/test_server.py index c2098e3f24..3da984a2ba 100644 --- a/heat/tests/test_server.py +++ b/heat/tests/test_server.py @@ -726,8 +726,8 @@ class ServersTest(common.HeatTestCase): self.m.ReplayAll() scheduler.TaskRunner(server.create)() - #self.assertEqual('4567', server.access_key) - #self.assertEqual('8901', server.secret_key) + # self.assertEqual('4567', server.access_key) + # self.assertEqual('8901', server.secret_key) self.assertEqual('1234', server._get_user_id()) self.assertTrue(stack.access_allowed('1234', 'WebServer')) @@ -2709,7 +2709,7 @@ class ServersTest(common.HeatTestCase): update_template = copy.deepcopy(server.t) update_template['Properties']['image'] = 'Update Image' - #update + # update updater = scheduler.TaskRunner(server.update, update_template) self.assertRaises(resource.UpdateReplace, updater) @@ -2735,7 +2735,7 @@ class ServersTest(common.HeatTestCase): update_template = copy.deepcopy(server.t) update_template['Properties']['image'] = 'Update Image' - #update + # update updater = scheduler.TaskRunner(server.update, update_template) err = self.assertRaises(exception.ResourceFailure, updater) self.assertEqual('StackValidationFailed: Property error : WebServer: ' diff --git a/heat/tests/test_software_component.py b/heat/tests/test_software_component.py index b1c18b7919..e48a4990b6 100644 --- a/heat/tests/test_software_component.py +++ b/heat/tests/test_software_component.py @@ -170,18 +170,18 @@ class SoftwareComponentValidationTest(common.HeatTestCase): err_msg='Property configs not assigned') ), # do not test until bug #1350840 - #( - # 'empty_configs', - # dict(snippet=''' - # component: - # type: OS::Heat::SoftwareComponent - # properties: - # configs: - # ''', - # err=exception.StackValidationFailed, - # err_msg='configs length (0) is out of range ' - # '(min: 1, max: None)') - #), + # ( + # 'empty_configs', + # dict(snippet=''' + # component: + # type: OS::Heat::SoftwareComponent + # properties: + # configs: + # ''', + # err=exception.StackValidationFailed, + # err_msg='configs length (0) is out of range ' + # '(min: 1, max: None)') + # ), ( 'invalid_configs', dict(snippet=''' diff --git a/heat/tests/test_sqlalchemy_api.py b/heat/tests/test_sqlalchemy_api.py index 5f87265be3..028d800ac3 100644 --- a/heat/tests/test_sqlalchemy_api.py +++ b/heat/tests/test_sqlalchemy_api.py @@ -300,8 +300,8 @@ class SqlAlchemyTest(common.HeatTestCase): # Test private_key property returns decrypted value self.assertEqual("fake secret", cs.my_secret) - #do this twice to verify that the orm does not commit the unencrypted - #value. + # do this twice to verify that the orm does not commit the unencrypted + # value. self.assertEqual("fake secret", cs.my_secret) scheduler.TaskRunner(cs.destroy)() @@ -1331,13 +1331,13 @@ class DBAPIStackTest(common.HeatTestCase): self.assertRaises(exception.NotFound, db_api.stack_delete, self.ctx, stack_id) - #Testing soft delete + # Testing soft delete ret_stack = db_api.stack_get(self.ctx, stack_id, show_deleted=True) self.assertIsNotNone(ret_stack) self.assertEqual(stack_id, ret_stack.id) self.assertEqual('db_test_stack_name', ret_stack.name) - #Testing child resources deletion + # Testing child resources deletion self.assertRaises(exception.NotFound, db_api.resource_get, self.ctx, resource.id) @@ -1714,12 +1714,12 @@ class DBAPIResourceDataTest(common.HeatTestCase): val = db_api.resource_data_get(self.resource, 'test_resource_key') self.assertEqual('test_value', val) - #Updating existing resource data + # Updating existing resource data create_resource_data(self.ctx, self.resource, value='foo') val = db_api.resource_data_get(self.resource, 'test_resource_key') self.assertEqual('foo', val) - #Testing with encrypted value + # Testing with encrypted value create_resource_data(self.ctx, self.resource, key='encryped_resource_key', redact=True) val = db_api.resource_data_get(self.resource, 'encryped_resource_key') @@ -1945,7 +1945,7 @@ class DBAPIWatchRuleTest(common.HeatTestCase): self.assertRaises(exception.NotFound, db_api.watch_rule_delete, self.ctx, UUID2) - #Testing associated watch data deletion + # Testing associated watch data deletion self.assertEqual([], db_api.watch_data_get_all(self.ctx)) diff --git a/tox.ini b/tox.ini index a47f2e79f3..54df710b75 100644 --- a/tox.ini +++ b/tox.ini @@ -54,7 +54,6 @@ commands = [flake8] # E251 unexpected spaces around keyword / parameter equals -# E265 block comment should start with '# ' # F402 import shadowed by loop variable # F812 list comprehension redefines variable # H202 assertRaises Exception too broad @@ -66,7 +65,7 @@ commands = # H405 multi line docstring summary not separated with an empty line # H803 no full stop at the end of the commit message # H904 Wrap long lines in parentheses instead of a backslash -ignore = E251,E265,F402,F812,H202,H233,H305,H307,H402,H404,H405,H803,H904 +ignore = E251,F402,F812,H202,H233,H305,H307,H402,H404,H405,H803,H904 show-source = true exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build max-complexity=20