From: Antonio Ospite Date: Mon, 14 Dec 2015 17:31:44 +0000 (+0100) Subject: MorseTranslator.py: remove unneeded code in sanitize_morse() X-Git-Url: https://git.ao2.it/SaveMySugar/python3-savemysugar.git/commitdiff_plain/8fc5baa85b3b0754f2999c065d06c78439c6fd4e?ds=inline 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. --- 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)