From: Dirk Mueller Date: Sun, 9 Jun 2013 09:27:32 +0000 (+0200) Subject: Start using Pyflakes X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=83b2a51d878d2143257c519c43b36b2f9c5e2dab;p=openstack-build%2Fcinder-build.git Start using Pyflakes Blacklist those pyflakes warnings that trigger frequently. Fix the remaining one and start gating on those that are enabled. Change-Id: I92f27f8cf36615dfd465cbd903a9605f9cb78443 --- diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index 49265239f..27a764853 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -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 diff --git a/cinder/scheduler/simple.py b/cinder/scheduler/simple.py index 923c9379a..5329d6fd7 100644 --- a/cinder/scheduler/simple.py +++ b/cinder/scheduler/simple.py @@ -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 f5dfda43b..6a82572bd 100644 --- 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