diff --git a/client/securedrop_client/config.py b/client/securedrop_client/config.py index 4acf82f65..3033fed7c 100644 --- a/client/securedrop_client/config.py +++ b/client/securedrop_client/config.py @@ -2,16 +2,17 @@ import logging import os from contextlib import contextmanager +from typing import Generator, Union logger = logging.getLogger(__name__) @contextmanager -def try_qubesdb(): +def try_qubesdb() -> Generator: """Minimal context manager around QubesDB() → QubesDB.close() when available.""" - db = False + db: Union[bool, "QubesDB"] = False try: from qubesdb import QubesDB @@ -24,7 +25,7 @@ def try_qubesdb(): finally: if db: - db.close() + db.close() # type: ignore[union-attr] class Config: diff --git a/client/securedrop_client/crypto.py b/client/securedrop_client/crypto.py index a37a48789..a715df17c 100644 --- a/client/securedrop_client/crypto.py +++ b/client/securedrop_client/crypto.py @@ -21,6 +21,7 @@ import subprocess import tempfile from pathlib import Path +from typing import Any from sqlalchemy.orm import scoped_session @@ -86,7 +87,7 @@ def __init__(self, sdc_home: str, session_maker: scoped_session, is_qubes: bool) self.is_qubes = is_qubes self.session_maker = session_maker - config = Config.load() + config: Any = Config.load() self.journalist_key_fingerprint = config.journalist_key_fingerprint def decrypt_submission_or_reply(