summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorZhongyue Luo <zhongyue.nah@intel.com>2013-07-26 13:03:46 +0900
committerZhongyue Luo <zhongyue.nah@intel.com>2013-07-28 12:54:43 +0900
commit2031e60d3c5fbb56b610b6912189518c76165248 (patch)
treeea2d039704c268f36d04b8bc213eb6621fc40cfd /openstack
parentd65f843829356f5ed8d8b7bb6fe92f225c30b1e6 (diff)
downloadoslo-2031e60d3c5fbb56b610b6912189518c76165248.tar.gz
oslo-2031e60d3c5fbb56b610b6912189518c76165248.tar.xz
oslo-2031e60d3c5fbb56b610b6912189518c76165248.zip
Refactors boolean returns
Return the boolean evaluation itself rather than a boolean after evaluation Change-Id: I6329d474c921e29eb3a690270de12d51cb863710
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/rpc/impl_kombu.py8
-rw-r--r--openstack/common/rpc/matchmaker.py12
-rw-r--r--openstack/common/rpc/matchmaker_ring.py4
3 files changed, 6 insertions, 18 deletions
diff --git a/openstack/common/rpc/impl_kombu.py b/openstack/common/rpc/impl_kombu.py
index 6b1ae93..61ab415 100644
--- a/openstack/common/rpc/impl_kombu.py
+++ b/openstack/common/rpc/impl_kombu.py
@@ -490,12 +490,8 @@ class Connection(object):
# future with this?
ssl_params['cert_reqs'] = ssl.CERT_REQUIRED
- if not ssl_params:
- # Just have the default behavior
- return True
- else:
- # Return the extended behavior
- return ssl_params
+ # Return the extended behavior or just have the default behavior
+ return ssl_params or True
def _connect(self, params):
"""Connect to rabbit. Re-establish any queues that may have
diff --git a/openstack/common/rpc/matchmaker.py b/openstack/common/rpc/matchmaker.py
index e80ab37..a94f542 100644
--- a/openstack/common/rpc/matchmaker.py
+++ b/openstack/common/rpc/matchmaker.py
@@ -248,9 +248,7 @@ class DirectBinding(Binding):
that it maps directly to a host, thus direct.
"""
def test(self, key):
- if '.' in key:
- return True
- return False
+ return '.' in key
class TopicBinding(Binding):
@@ -262,17 +260,13 @@ class TopicBinding(Binding):
matches that of a direct exchange.
"""
def test(self, key):
- if '.' not in key:
- return True
- return False
+ return '.' not in key
class FanoutBinding(Binding):
"""Match on fanout keys, where key starts with 'fanout.' string."""
def test(self, key):
- if key.startswith('fanout~'):
- return True
- return False
+ return key.startswith('fanout~')
class StubExchange(Exchange):
diff --git a/openstack/common/rpc/matchmaker_ring.py b/openstack/common/rpc/matchmaker_ring.py
index 45a095f..6b488ce 100644
--- a/openstack/common/rpc/matchmaker_ring.py
+++ b/openstack/common/rpc/matchmaker_ring.py
@@ -63,9 +63,7 @@ class RingExchange(mm.Exchange):
self.ring0[k] = itertools.cycle(self.ring[k])
def _ring_has(self, key):
- if key in self.ring0:
- return True
- return False
+ return key in self.ring0
class RoundRobinRingExchange(RingExchange):