]> git.mar77i.info Git - hublib/blobdiff - hub/utils.py
add a bunch of typehints
[hublib] / hub / utils.py
index 3e91e239b6ad753beea77fcd90e22ab3e313cab1..d888f1588a19b74a65559a6869b54c3162762b7c 100644 (file)
@@ -1,12 +1,14 @@
 from jinja2_simple_tags import StandaloneTag
 
-from .static import TreeFileApp
+from .static import StaticTemplateFile, TreeFileApp
 
 class StaticTag(StandaloneTag):
     tags = {"static"}
 
     @staticmethod
-    def get_hubapp(static_file, hubapp):
+    def get_hubapp(
+        static_file: StaticTemplateFile, hubapp: str | TreeFileApp | None
+    ) -> TreeFileApp:
         h = static_file.hubapp
         if hubapp == "root":
             return h.root
@@ -42,4 +44,4 @@ def get_redis_pass(redis_conf: str) -> str:
         for line in fh:
             if line.startswith(prefix):
                 return line[len(prefix) :].rstrip()
-    return None
+    raise ValueError("No redis password found")