]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Start using Pyflakes
authorDirk Mueller <dirk@dmllr.de>
Sun, 9 Jun 2013 09:27:32 +0000 (11:27 +0200)
committerDirk Mueller <dirk@dmllr.de>
Sun, 9 Jun 2013 09:27:32 +0000 (11:27 +0200)
Blacklist those pyflakes warnings that trigger
frequently. Fix the remaining one and start
gating on those that are enabled.

Change-Id: I92f27f8cf36615dfd465cbd903a9605f9cb78443

cinder/db/sqlalchemy/api.py
cinder/scheduler/simple.py
tox.ini

index 49265239f83fb514644333f8ea82e63f9bb07621..27a7648537b2691e82f966fda39723b722ecb4f1 100644 (file)
@@ -742,18 +742,17 @@ def quota_reserve(context, resources, quotas, deltas, expire,
                     #            a best-effort mechanism.
 
         # Check for deltas that would go negative
-        unders = [resource for resource, delta in deltas.items()
-                  if delta < 0 and
-                  delta + usages[resource].in_use < 0]
+        unders = [r for r, delta in deltas.items()
+                  if delta < 0 and delta + usages[r].in_use < 0]
 
         # Now, let's check the quotas
         # NOTE(Vek): We're only concerned about positive increments.
         #            If a project has gone over quota, we want them to
         #            be able to reduce their usage without any
         #            problems.
-        overs = [resource for resource, delta in deltas.items()
-                 if quotas[resource] >= 0 and delta >= 0 and
-                 quotas[resource] < delta + usages[resource].total]
+        overs = [r for r, delta in deltas.items()
+                 if quotas[r] >= 0 and delta >= 0 and
+                 quotas[r] < delta + usages[r].total]
 
         # NOTE(Vek): The quota check needs to be in the transaction,
         #            but the transaction doesn't fail just because
index 923c9379a25055e8d88837e3b44e9fe403d9c439..5329d6fd7c60960ec393348b834b266ff7d5ef35 100644 (file)
@@ -71,8 +71,8 @@ class SimpleScheduler(chance.ChanceScheduler):
 
         results = db.service_get_all_volume_sorted(elevated)
         if zone:
-            results = [(service, gigs) for (service, gigs) in results
-                       if service['availability_zone'] == zone]
+            results = [(s, gigs) for (s, gigs) in results
+                       if s['availability_zone'] == zone]
         for result in results:
             (service, volume_gigabytes) = result
             if volume_gigabytes + volume_size > CONF.max_gigabytes:
diff --git a/tox.ini b/tox.ini
index f5dfda43be39e0d9dd15c3233a17f873e29cb0e0..6a82572bd80a7ba910cb767c96381bec4b12796d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -37,6 +37,6 @@ deps = -r{toxinidir}/requirements.txt
 commands = bash tools/lintstack.sh
 
 [flake8]
-ignore = E711,E712,H302,H303,H304,H401,H402,H403,H404,F
+ignore = E711,E712,F401,F403,F811,F841,H302,H303,H304,H401,H402,H403,H404
 builtins = _
 exclude = .venv,.tox,dist,doc,openstack,*egg