From a51469326e84ed977ecc4e57fd3d46cdc21aa08f Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Fri, 10 May 2013 23:15:08 +0800 Subject: Removes len() on empty sequence evaluation PEP8 suggestes, "For sequences, use the fact that empty sequences are false." Change-Id: I4c600a7a6230a55328ee46f7c59f340f37abc18f --- openstack/common/setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'openstack/common/setup.py') diff --git a/openstack/common/setup.py b/openstack/common/setup.py index 03b0675..1b3a127 100644 --- a/openstack/common/setup.py +++ b/openstack/common/setup.py @@ -127,11 +127,9 @@ def _run_shell_command(cmd, throw_on_error=False): out = output.communicate() if output.returncode and throw_on_error: raise Exception("%s returned %d" % cmd, output.returncode) - if len(out) == 0: + if not out: return None - if len(out[0].strip()) == 0: - return None - return out[0].strip() + return out[0].strip() or None def _get_git_directory(): -- cgit