Skip to content

Commit

Permalink
chore: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
cfm committed Apr 3, 2024
1 parent 69cd983 commit a37a898
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions client/securedrop_client/config.py
Expand Up @@ -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
Expand All @@ -24,7 +25,7 @@ def try_qubesdb():

finally:
if db:
db.close()
db.close() # type: ignore[union-attr]


class Config:
Expand Down
3 changes: 2 additions & 1 deletion client/securedrop_client/crypto.py
Expand Up @@ -21,6 +21,7 @@
import subprocess
import tempfile
from pathlib import Path
from typing import Any

from sqlalchemy.orm import scoped_session

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a37a898

Please sign in to comment.