diff --git a/dangerzone/container_utils.py b/dangerzone/container_utils.py index eec2839..c4a4711 100644 --- a/dangerzone/container_utils.py +++ b/dangerzone/container_utils.py @@ -5,7 +5,7 @@ import platform import shutil import subprocess from pathlib import Path -from typing import IO, Callable, List, Optional, Tuple +from typing import IO, Callable, Iterable, List, Optional, Tuple from . import errors from .settings import Settings @@ -86,7 +86,7 @@ def get_runtime_version(runtime: Optional[Runtime] = None) -> Tuple[int, int]: cmd, capture_output=True, check=True, - ).stdout.decode() + ).stdout.decode() # type:ignore[attr-defined] except Exception as e: msg = f"Could not get the version of the {runtime.name.capitalize()} tool: {e}" raise RuntimeError(msg) from e @@ -142,7 +142,7 @@ def add_image_tag(image_id: str, new_tag: str) -> None: def delete_image_digests( - digests: List[str], container_name: Optional[str] = None + digests: Iterable[str], container_name: Optional[str] = None ) -> None: """Delete a Dangerzone image by its id.""" container_name = container_name or expected_image_name() @@ -242,7 +242,7 @@ def get_image_id_by_digest(digest: str) -> str: log.debug(" ".join(cmd)) process = subprocess_run(cmd, check=True, capture_output=True) # In case we have multiple lines, we only want the first one. - return process.stdout.decode().strip().split("\n")[0] + return process.stdout.decode().strip().split("\n")[0] # type:ignore[attr-defined] def expected_image_name() -> str: @@ -292,7 +292,7 @@ def get_local_image_digest(image: Optional[str] = None) -> str: capture_output=True, check=True, ) - lines = result.stdout.decode().strip().split("\n") + lines = result.stdout.decode().strip().split("\n") # type:ignore[attr-defined] if len(lines) != 1: raise errors.MultipleImagesFoundException( f"Expected a single line of output, got {len(lines)} lines" diff --git a/dangerzone/gui/main_window.py b/dangerzone/gui/main_window.py index 3fe84bb..da618be 100644 --- a/dangerzone/gui/main_window.py +++ b/dangerzone/gui/main_window.py @@ -529,7 +529,7 @@ class WaitingWidgetContainer(WaitingWidget): # - "install_container" def _create_button( - self, label: str, event: QtCore.Signal, hide: bool = False + self, label: str, event: Callable, hide: bool = False ) -> QtWidgets.QWidget: button = QtWidgets.QPushButton(label) button.clicked.connect(event)