Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
lpsinger committed May 15, 2024
1 parent c59a3ba commit 8d0429a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions gcn_classic_to_json/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ def kafka_delivered_cb(err, msg):


def run():
binary_topic_prefix = 'gcn.classic.binary.'
json_topic_prefix = 'gcn.classic.json.'
binary_topic_prefix = "gcn.classic.binary."
json_topic_prefix = "gcn.classic.json."
int4 = struct.Struct("!l")
funcs = {
key: value
for key, value in notices.__dict__.items()
if key.isupper()
}
funcs = {key: value for key, value in notices.__dict__.items() if key.isupper()}

log.info("Creating consumer")
config = gcn_kafka.config_from_env()
Expand All @@ -54,7 +50,7 @@ def run():
else:
log.info("topic %s: got message", topic)
ints = int4.iter_unpack(message.value())
key = topic[len(binary_topic_prefix):]
key = topic[len(binary_topic_prefix) :]
func = funcs[key]
json_data = json.dumps(func(*ints))
producer.produce(json_topic_prefix + key, json_data)

0 comments on commit 8d0429a

Please sign in to comment.