From 47bdec25eb51d2dfbcd28af512cfbd4f4165b332 Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Thu, 23 May 2013 14:58:01 -0500 Subject: eliminate 'except:' (flake8 H201) Change-Id: Ic53b43b96c490557352be212ac79a7e8a249c21a --- keystone/common/utils.py | 2 +- keystone/identity/backends/ldap/core.py | 5 +---- tox.ini | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/keystone/common/utils.py b/keystone/common/utils.py index 9536cdc7..e35bde01 100644 --- a/keystone/common/utils.py +++ b/keystone/common/utils.py @@ -228,7 +228,7 @@ def setup_remote_pydev_debug(): stdoutToServer=True, stderrToServer=True) return True - except: + except Exception: LOG.exception(_( 'Error setting up the debug environment. Verify that the ' 'option --debug-url has the format : and that a ' diff --git a/keystone/identity/backends/ldap/core.py b/keystone/identity/backends/ldap/core.py index 87e560e0..f5cdc69a 100644 --- a/keystone/identity/backends/ldap/core.py +++ b/keystone/identity/backends/ldap/core.py @@ -855,10 +855,7 @@ class RoleApi(common_ldap.BaseLdap, ApiShimMixin): roles = conn.search_s(dn, ldap.SCOPE_ONELEVEL, query, ['%s' % '1.1']) for role_dn, _ in roles: - try: - conn.delete_s(role_dn) - except: - raise Exception + conn.delete_s(role_dn) except ldap.NO_SUCH_OBJECT: pass diff --git a/tox.ini b/tox.ini index 39d9f767..bc3989d0 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,6 @@ commands = {posargs} [flake8] show-source = true -# H201: no 'except:' at least use 'except Exception:' # H301: one import per line # H302: import only modules # H304: no relative imports. @@ -40,7 +39,7 @@ show-source = true # H402: one line docstring needs punctuation # H403: multi line docstring end on new line # H404: multi line docstring should start with a summary -ignore = H201,H301,H302,H304,H306,H401,H402,H403,H404 +ignore = H301,H302,H304,H306,H401,H402,H403,H404 builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor -- cgit