From 8298e059646d06797c1dc296ba7199c3615a7749 Mon Sep 17 00:00:00 2001 From: Ian Thomas Date: Mon, 18 Nov 2024 11:44:37 +0000 Subject: [PATCH] Add type to supported_features --- ipykernel/kernelbase.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ipykernel/kernelbase.py b/ipykernel/kernelbase.py index 5e6c2013..4205b1c5 100644 --- a/ipykernel/kernelbase.py +++ b/ipykernel/kernelbase.py @@ -880,24 +880,23 @@ async def connect_request(self, socket, ident, parent): @property def kernel_info(self): - info = { + from .debugger import _is_debugpy_available + + supported_features: list[str] = [] + if self._supports_kernel_subshells: + supported_features.append("kernel subshells") + if _is_debugpy_available: + supported_features.append("debugger") + + return { "protocol_version": kernel_protocol_version, "implementation": self.implementation, "implementation_version": self.implementation_version, "language_info": self.language_info, "banner": self.banner, "help_links": self.help_links, - "supported_features": [], + "supported_features": supported_features } - if self._supports_kernel_subshells: - info["supported_features"] = ["kernel subshells"] - - from .debugger import _is_debugpy_available - - if _is_debugpy_available: - info["supported_features"].append("debugger") - - return info async def kernel_info_request(self, socket, ident, parent): """Handle a kernel info request."""