From 8fc5baa85b3b0754f2999c065d06c78439c6fd4e Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 14 Dec 2015 18:31:44 +0100 Subject: [PATCH] MorseTranslator.py: remove unneeded code in sanitize_morse() The Morse string will never contain a '|' because it would have been already replaced in a previous sanitization step. Also we don't define anywhere that '|' can act as an alternative word separator, so it should be replaced with a space just like any other invalid character. --- src/savemysugar/MorseTranslator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/savemysugar/MorseTranslator.py b/src/savemysugar/MorseTranslator.py index 630aba7..d52902d 100755 --- a/src/savemysugar/MorseTranslator.py +++ b/src/savemysugar/MorseTranslator.py @@ -161,7 +161,6 @@ class MorseTranslator(object): def sanitize_morse(self, morse): sanitized = re.sub("_", "-", morse) sanitized = re.sub(r"[^\-\.\/]", " ", sanitized) - sanitized = re.sub(r"\|", "/", sanitized) sanitized = re.sub(r"\s+", " ", sanitized) sanitized = re.sub(r"( ?/ ?)+", " / ", sanitized) sanitized = re.sub(r"^[ /]+", "", sanitized) -- 2.1.4