MorseTranslator.py: remove unneeded code in sanitize_morse()
authorAntonio Ospite <ao2@ao2.it>
Mon, 14 Dec 2015 17:31:44 +0000 (18:31 +0100)
committerAntonio Ospite <ao2@ao2.it>
Mon, 14 Dec 2015 17:31:44 +0000 (18:31 +0100)
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

index 630aba7..d52902d 100755 (executable)
@@ -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)