mirror of https://github.com/zulip/zulip.git
slack: Lookup dir_name key in dict instead of in dict_keys.
No reason to do the lookup in O(n) when we can do it in average O(1) time complexity.
This commit is contained in:
parent
1e5c49ad82
commit
3650f19692
|
@ -636,11 +636,11 @@ def get_messages_iterator(slack_data_dir: str, added_channels: Dict[str, Any],
|
||||||
dir_name = os.path.basename(dir_path)
|
dir_name = os.path.basename(dir_path)
|
||||||
for message in messages:
|
for message in messages:
|
||||||
# To give every message the channel information
|
# To give every message the channel information
|
||||||
if dir_name in added_channels.keys():
|
if dir_name in added_channels:
|
||||||
message['channel_name'] = dir_name
|
message['channel_name'] = dir_name
|
||||||
elif dir_name in added_mpims.keys():
|
elif dir_name in added_mpims:
|
||||||
message['mpim_name'] = dir_name
|
message['mpim_name'] = dir_name
|
||||||
elif dir_name in dm_members.keys():
|
elif dir_name in dm_members:
|
||||||
message['pm_name'] = dir_name
|
message['pm_name'] = dir_name
|
||||||
messages_for_one_day += messages
|
messages_for_one_day += messages
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue