]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Fix H501 Do not use locals() for string formatting
authorSteve Baker <sbaker@redhat.com>
Thu, 8 Aug 2013 02:03:03 +0000 (14:03 +1200)
committerSteve Baker <sbaker@redhat.com>
Thu, 8 Aug 2013 02:03:03 +0000 (14:03 +1200)
This is triggered in the pep8 check when using the syncronised
requirements versions.

Change-Id: If0e38fecaf32d4ba6ec9755f2f11c675acf6d20b

heat/common/config.py
heat/common/wsgi.py
heat/tests/test_api_openstack_v1.py

index ab07ed2928d421b264794c09336722f47b4efdc9..7c15817e65326894cd1034b80ad77a100825d6e8 100644 (file)
@@ -179,4 +179,6 @@ def load_paste_app(app_name=None):
     except (LookupError, ImportError) as e:
         raise RuntimeError("Unable to load %(app_name)s from "
                            "configuration file %(conf_file)s."
-                           "\nGot: %(e)r" % locals())
+                           "\nGot: %(e)r" % {'app_name': app_name,
+                                             'conf_file': conf_file,
+                                             'e': e})
index 6d047451624a578410525c8ae5b1fd0d4ae0474c..b2e142e571a9a3a7efcde9e34a99f9395e15805b 100644 (file)
@@ -315,13 +315,13 @@ class Debug(Middleware):
 
     @webob.dec.wsgify
     def __call__(self, req):
-        print ("*" * 40) + " REQUEST ENVIRON"
+        print(("*" * 40) + " REQUEST ENVIRON")
         for key, value in req.environ.items():
             print(key, "=", value)
         print
         resp = req.get_response(self.application)
 
-        print ("*" * 40) + " RESPONSE HEADERS"
+        print(("*" * 40) + " RESPONSE HEADERS")
         for (key, value) in resp.headers.iteritems():
             print(key, "=", value)
         print
@@ -336,7 +336,7 @@ class Debug(Middleware):
         Iterator that prints the contents of a wrapper string iterator
         when iterated.
         """
-        print ("*" * 40) + " BODY"
+        print(("*" * 40) + " BODY")
         for part in app_iter:
             sys.stdout.write(part)
             sys.stdout.flush()
index 80d37a689664566b860084613bd379f3dfb0a8ae..65cbecde4eaf98a45078ec60c3b634c2b3db69c9 100644 (file)
@@ -684,7 +684,8 @@ class StackControllerTest(ControllerTest, HeatTestCase):
     def test_lookup_nonexistant(self):
         stack_name = 'wibble'
 
-        req = self._get('/stacks/%(stack_name)s' % locals())
+        req = self._get('/stacks/%(stack_name)s' % {
+            'stack_name': stack_name})
 
         error = heat_exc.StackNotFound(stack_name='a')
         self.m.StubOutWithMock(rpc, 'call')
@@ -734,7 +735,8 @@ class StackControllerTest(ControllerTest, HeatTestCase):
     def test_lookup_resource_nonexistant(self):
         stack_name = 'wibble'
 
-        req = self._get('/stacks/%(stack_name)s/resources' % locals())
+        req = self._get('/stacks/%(stack_name)s/resources' % {
+            'stack_name': stack_name})
 
         error = heat_exc.StackNotFound(stack_name='a')
         self.m.StubOutWithMock(rpc, 'call')