aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/kafka.py
diff options
context:
space:
mode:
authorChristian Clauss <cclauss@me.com>2021-02-09 17:44:04 +0100
committerbnewbold <bnewbold@robocracy.org>2021-02-23 15:19:48 -0800
commit537659325664b47b01c24e82cb4a0e850cd129c0 (patch)
treebb7c93162d9f586a8bec17608cf7eceb11d47cf0 /fatcat_scholar/kafka.py
parent5878aa63118388361f353ca4f2f6c49a14a58b56 (diff)
downloadfatcat-scholar-537659325664b47b01c24e82cb4a0e850cd129c0.tar.gz
fatcat-scholar-537659325664b47b01c24e82cb4a0e850cd129c0.zip
Modernize Python syntax with pyupgrade --py38-plus **/*.py
Diffstat (limited to 'fatcat_scholar/kafka.py')
-rw-r--r--fatcat_scholar/kafka.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/fatcat_scholar/kafka.py b/fatcat_scholar/kafka.py
index e71bc3d..bee2fee 100644
--- a/fatcat_scholar/kafka.py
+++ b/fatcat_scholar/kafka.py
@@ -7,7 +7,7 @@ from typing import List, Any
from confluent_kafka import Consumer, Producer, KafkaException
-class KafkaWorker(object):
+class KafkaWorker:
"""
Base class for Scholar workers which consume from Kafka topics.
@@ -69,7 +69,7 @@ class KafkaWorker(object):
@staticmethod
def _fail_fast_produce(err: Any, msg: Any) -> None:
if err is not None:
- print("Kafka producer delivery error: {}".format(err), file=sys.stderr)
+ print(f"Kafka producer delivery error: {err}", file=sys.stderr)
raise KafkaException(err)
@staticmethod
@@ -97,13 +97,13 @@ class KafkaWorker(object):
def _fail_fast_consume(err: Any, partitions: Any) -> None:
if err is not None:
- print("Kafka consumer commit error: {}".format(err), file=sys.stderr)
+ print(f"Kafka consumer commit error: {err}", file=sys.stderr)
raise KafkaException(err)
for p in partitions:
# check for partition-specific commit errors
if p.error:
print(
- "Kafka consumer commit error: {}".format(p.error),
+ f"Kafka consumer commit error: {p.error}",
file=sys.stderr,
)
raise KafkaException(p.error)