fix: correct 9 inaccurate type hints

- get_password_hash() -> str | None (not bool, returns hash or None)
- parse_cookie() -> str | None (not None, returns cookie value)
- Session.__init__ session_id: str (not int, uuid hex)
- Session.__init__ project_id: str (not int)
- Session.__init__ **kwargs (remove incorrect dict annotation)
- Session.load() remove -> None (returns Session | None)
- import_cli_session session_id: str (not int)
- sync_session_start session_id: str (not int)
- sync_session_usage session_id: str (not int)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nathan Esquenazi
2026-04-04 23:54:58 -07:00
parent 4d333acbbc
commit 74fcd2e0ab
3 changed files with 9 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ def _hash_password(password):
return dk.hex()
def get_password_hash() -> bool:
def get_password_hash() -> str | None:
"""Return the active password hash, or None if auth is disabled.
Priority: env var > settings.json."""
env_pw = os.getenv('HERMES_WEBUI_PASSWORD', '').strip()
@@ -110,7 +110,7 @@ def invalidate_session(cookie_value) -> None:
_sessions.pop(token, None)
def parse_cookie(handler) -> None:
def parse_cookie(handler) -> str | None:
"""Extract the auth cookie from the request headers."""
cookie_header = handler.headers.get('Cookie', '')
if not cookie_header: