]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 13 Jul 2024 20:49:32 +0000 (22:49 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 13 Jul 2024 20:49:32 +0000 (22:49 +0200)
- annotated more functions for caching
- initialized private _config "array" (dict)

fba/helpers/blacklist.py
fba/helpers/config.py
fba/helpers/software.py

index 7273aa0bbb571254f5b093c223b2e1fce522191a..5f41ff9bf15c366157088c0be4e20db3a729f70f 100644 (file)
@@ -98,5 +98,5 @@ def is_blacklisted(domain: str) -> bool:
     return blacklisted
 
 def get_all() -> dict:
-    logger.debug("_blacklist()=%d - CALLED!", len(_blacklist))
+    logger.debug("_blacklist()=%d - EXIT!", len(_blacklist))
     return _blacklist
index 11ad9762825c9d6338df79ce40c853364a4fd9b5..091b53a0e165ae0a7aac3fb1c66e8b9f78abc233 100644 (file)
@@ -21,6 +21,10 @@ import sys
 logging.basicConfig(level=logging.INFO)
 logger = logging.getLogger(__name__)
 
+# Private configration array, DO NOT access this directly. Please invoke
+# config.get("foo") instead
+_config = {}
+
 with open("config.json") as f:
     logger.debug("Loading configuration file ...")
     _config = json.loads(f.read())
index c9c961a8eb5ac989ff4361582fc1f1611f3d1c8e..0e6d3b28ce6e1f7cf2c5818f86e65a86600750bb 100644 (file)
@@ -205,6 +205,7 @@ def alias(software: str) -> str:
     logger.debug("cleared[%s]='%s' - EXIT!", type(cleared), cleared)
     return cleared
 
+@lru_cache
 def strip_hosted_on(software: str) -> str:
     logger.debug("software='%s' - CALLED!", software)
 
@@ -229,6 +230,7 @@ def strip_hosted_on(software: str) -> str:
     logger.debug("software='%s' - EXIT!", software)
     return software
 
+@lru_cache
 def strip_powered_by(software: str) -> str:
     logger.debug("software='%s' - CALLED!", software)
 
@@ -253,6 +255,7 @@ def strip_powered_by(software: str) -> str:
     logger.debug("software='%s' - EXIT!", software)
     return software
 
+@lru_cache
 def strip_until(software: str, until: str) -> str:
     logger.debug("software='%s',until='%s' - CALLED!", software, until)