From d1afa040c40b7ffa6870715f319c640d1f558bf7 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Sun, 27 Jul 2025 23:56:35 +0200 Subject: [PATCH] Add type annotations --- src/solidlsp/language_servers/common.py | 4 ++-- src/solidlsp/ls_exceptions.py | 4 ++-- src/solidlsp/ls_utils.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/solidlsp/language_servers/common.py b/src/solidlsp/language_servers/common.py index c9ff085c..b3f4529a 100644 --- a/src/solidlsp/language_servers/common.py +++ b/src/solidlsp/language_servers/common.py @@ -78,7 +78,7 @@ class RuntimeDependencyCollection: else: import pwd - kwargs["user"] = pwd.getpwuid(os.getuid()).pw_name + kwargs["user"] = pwd.getpwuid(os.getuid()).pw_name # type: ignore log.info("Running command '%s' in '%s'", command, cwd) completed_process = subprocess.run( command, @@ -88,7 +88,7 @@ class RuntimeDependencyCollection: stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs, - ) + ) # type: ignore if completed_process.returncode != 0: log.warning("Command '%s' failed with return code %d", command, completed_process.returncode) log.warning("Command output:\n%s", completed_process.stdout) diff --git a/src/solidlsp/ls_exceptions.py b/src/solidlsp/ls_exceptions.py index 7c03cfe5..ac5a42a7 100644 --- a/src/solidlsp/ls_exceptions.py +++ b/src/solidlsp/ls_exceptions.py @@ -4,7 +4,7 @@ This module contains the exceptions raised by the framework. class SolidLSPException(Exception): - def __init__(self, message: str, cause: Exception | None = None): + def __init__(self, message: str, cause: Exception | None = None) -> None: """ Initializes the exception with the given message. @@ -17,7 +17,7 @@ class SolidLSPException(Exception): self.cause = cause super().__init__(message) - def is_language_server_terminated(self): + def is_language_server_terminated(self) -> bool: """ :return: True if the exception is caused by the language server having terminated as indicated by the causing exception being an instance of LanguageServerTerminatedException. diff --git a/src/solidlsp/ls_utils.py b/src/solidlsp/ls_utils.py index d25e0848..1dee3c25 100644 --- a/src/solidlsp/ls_utils.py +++ b/src/solidlsp/ls_utils.py @@ -253,7 +253,7 @@ class PlatformId(str, Enum): LINUX_MUSL_x64 = "linux-musl-x64" LINUX_MUSL_arm64 = "linux-musl-arm64" - def is_windows(self): + def is_windows(self) -> bool: return self.value.startswith("win")