From a6580e6f7dd0dd564f32e4ed4621934f1bb180d1 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Thu, 19 Oct 2023 14:23:52 +0100 Subject: [PATCH] Fix typing issues --- data_safe_haven/external/api/azure_cli.py | 9 +++++---- data_safe_haven/infrastructure/stack_manager.py | 5 +++-- typings/typer/__init__.pyi | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/data_safe_haven/external/api/azure_cli.py b/data_safe_haven/external/api/azure_cli.py index 8523f5a5fe..7ff6b09de7 100644 --- a/data_safe_haven/external/api/azure_cli.py +++ b/data_safe_haven/external/api/azure_cli.py @@ -22,15 +22,16 @@ class AzureCliAccount: class AzureCli: """Interface to the Azure CLI""" - def __init__(self): + def __init__(self) -> None: self.logger = LoggingSingleton() - self.path = which("az") - if self.path is None: + path = which("az") + if path is None: msg = "Unable to find Azure CLI executable in your path.\nPlease ensure that Azure CLI is installed" raise DataSafeHavenAzureError(msg) + self.path = path - self._account = None + self._account: AzureCliAccount | None = None @property def account(self) -> AzureCliAccount: diff --git a/data_safe_haven/infrastructure/stack_manager.py b/data_safe_haven/infrastructure/stack_manager.py index a05a9abbd8..92f26822af 100644 --- a/data_safe_haven/infrastructure/stack_manager.py +++ b/data_safe_haven/infrastructure/stack_manager.py @@ -27,10 +27,11 @@ def __init__(self, config: Config): self.cfg = config self.env_: dict[str, Any] | None = None self.logger = LoggingSingleton() - self.path = which("pulumi") - if self.path is None: + path = which("pulumi") + if path is None: msg = "Unable to find Pulumi CLI executable in your path.\nPlease ensure that Pulumi is installed" raise DataSafeHavenPulumiError(msg) + self.path = path # Ensure Azure CLI account is correct # This will be needed to populate env diff --git a/typings/typer/__init__.pyi b/typings/typer/__init__.pyi index 2bb704a21a..16e679947b 100644 --- a/typings/typer/__init__.pyi +++ b/typings/typer/__init__.pyi @@ -1,4 +1,5 @@ from click.exceptions import BadParameter, Exit +from click.termui import confirm from .main import Typer from .params import Argument @@ -10,4 +11,5 @@ __all__ = [ "Exit", "Option", "Typer", + "confirm", ]