From 452c019b10ab9fccf07ea8857cfcd9eca7013c5d Mon Sep 17 00:00:00 2001 From: James Vega Date: Tue, 31 Aug 2010 18:52:09 -0400 Subject: [PATCH] Filter: Rename _(un)code to _(morse|unMorse)code Closes: Sf#3056753 Signed-off-by: James Vega --- plugins/Filter/plugin.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/Filter/plugin.py b/plugins/Filter/plugin.py index cd0905b08..23b6277ff 100644 --- a/plugins/Filter/plugin.py +++ b/plugins/Filter/plugin.py @@ -265,7 +265,7 @@ class Filter(callbacks.Plugin): irc.reply(s) scramble = wrap(scramble, ['text']) - _code = { + _morseCode = { "A" : ".-", "B" : "-...", "C" : "-.-.", @@ -313,7 +313,7 @@ class Filter(callbacks.Plugin): "@" : ".--.-.", "=" : "-...-" } - _revcode = dict([(y, x) for (x, y) in _code.items()]) + _revMorseCode = dict([(y, x) for (x, y) in _morseCode.items()]) _unmorsere = re.compile('([.-]+)') def unmorse(self, irc, msg, args, text): """ @@ -323,7 +323,7 @@ class Filter(callbacks.Plugin): text = text.replace('_', '-') def morseToLetter(m): s = m.group(1) - return self._revcode.get(s, s) + return self._revMorseCode.get(s, s) text = self._unmorsere.sub(morseToLetter, text) text = text.replace(' ', '\x00') text = text.replace(' ', '') @@ -338,10 +338,7 @@ class Filter(callbacks.Plugin): """ L = [] for c in text.upper(): - if c in self._code: - L.append(self._code[c]) - else: - L.append(c) + L.append(self._morseCode.get(c, c)) irc.reply(' '.join(L)) morse = wrap(morse, ['text'])