From 5b579856864c4f458078a26cfb1f2053e9f9f2fa Mon Sep 17 00:00:00 2001 From: "ting.wang" Date: Thu, 14 Jan 2016 18:42:45 +0800 Subject: [PATCH] Clean up flake8 ignore list clean up ignore list and fix errors. Change-Id: I3f44def50fbf44fa3cf5c49cc15a98947084c236 --- tox.ini | 4 +--- watcher/api/middleware/parsable_error.py | 3 +-- .../strategy/strategies/outlet_temp_control.py | 6 +++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tox.ini b/tox.ini index bcee22487..e8462afff 100644 --- a/tox.ini +++ b/tox.ini @@ -42,10 +42,8 @@ commands = --output-file etc/watcher/watcher.conf.sample [flake8] -# E123, E125 skipped as they are invalid PEP-8. - show-source=True -ignore=E123,E125 +ignore= builtins= _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/ diff --git a/watcher/api/middleware/parsable_error.py b/watcher/api/middleware/parsable_error.py index 57ba5cb9e..0737e48ab 100644 --- a/watcher/api/middleware/parsable_error.py +++ b/watcher/api/middleware/parsable_error.py @@ -69,8 +69,7 @@ class ParsableErrorMiddleware(object): if (state['status_code'] // 100) not in (2, 3): req = webob.Request(environ) if (req.accept.best_match(['application/json', 'application/xml'] - ) == 'application/xml' - ): + ) == 'application/xml'): try: # simple check xml is valid body = [et.ElementTree.tostring( diff --git a/watcher/decision_engine/strategy/strategies/outlet_temp_control.py b/watcher/decision_engine/strategy/strategies/outlet_temp_control.py index c8d62825d..c93bea25b 100644 --- a/watcher/decision_engine/strategy/strategies/outlet_temp_control.py +++ b/watcher/decision_engine/strategy/strategies/outlet_temp_control.py @@ -180,9 +180,9 @@ class OutletTempControl(BaseStrategy): cores_available = cap_cores.get_capacity(host) - cores_used disk_available = cap_disk.get_capacity(host) - mem_used mem_available = cap_mem.get_capacity(host) - disk_used - if cores_available >= required_cores and \ - disk_available >= required_disk and \ - mem_available >= required_mem: + if cores_available >= required_cores \ + and disk_available >= required_disk \ + and mem_available >= required_mem: dest_servers.append(hvmap) return dest_servers