diff --git a/bots/summarize_stream.py b/bots/summarize_stream.py index 5095946..af7636f 100644 --- a/bots/summarize_stream.py +++ b/bots/summarize_stream.py @@ -64,16 +64,14 @@ def generate_support_stats(): analyze_messages(msgs, word_count, email_count) if True: - words = word_count.keys() - words = [w for w in words if word_count[w] >= 10] - words = [w for w in words if len(w) >= 5] + words = [w for w in word_count.keys() if word_count[w] >= 10 and len(w) >= 5] words = sorted(words, key=lambda w: word_count[w], reverse=True) for word in words: print(word, word_count[word]) if False: - emails = email_count.keys() - emails = sorted(emails, key=lambda w: email_count[w], reverse=True) + emails = sorted(list(email_count.keys()), + key=lambda w: email_count[w], reverse=True) for email in emails: print(email, email_count[email]) diff --git a/integrations/perforce/git_p4.py b/integrations/perforce/git_p4.py index dec6a3e..c40c9c2 100644 --- a/integrations/perforce/git_p4.py +++ b/integrations/perforce/git_p4.py @@ -2347,7 +2347,7 @@ class P4Sync(Command, P4UserMap): self.labels[newestChange] = [output, revisions] if self.verbose: - print("Label changes: %s" % self.labels.keys()) + print("Label changes: %s" % (list(self.labels.keys()),)) # Import p4 labels as git tags. A direct mapping does not # exist, so assume that if all the files are at the same revision @@ -2780,7 +2780,7 @@ class P4Sync(Command, P4UserMap): if short in branches: self.p4BranchesInGit = [ short ] else: - self.p4BranchesInGit = branches.keys() + self.p4BranchesInGit = list(branches.keys()) if len(self.p4BranchesInGit) > 1: if not self.silent: @@ -3215,7 +3215,7 @@ commands = { def main(): if len(sys.argv[1:]) == 0: - printUsage(commands.keys()) + printUsage(list(commands.keys())) sys.exit(2) cmdName = sys.argv[1] @@ -3225,7 +3225,7 @@ def main(): except KeyError: print("unknown command %s" % cmdName) print("") - printUsage(commands.keys()) + printUsage(list(commands.keys())) sys.exit(2) options = cmd.options