Skip to content

Commit 3e6f03f

Browse files
Fix linting errors on client.py
1 parent 2a314e6 commit 3e6f03f

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

analytics/client.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
try:
1616
import queue
17-
except:
17+
except ImportError:
1818
import Queue as queue
1919

2020

@@ -48,17 +48,20 @@ def __init__(self, write_key=None, host=None, debug=False,
4848
self.consumers = None
4949
else:
5050
# On program exit, allow the consumer thread to exit cleanly.
51-
# This prevents exceptions and a messy shutdown when the interpreter is
52-
# destroyed before the daemon thread finishes execution. However, it
53-
# is *not* the same as flushing the queue! To guarantee all messages
54-
# have been delivered, you'll still need to call flush().
51+
# This prevents exceptions and a messy shutdown when the
52+
# interpreter is destroyed before the daemon thread finishes
53+
# execution. However, it is *not* the same as flushing the queue!
54+
# To guarantee all messages have been delivered, you'll still need
55+
# to call flush().
5556
if send:
5657
atexit.register(self.join)
5758
for n in range(thread):
5859
self.consumers = []
59-
consumer = Consumer(self.queue, write_key, host=host, on_error=on_error,
60-
flush_at=flush_at, flush_interval=flush_interval,
61-
gzip=gzip, retries=max_retries, timeout=timeout)
60+
consumer = Consumer(
61+
self.queue, write_key, host=host, on_error=on_error,
62+
flush_at=flush_at, flush_interval=flush_interval,
63+
gzip=gzip, retries=max_retries, timeout=timeout,
64+
)
6265
self.consumers.append(consumer)
6366

6467
# if we've disabled sending, just don't start the consumer
@@ -87,7 +90,8 @@ def identify(self, user_id=None, traits=None, context=None, timestamp=None,
8790
return self._enqueue(msg)
8891

8992
def track(self, user_id=None, event=None, properties=None, context=None,
90-
timestamp=None, anonymous_id=None, integrations=None, message_id=None):
93+
timestamp=None, anonymous_id=None, integrations=None,
94+
message_id=None):
9195
properties = properties or {}
9296
context = context or {}
9397
integrations = integrations or {}
@@ -129,7 +133,8 @@ def alias(self, previous_id=None, user_id=None, context=None,
129133
return self._enqueue(msg)
130134

131135
def group(self, user_id=None, group_id=None, traits=None, context=None,
132-
timestamp=None, anonymous_id=None, integrations=None, message_id=None):
136+
timestamp=None, anonymous_id=None, integrations=None,
137+
message_id=None):
133138
traits = traits or {}
134139
context = context or {}
135140
integrations = integrations or {}
@@ -266,7 +271,9 @@ def flush(self):
266271
self.log.debug('successfully flushed about %s items.', size)
267272

268273
def join(self):
269-
"""Ends the consumer thread once the queue is empty. Blocks execution until finished"""
274+
"""Ends the consumer thread once the queue is empty.
275+
Blocks execution until finished
276+
"""
270277
for consumer in self.consumers:
271278
consumer.pause()
272279
try:

0 commit comments

Comments
 (0)