From eeadac5aa07a33f27878dc66c6f047e37295069f Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 10 Oct 2018 18:09:23 -0400 Subject: [PATCH] fix for PR comments. also turns DEBUG off --- Code/irc/acronymFinder.py | 14 ++++++-------- Code/irc/dict_puzzle.py | 3 +-- Code/irc/tildebot.py | 8 ++++---- Code/irc/tildejackpot.txt | 1 - Code/irc/tildescores.txt | 1 - Code/irc/topicscores.txt | 1 - Code/python/chatbesties.py | 5 ++--- Code/python/chatstats.py | 5 ++--- 8 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 Code/irc/tildejackpot.txt diff --git a/Code/irc/acronymFinder.py b/Code/irc/acronymFinder.py index 5ed5f78..9f018d3 100644 --- a/Code/irc/acronymFinder.py +++ b/Code/irc/acronymFinder.py @@ -9,10 +9,8 @@ dict = "/usr/share/dict/american-english" def get_acros(word, silly, short): acros = [] - url = "http://www.stands4.com/services/v2/abbr.php?uid=%s&tokenid=%s&term=%s" % ( - userId, - token, - word, + url = "http://www.stands4.com/services/v2/abbr.php?uid={}&tokenid={}&term={}".format( + userId, token, word ) soup = BeautifulSoup(urllib.urlopen(url).read(), "html5lib") results = soup.find_all("result") @@ -56,8 +54,7 @@ def get_acros(word, silly, short): else: acros.append( ( - '%s: "%s" (%s, score: %s)' - % ( + '{}: "{}" ({}, score: {})'.format( d["term"], d["definition"], ", ".join(d["categories"]), @@ -85,8 +82,9 @@ def get_acros(word, silly, short): else: acros.append( ( - '%s: "%s" (%s, score: %s)' - % (word.upper(), newWord, "Tilde.town Original", "0") + '{}: "{}" ({}, score: {})'.format( + word.upper(), newWord, "Tilde.town Original", "0" + ) ).encode("ascii", "ignore") ) except IndexError: diff --git a/Code/irc/dict_puzzle.py b/Code/irc/dict_puzzle.py index 85459eb..1bef24d 100644 --- a/Code/irc/dict_puzzle.py +++ b/Code/irc/dict_puzzle.py @@ -50,5 +50,4 @@ def get_anagram(maxlen=6): # Ok, gotta actually check if it's a word now return any(guess == item for item in gen_wordlist()) - challenge_text = "Unscramble the following word: '{}'".format(anagram) - return [answer_checker, challenge_text] + return [answer_checker, "Unscramble the following word: '{}'".format(anagram)] diff --git a/Code/irc/tildebot.py b/Code/irc/tildebot.py index 43e0e54..ca76109 100755 --- a/Code/irc/tildebot.py +++ b/Code/irc/tildebot.py @@ -48,7 +48,7 @@ challenges = {} SCORE_FILE = "tildescores.txt" JACKPOT_FILE = "tildejackpot.txt" JACKPOT_MIN = 3 -DEBUG = True +DEBUG = False def too_recent(time1, time2): @@ -217,7 +217,7 @@ def get_prize(name, isHuman, bonus=0): jackpotfile.write(str(JACKPOT_MIN)) return [ jackpot, - "{} hit the jackpot and won **{}**".format( + "{} hit the jackpot and won **{}** tildes!".format( name, p.number_to_words(jackpot) ), ] @@ -272,7 +272,7 @@ def give_tilde(channel, user, name, time, human, bonus=0): def show_tildescore(channel, user, name): with open(SCORE_FILE, "r") as scorefile: - for idx, score in enumerate(scorefile): + for _idx, score in enumerate(scorefile): person = score.strip("\n").split("&^%") if person[0] == user: util.sendmsg( @@ -339,7 +339,7 @@ def listen(): if "" == formatted: continue - iTime, user, command, channel, messageText = formatted.split("\t") + iTime, user, _command, channel, messageText = formatted.split("\t") name = util.get_name(user) if msg.find(":!tildescore") != -1: diff --git a/Code/irc/tildejackpot.txt b/Code/irc/tildejackpot.txt deleted file mode 100644 index 9d07aa0..0000000 --- a/Code/irc/tildejackpot.txt +++ /dev/null @@ -1 +0,0 @@ -111 \ No newline at end of file diff --git a/Code/irc/tildescores.txt b/Code/irc/tildescores.txt index 8393826..8f3664b 100644 --- a/Code/irc/tildescores.txt +++ b/Code/irc/tildescores.txt @@ -122,4 +122,3 @@ x4464&^%1&^%1532028546 pounce&^%19&^%1532133325 von_&^%5&^%1532502104 livix&^%7&^%1533603142 -ben&^%28&^%1539065026 diff --git a/Code/irc/topicscores.txt b/Code/irc/topicscores.txt index 7781292..c1304b2 100644 --- a/Code/irc/topicscores.txt +++ b/Code/irc/topicscores.txt @@ -1,2 +1 @@ vilmibm&^%0&^%2 -ben&^%3&^%0 diff --git a/Code/python/chatbesties.py b/Code/python/chatbesties.py index 8a6b0d9..d21b7a2 100755 --- a/Code/python/chatbesties.py +++ b/Code/python/chatbesties.py @@ -16,9 +16,8 @@ outfile = "/home/krowbar/logs/chatBesties.json" outCircle = "/home/krowbar/logs/chatcircle.json" timePeriod = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) # 2 weeks -userData = ( - {} -) # hash keyed by "user" that contains a hash of mentioned other users with count +# hash keyed by "user" that contains a hash of mentioned other users with count +userData = {} nameFix = { "jumblesal": "jumblesale", "hardmath1": "kc", diff --git a/Code/python/chatstats.py b/Code/python/chatstats.py index bf20212..31a9a26 100755 --- a/Code/python/chatstats.py +++ b/Code/python/chatstats.py @@ -9,9 +9,8 @@ import re logfile = "/home/archangelic/irc/log" # logfile = "/home/jumblesale/Code/irc/log" outfile = "/home/krowbar/logs/chatStats.json" -userData = ( - {} -) # hash keyed by "user" that contains a start timestamp, last timestamp, last said string, chat count, letter count, and word count +# hash keyed by "user" that contains a start timestamp, last timestamp, last said string, chat count, letter count, and word count +userData = {} # also now happy emotes and sad emotes rejectRegexp = "http[s]?://|[0-9]{2}[;:][0-9]{2}" happyRegexp = ":[-]?[])}]"