diff options
Diffstat (limited to 'openstack')
-rw-r--r-- | openstack/common/policy.py | 2 | ||||
-rw-r--r-- | openstack/common/processutils.py | 2 | ||||
-rw-r--r-- | openstack/common/rpc/impl_zmq.py | 4 | ||||
-rw-r--r-- | openstack/common/rpc/matchmaker.py | 2 | ||||
-rw-r--r-- | openstack/common/setup.py | 6 | ||||
-rw-r--r-- | openstack/common/wsgi.py | 2 |
6 files changed, 8 insertions, 10 deletions
diff --git a/openstack/common/policy.py b/openstack/common/policy.py index 21ea010..cd6dcfc 100644 --- a/openstack/common/policy.py +++ b/openstack/common/policy.py @@ -437,7 +437,7 @@ def _parse_list_rule(rule): or_list.append(AndCheck(and_list)) # If we have only one check, omit the "or" - if len(or_list) == 0: + if not or_list: return FalseCheck() elif len(or_list) == 1: return or_list[0] diff --git a/openstack/common/processutils.py b/openstack/common/processutils.py index 09baea3..1aa1335 100644 --- a/openstack/common/processutils.py +++ b/openstack/common/processutils.py @@ -123,7 +123,7 @@ def execute(*cmd, **kwargs): elif isinstance(check_exit_code, int): check_exit_code = [check_exit_code] - if len(kwargs): + if kwargs: raise UnknownArgumentError(_('Got unknown keyword args ' 'to utils.execute: %r') % kwargs) diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py index 7a5d814..fec299c 100644 --- a/openstack/common/rpc/impl_zmq.py +++ b/openstack/common/rpc/impl_zmq.py @@ -180,7 +180,7 @@ class ZmqSocket(object): return # We must unsubscribe, or we'll leak descriptors. - if len(self.subscriptions) > 0: + if self.subscriptions: for f in self.subscriptions: try: self.sock.setsockopt(zmq.UNSUBSCRIBE, f) @@ -763,7 +763,7 @@ def _multi_send(method, context, topic, msg, timeout=None, LOG.debug(_("Sending message(s) to: %s"), queues) # Don't stack if we have no matchmaker results - if len(queues) == 0: + if not queues: LOG.warn(_("No matchmaker results. Not casting.")) # While not strictly a timeout, callers know how to handle # this exception and a timeout isn't too big a lie. diff --git a/openstack/common/rpc/matchmaker.py b/openstack/common/rpc/matchmaker.py index 7366246..3d72ae7 100644 --- a/openstack/common/rpc/matchmaker.py +++ b/openstack/common/rpc/matchmaker.py @@ -245,7 +245,7 @@ class HeartbeatMatchMakerBase(MatchMakerBase): yielding for CONF.matchmaker_heartbeat_freq seconds between iterations. """ - if len(self.hosts) == 0: + if not self.hosts: raise MatchMakerException( _("Register before starting heartbeat.")) 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(): diff --git a/openstack/common/wsgi.py b/openstack/common/wsgi.py index 9e92ffe..d184963 100644 --- a/openstack/common/wsgi.py +++ b/openstack/common/wsgi.py @@ -659,7 +659,7 @@ class RequestDeserializer(object): return self.headers_deserializer.deserialize(request, action) def deserialize_body(self, request, action): - if not len(request.body) > 0: + if not request.body: LOG.debug(_("Empty body provided in request")) return {} |