diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-07-29 23:50:21 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-07-29 23:50:21 +0000 |
| commit | 5e89fd2c185c586d95080b4469b2fe397fa92ed1 (patch) | |
| tree | 7b117fe906e5b87fdd15c538c9ba3d7c7dffa1fb /openstack | |
| parent | 15ce1a6954fa84051af97df62066efd6ff017efb (diff) | |
| parent | 2031e60d3c5fbb56b610b6912189518c76165248 (diff) | |
| download | oslo-5e89fd2c185c586d95080b4469b2fe397fa92ed1.tar.gz oslo-5e89fd2c185c586d95080b4469b2fe397fa92ed1.tar.xz oslo-5e89fd2c185c586d95080b4469b2fe397fa92ed1.zip | |
Merge "Refactors boolean returns"
Diffstat (limited to 'openstack')
| -rw-r--r-- | openstack/common/rpc/impl_kombu.py | 8 | ||||
| -rw-r--r-- | openstack/common/rpc/matchmaker.py | 12 | ||||
| -rw-r--r-- | openstack/common/rpc/matchmaker_ring.py | 4 |
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): |
