From f715e46155241041165f6365fd589d77ca77fe30 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 4 May 2019 23:28:51 +0100 Subject: [PATCH] Stop using prevent_highlight. it ruins terminals on OS X --- modules/coins.py | 4 ++-- modules/ducks.py | 6 ++---- modules/words.py | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/coins.py b/modules/coins.py index f7ae4e30..239050b5 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -158,8 +158,8 @@ class Module(ModuleManager.BaseModule): :help: Show the top 10 richest users """ top_10 = utils.top_10(self._all_coins(event["server"]), - convert_key=lambda nickname: utils.prevent_highlight( - event["server"].get_user(nickname).nickname), + convert_key=lambda nickname: + event["server"].get_user(nickname).nickname, value_format=lambda value: self._coin_str_human(value)) event["stdout"].write("Richest users: %s" % ", ".join(top_10)) diff --git a/modules/ducks.py b/modules/ducks.py index d252a4a9..8777e4a4 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -114,10 +114,8 @@ class Module(ModuleManager.BaseModule): user_stats[nickname] = 0 user_stats[nickname] += value - nick_func = lambda nickname: utils.prevent_highlight( - server.get_user(nickname).nickname) - - top_10 = utils.top_10(user_stats, convert_key=nick_func) + top_10 = utils.top_10(user_stats, + convert_key=lambda nickname: server.get_user(nickname).nickname) return "Top duck %s%s: %s" % (description, channel_query_str, ", ".join(top_10)) diff --git a/modules/words.py b/modules/words.py index e330f42c..c454bd0a 100644 --- a/modules/words.py +++ b/modules/words.py @@ -102,8 +102,8 @@ class Module(ModuleManager.BaseModule): items = [(word_user[0], word_user[1]) for word_user in word_users] word_users = dict(items) top_10 = utils.top_10(word_users, - convert_key=lambda nickname: utils.prevent_highlight( - event["server"].get_user(nickname).nickname)) + convert_key=lambda nickname: + event["server"].get_user(nickname).nickname) event["stdout"].write("Top '%s' users: %s" % (word, ", ".join(top_10))) else: @@ -130,7 +130,7 @@ class Module(ModuleManager.BaseModule): user_words[nickname] += word_count top_10 = utils.top_10(user_words, - convert_key=lambda nickname: utils.prevent_highlight( - event["server"].get_user(nickname).nickname)) + convert_key=lambda nickname: + event["server"].get_user(nickname).nickname) event["stdout"].write("wordiest%s: %s" % ( word_prefix, ", ".join(top_10)))