diff options
author | Nathaniel Manista <nathaniel@google.com> | 2015-02-15 01:06:31 +0000 |
---|---|---|
committer | Nathaniel Manista <nathaniel@google.com> | 2015-02-15 01:06:31 +0000 |
commit | 6edb45189ea7165cc06561d5aab56dbb743b0505 (patch) | |
tree | d244157cdfc34b712073ad1f05750f467d4b0545 /src/python | |
parent | 96e352c008d1b3161a26f089592b573719bee7ab (diff) |
Simplify _WrappedConsumer.moar.
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/src/_framework/base/packets/_ingestion.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/python/src/_framework/base/packets/_ingestion.py b/src/python/src/_framework/base/packets/_ingestion.py index abc1e7a043..91f5a35359 100644 --- a/src/python/src/_framework/base/packets/_ingestion.py +++ b/src/python/src/_framework/base/packets/_ingestion.py @@ -183,7 +183,7 @@ class _WrappedConsumer(object): payload: A customer-significant payload object. May be None only if complete is True. complete: Whether or not the end of the payload sequence has been reached. - May be False only if payload is not None. + Must be True if payload is None. Returns: True if the wrapped consumer made progress or False if the wrapped @@ -191,13 +191,12 @@ class _WrappedConsumer(object): progress. """ try: - if payload: - if complete: - self._consumer.consume_and_terminate(payload) - else: - self._consumer.consume(payload) - else: + if payload is None: self._consumer.terminate() + elif complete: + self._consumer.consume_and_terminate(payload) + else: + self._consumer.consume(payload) return True except abandonment.Abandoned: return False |