From 0c8f8658614274ddfed3b30051c4840a97132a98 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 10 Aug 2021 04:14:32 -0700 Subject: . --- browse_slack/convert_slack.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/browse_slack/convert_slack.py b/browse_slack/convert_slack.py index db53cebf..12785b6b 100644 --- a/browse_slack/convert_slack.py +++ b/browse_slack/convert_slack.py @@ -32,8 +32,6 @@ from os import listdir from os.path import isfile, join, basename, splitext from urllib.parse import urlparse -channels = {} - user_id = {} # name -> index items = [] @@ -59,11 +57,7 @@ def load_users(): user_id[user['id']] = length length += 1 -def load_channels(): - stderr.write('loading channels..\n') - with open('channels.json') as f: - for channel in json.load(f): - channels[channel['id']] = channel['name'] +channels = {channel['id']: channel['name'] for channel in json.load(open('channels.json'))} def contents(filename): with open(filename) as f: @@ -92,7 +86,6 @@ def filenames(dir): if isfile(result): yield result -load_channels() load_users() for dir in channels.values(): try: -- cgit 1.4.1-2-gfad0