python3: Fix usage of .keys()/.values() to handle iterators.

This fixes the places where we use the result of .keys(), .items(),
and .values() that wouldn't work with an iterator to wrap them with
list().
This commit is contained in:
Tim Abbott
2016-01-24 16:27:18 -08:00
parent f5de149976
commit 5bacda3662
16 changed files with 28 additions and 30 deletions

View File

@@ -53,10 +53,10 @@ def gather_hot_conversations(user_profile, stream_messages):
user_message.message.sender.full_name)
conversation_length[key] += 1
diversity_list = conversation_diversity.items()
diversity_list = list(conversation_diversity.items())
diversity_list.sort(key=lambda entry: len(entry[1]), reverse=True)
length_list = conversation_length.items()
length_list = list(conversation_length.items())
length_list.sort(key=lambda entry: entry[1], reverse=True)
# Get up to the 4 best conversations from the diversity list