From adeba47b6265cd58a9ae13c8c5ac30fb77996ae7 Mon Sep 17 00:00:00 2001 From: jesko Date: Sun, 24 Nov 2024 14:23:55 +0100 Subject: [PATCH] adds format check for morse unit --- refinery/units/encoding/morse.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/refinery/units/encoding/morse.py b/refinery/units/encoding/morse.py index d6421458b..0f60fa014 100644 --- a/refinery/units/encoding/morse.py +++ b/refinery/units/encoding/morse.py @@ -45,6 +45,11 @@ def __init__( ): super().__init__(language=Arg.AsOption(language, MorseLanguage)) + @classmethod + def handles(self, data: bytearray): + if re.fullmatch(BR'[-.\s]+', data, re.DOTALL): + return True + @unicoded def process(self, data: str): language: MorseLanguage = self.args.language