From 684ea9f2eef2926d3e5856eea124a47e475ff3ae Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Sat, 11 Feb 2012 20:18:08 +0800 Subject: PEP8 cleanup (openstack-common) Fixes bug #930625 Remove backslash continuations in openstack-common. Fix type checking taboos. Change-Id: I49ddb9ff5fa5af760dcfccb52cb4793b71e02f19 --- openstack/common/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'openstack/common/utils.py') diff --git a/openstack/common/utils.py b/openstack/common/utils.py index fe7b63d..9b30020 100644 --- a/openstack/common/utils.py +++ b/openstack/common/utils.py @@ -25,7 +25,6 @@ import os import random import shlex import sys -import types from eventlet import greenthread from eventlet.green import subprocess @@ -60,9 +59,9 @@ def bool_from_string(subject): Useful for JSON-decoded stuff and config file parsing """ - if isinstance(subject, types.BooleanType): + if isinstance(subject, bool): return subject - if isinstance(subject, types.StringTypes): + if isinstance(subject, basestring): if subject.strip().lower() in ('true', 'on', '1'): return True return False @@ -120,8 +119,9 @@ def execute(*cmd, **kwargs): _returncode = obj.returncode # pylint: disable=E1101 if _returncode: LOG.debug(_('Result was %s') % _returncode) - if type(check_exit_code) == types.IntType \ - and _returncode != check_exit_code: + if (isinstance(check_exit_code, int) and + not isinstance(check_exit_code, bool) and + _returncode != check_exit_code): (stdout, stderr) = result raise exception.ProcessExecutionError( exit_code=_returncode, -- cgit