From: Roland Häder Date: Thu, 30 Nov 2023 00:18:08 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2403b1d3ef9991545bb21d15c32376adda86d419;p=fba.git Continued: - fixed copy-paste mistakes in debug messages --- diff --git a/fba/helpers/domain.py b/fba/helpers/domain.py index da553d2..5f5e15a 100644 --- a/fba/helpers/domain.py +++ b/fba/helpers/domain.py @@ -48,7 +48,7 @@ def raise_on(domain: str): elif domain == "": raise ValueError("Parameter 'domain' is empty") elif domain in _cache["raise_on"]: - logger.debug("Returning cached is_found='%s' - EXIT!", _cache["raise_on"][domain]) + logger.debug("Returning cached raised_on='%s' - EXIT!", _cache["raise_on"][domain]) return _cache["raise_on"][domain] elif domain.lower() != domain: raise ValueError(f"Parameter domain='{domain}' must be all lower-case") @@ -75,7 +75,7 @@ def is_in_url(domain: str, url: str) -> bool: elif url == "": raise ValueError("Parameter 'url' is empty") elif domain + url in _cache["is_in_url"]: - logger.debug("Returning cached is_found='%s' - EXIT!", _cache["is_in_url"][domain + url]) + logger.debug("Returning cached is_in_url='%s' - EXIT!", _cache["is_in_url"][domain + url]) return _cache["is_in_url"][domain + url] punycode = domain.encode("idna").decode("utf-8") diff --git a/fba/helpers/software.py b/fba/helpers/software.py index 3eca4fa..58404be 100644 --- a/fba/helpers/software.py +++ b/fba/helpers/software.py @@ -43,7 +43,7 @@ def alias(software: str) -> str: elif software == "": raise ValueError("Parameter 'software' is empty") elif software in _cache["alias"]: - logger.debug("Returning cached value='%s' for function 'alias' - EXIT!", _cache["alias"][software]) + logger.debug("Returning cached alias='%s' - EXIT!", _cache["alias"][software]) return _cache["alias"][software] key = software @@ -169,6 +169,7 @@ def strip_hosted_on(software: str) -> str: def strip_powered_by(software: str) -> str: logger.debug("software='%s' - CALLED!", software) + if not isinstance(software, str): raise ValueError(f"Parameter software[]='{type(software)}' is not of type 'str'") elif software == "": @@ -218,8 +219,10 @@ def strip_until(software: str, until: str) -> str: def is_relay(software: str) -> bool: logger.debug("software='%s'- CALLED!", software) - if not isinstance(software, str) and software is not None: + if not isinstance(software, str): raise ValueError(f"software[]='{type(software)}' is not type 'str'") + elif software == "": + raise ValueError("Parameter 'software' is empty") found = software in relays