Skip to content

Commit 381e9d8

Browse files
committed
Clean up old linter complaints
1 parent 2ca27b2 commit 381e9d8

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

adc/consumer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def __init__(self, conf: 'ConsumerConfig') -> None:
3838
self.logger = logging.getLogger("adc-streaming.consumer")
3939
self.conf = conf
4040
self._consumer = confluent_kafka.Consumer(conf._to_confluent_kafka())
41-
# Workaround for https://github.com/confluentinc/librdkafka/issues/3753#issuecomment-1058272987.
41+
# Workaround for
42+
# https://github.com/confluentinc/librdkafka/issues/3753#issuecomment-1058272987.
4243
# FIXME: Remove once fixed upstream, or on removal of oauth_cb.
4344
self._consumer.poll(0)
4445
self._stop_event = threading.Event()
@@ -196,7 +197,7 @@ def _stream_forever(self,
196197
self.mark_done(m, asynchronous=True)
197198
yield m
198199
else:
199-
raise(confluent_kafka.KafkaException(err))
200+
raise (confluent_kafka.KafkaException(err))
200201
finally:
201202
if autocommit:
202203
self._consumer.commit(asynchronous=True)
@@ -242,7 +243,7 @@ def _stream_until_eof(self,
242243
# Done with all partitions for the topic, remove it
243244
del active_partitions[m.topic()]
244245
else:
245-
raise(confluent_kafka.KafkaException(err))
246+
raise (confluent_kafka.KafkaException(err))
246247
finally:
247248
if autocommit:
248249
self._consumer.commit(asynchronous=True)

adc/producer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def __init__(self, conf: 'ProducerConfig') -> None:
2727
self.conf = conf
2828
self.logger.debug(f"connecting to producer with config {conf._to_confluent_kafka()}")
2929
self._producer = confluent_kafka.Producer(conf._to_confluent_kafka())
30-
# Workaround for https://github.com/confluentinc/librdkafka/issues/3753#issuecomment-1058272987.
30+
# Workaround for
31+
# https://github.com/confluentinc/librdkafka/issues/3753#issuecomment-1058272987.
3132
# FIXME: Remove once fixed upstream, or on removal of oauth_cb.
3233
self._producer.poll(0)
3334

tests/test_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from adc.auth import SASLAuth, SASLMethod
3+
from adc.auth import SASLAuth
44

55

66
@pytest.mark.parametrize('auth,expected_config', [

tests/test_kafka_integration.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import tempfile
33
import time
44
import unittest
5-
from datetime import datetime, timedelta, timezone
5+
from datetime import datetime, timedelta
66
from typing import List
77

88
import docker
@@ -283,7 +283,7 @@ def test_consume_from_datetime(self):
283283
"message 1",
284284
"message 2",
285285
"message 3",
286-
])
286+
])
287287
# Wait a while, write, and wait some more
288288
time.sleep(2)
289289
client_middle_time = datetime.now()
@@ -390,8 +390,8 @@ def test_multi_topic_handling(self):
390390
topic=None,
391391
auth=self.kafka.auth,
392392
))
393-
for i in range(0,8):
394-
producer.write(str(i), topic=topics[i%2])
393+
for i in range(0, 8):
394+
producer.write(str(i), topic=topics[i % 2])
395395
producer.flush()
396396
logger.info("messages sent")
397397

@@ -403,12 +403,12 @@ def test_multi_topic_handling(self):
403403
))
404404
consumer.subscribe(topics)
405405
stream = consumer.stream()
406-
total_messages = 0;
406+
total_messages = 0
407407
for msg in stream:
408408
if msg.error() is not None:
409409
raise Exception(msg.error())
410410
idx = int(msg.value())
411-
self.assertEqual(msg.topic(), topics[idx%2])
411+
self.assertEqual(msg.topic(), topics[idx % 2])
412412
total_messages += 1
413413
if total_messages == 8:
414414
break
@@ -554,7 +554,7 @@ def get_or_create_container(self):
554554
# these tests cannot run if there is already an instance of Kafka running on
555555
# the same host.
556556
ports={"9092/tcp": 9092},
557-
command=["/root/runServer","--advertisedListener","SASL_SSL://localhost:9092"],
557+
command=["/root/runServer", "--advertisedListener", "SASL_SSL://localhost:9092"],
558558
)
559559

560560
def get_or_create_docker_network(self):

0 commit comments

Comments
 (0)