From 3e7f058380fc7cbe9a95e17cd991943ef6c90566 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 10 Jan 2025 09:19:55 +0100 Subject: [PATCH] Continued: - software.remove_extras() is now cached --- fba/helpers/software.py | 1 + fba/helpers/tidyup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fba/helpers/software.py b/fba/helpers/software.py index d6577e9..0c26d41 100644 --- a/fba/helpers/software.py +++ b/fba/helpers/software.py @@ -298,6 +298,7 @@ def is_relay(software: str) -> bool: logger.debug("found='%s' - EXIT!", found) return found +@lru_cache def remove_extras(software: str): logger.debug("software[%s]='%s' - CALLED!", type(software), software) if not isinstance(software, str): diff --git a/fba/helpers/tidyup.py b/fba/helpers/tidyup.py index a249926..be7503d 100644 --- a/fba/helpers/tidyup.py +++ b/fba/helpers/tidyup.py @@ -38,7 +38,7 @@ def domain(string: str) -> str: if not isinstance(string, str): raise ValueError(f"Parameter string[]='{type(string)}' is not of type 'str'") elif string == "": - raise ValueError("Parameter string is empty") + raise ValueError("Parameter 'string' is empty") # All lower-case and strip spaces out + last dot string = string.lower().strip().rstrip(".").replace("..", ".") -- 2.39.5