about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-10 04:14:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-10 04:14:32 -0700
commit0c8f8658614274ddfed3b30051c4840a97132a98 (patch)
treec40c054bfa933e19bcae20b74e851406077a64d8
parent4f236749a2374914411005d18106a945815b6bea (diff)
downloadmu-0c8f8658614274ddfed3b30051c4840a97132a98.tar.gz
.
-rw-r--r--browse_slack/convert_slack.py9
1 files changed, 1 insertions, 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: