]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Fix PEP H902 (Use the 'not in' operator)
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 21 May 2013 03:01:54 +0000 (13:01 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 21 May 2013 03:01:54 +0000 (13:01 +1000)
Change-Id: Ic3dec990d2fe43dd8841aadb7b87e8f26c2d0338

heat/common/template_format.py
heat/common/wsgi.py
heat/engine/parser.py
heat/engine/resources/loadbalancer.py
heat/engine/watchrule.py
tox.ini

index 5430d94fdbf42b1fc52fd2ca93d41429a74da4d0..020efc7cf73aa25650a7546d700ef11f0a1fdc84 100644 (file)
@@ -57,12 +57,12 @@ def default_for_missing(tpl, version_param, versions):
     This is currently only applied to YAML templates.
     '''
     # if version is missing, implicitly use the lastest one
-    if not version_param in tpl:
+    if version_param not in tpl:
         tpl[version_param] = versions[-1]
 
     # create empty placeholders for any of the main dict sections
     for param in (u'Parameters', u'Mappings', u'Resources', u'Outputs'):
-        if not param in tpl:
+        if param not in tpl:
             tpl[param] = {}
 
 
index b5788df25ea58fca1cb724ab5d4a2a663bb6286b..fcfa274230f912c52dd8661942d9034d6dee1e1b 100644 (file)
@@ -80,7 +80,7 @@ class WritableLogger(object):
 def get_bind_addr(conf, default_port=None):
     """Return the host and port to bind to."""
     for opt in bind_opts:
-        if not opt.name in conf:
+        if opt.name not in conf:
             conf.register_opt(opt)
     return (conf.bind_host, conf.bind_port or default_port)
 
@@ -415,7 +415,7 @@ class Request(webob.Request):
 
     def get_content_type(self, allowed_content_types):
         """Determine content type of the request body."""
-        if not "Content-Type" in self.headers:
+        if "Content-Type" not in self.headers:
             raise exception.InvalidContentType(content_type=None)
 
         content_type = self.content_type
index a5cfd64eec2a2c6369af0a6e022c56c764605310..fc30a4e23823cd335cee8d6987c997a069bfa569 100644 (file)
@@ -349,7 +349,7 @@ class Stack(object):
             try:
                 # First delete any resources which are not in newstack
                 for res in reversed(self):
-                    if not res.name in newstack.keys():
+                    if res.name not in newstack.keys():
                         logger.debug("resource %s not found in updated stack"
                                      % res.name + " definition, deleting")
                         try:
@@ -366,7 +366,7 @@ class Stack(object):
 
                 # Then create any which are defined in newstack but not self
                 for res in newstack:
-                    if not res.name in self.keys():
+                    if res.name not in self.keys():
                         logger.debug("resource %s not found in current stack"
                                      % res.name + " definition, adding")
                         res.stack = self
index 719fe89591f6492cc96b637ff0d98977d8e8154b..aaf9e985f96577435606c53d8b2b6bdf74981fc6 100644 (file)
@@ -381,7 +381,7 @@ class LoadBalancer(stack_resource.StackResource):
                  'SourceSecurityGroupName',
                  'SourceSecurityGroupOwnerAlias')
 
-        if not key in allow:
+        if key not in allow:
             raise exception.InvalidTemplateAttribute(resource=self.name,
                                                      key=key)
 
index c55df70e940bd5859255671ba3ef17bbfa29d841..26b6aa212adb2611152f7491bfa19eb8c592e9f0 100644 (file)
@@ -230,7 +230,7 @@ class WatchRule(object):
         logger.info('WATCH: stack:%s, watch_name:%s %s',
                     self.stack_id, self.name, new_state)
         actions = []
-        if not self.ACTION_MAP[new_state] in self.rule:
+        if self.ACTION_MAP[new_state] not in self.rule:
             logger.info('no action for new state %s',
                         new_state)
         else:
@@ -246,7 +246,7 @@ class WatchRule(object):
         return actions
 
     def create_watch_data(self, data):
-        if not self.rule['MetricName'] in data:
+        if self.rule['MetricName'] not in data:
             # Our simplified cloudwatch implementation only expects a single
             # Metric associated with each alarm, but some cfn-push-stats
             # options, e.g --haproxy try to push multiple metrics when we
diff --git a/tox.ini b/tox.ini
index 1859a2bf44b50de8bea44582e6e8d43c1bbfb84a..4240ad26e98858d0fcfa2c1e22a8382a3f6e99b5 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -22,7 +22,7 @@ commands =
   python setup.py testr --coverage
 
 [flake8]
-ignore = H302,H303,H304,H403,H404,F403,F841,H306,H902,H201,H101,H703,H702
+ignore = H302,H303,H304,H403,H404,F403,F841,H306,H201,H101,H703,H702
 show-source = true
 builtins = _
 exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build