From: Roland Häder Date: Fri, 10 Jan 2025 08:19:55 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3e7f058380fc7cbe9a95e17cd991943ef6c90566;p=fba.git Continued: - software.remove_extras() is now cached --- 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("..", ".")