Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Consumer falsiness. #342

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kafka/consumer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, client, group, topic, partitions=None, auto_commit=True,
self.client.load_metadata_for_topics(topic)
self.offsets = {}

if not partitions:
if partitions is None:
partitions = self.client.get_partition_ids_for_topic(topic)
else:
assert all(isinstance(x, numbers.Integral) for x in partitions)
Expand All @@ -74,7 +74,7 @@ def __init__(self, client, group, topic, partitions=None, auto_commit=True,
self.offsets[partition] = 0

def fetch_last_known_offsets(self, partitions=None):
if not partitions:
if partitions is None:
partitions = self.client.get_partition_ids_for_topic(self.topic)

def get_or_init_offset(resp):
Expand Down Expand Up @@ -112,7 +112,7 @@ def commit(self, partitions=None):
return

reqs = []
if not partitions: # commit all partitions
if partitions is None: # commit all partitions
partitions = self.offsets.keys()

for partition in partitions:
Expand Down Expand Up @@ -154,7 +154,7 @@ def pending(self, partitions=None):
Keyword Arguments:
partitions (list): list of partitions to check for, default is to check all
"""
if not partitions:
if partitions is None:
partitions = self.offsets.keys()

total = 0
Expand Down