diff options
| author | Zhongyue Luo <lzyeval@gmail.com> | 2012-02-11 20:18:08 +0800 |
|---|---|---|
| committer | Zhongyue Luo <lzyeval@gmail.com> | 2012-02-11 23:22:54 +0800 |
| commit | 684ea9f2eef2926d3e5856eea124a47e475ff3ae (patch) | |
| tree | 62d1ebebf3dcd3690e086fab01cc1124067e6fbb /openstack/common/utils.py | |
| parent | 2ad09351f3c4f69ffcae16815b76eb28cb07a9b7 (diff) | |
| download | oslo-684ea9f2eef2926d3e5856eea124a47e475ff3ae.tar.gz oslo-684ea9f2eef2926d3e5856eea124a47e475ff3ae.tar.xz oslo-684ea9f2eef2926d3e5856eea124a47e475ff3ae.zip | |
PEP8 cleanup (openstack-common)
Fixes bug #930625
Remove backslash continuations in openstack-common.
Fix type checking taboos.
Change-Id: I49ddb9ff5fa5af760dcfccb52cb4793b71e02f19
Diffstat (limited to 'openstack/common/utils.py')
| -rw-r--r-- | openstack/common/utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
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, |
