From aa7467f8389d2f74b4004042319461ebe224403a Mon Sep 17 00:00:00 2001 From: Danar Prakosa Date: Thu, 16 Apr 2026 17:46:12 +1000 Subject: [PATCH 1/3] chore: fix mypy warnings for base_debugger.py --- debugger/src/debugger/base_debugger.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debugger/src/debugger/base_debugger.py b/debugger/src/debugger/base_debugger.py index e2c3130c1..1e14be200 100644 --- a/debugger/src/debugger/base_debugger.py +++ b/debugger/src/debugger/base_debugger.py @@ -54,19 +54,19 @@ async def init(self, executable_path: str) -> None: os.ttyname(self.fd_slave), "--args", str(executable_path), - stdin=PIPE, + stdin=PIPE, # process can't be None stdout=PIPE, ) create_task(self._stdout_dispatch()) create_task(self._inf_dispatch()) self._did_init = True - return self async def deinit(self) -> None: if not self._did_init: return + assert self.process.stdin is not None self.process.stdin.write_eof() await self.process.stdin.drain() await self.process.wait() @@ -80,6 +80,7 @@ async def deinit(self) -> None: async def run_command(self, command: str): chan = self._inflight_cmds.make_chan() + assert self.process.stdin is not None self.process.stdin.write(f"{chan}{command}\n".encode()) await self.process.stdin.drain() @@ -120,6 +121,7 @@ def on_inf(self, func: Callable[[str], None]): self._inferior_handler = _asyncify(func) async def _stdout_dispatch(self) -> None: + assert self.process.stdout is not None while line := await self.process.stdout.readline(): for resp in mi.parse(line): match resp: From 5520e8a6fe7577cb8223f68dfcad5c99edcc5e06 Mon Sep 17 00:00:00 2001 From: Danar Prakosa Date: Sun, 19 Apr 2026 21:17:24 +1000 Subject: [PATCH 2/3] docs: clarify comment --- debugger/src/debugger/base_debugger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debugger/src/debugger/base_debugger.py b/debugger/src/debugger/base_debugger.py index 1e14be200..41f900cec 100644 --- a/debugger/src/debugger/base_debugger.py +++ b/debugger/src/debugger/base_debugger.py @@ -54,7 +54,9 @@ async def init(self, executable_path: str) -> None: os.ttyname(self.fd_slave), "--args", str(executable_path), - stdin=PIPE, # process can't be None + # use pipes so Process.stdin and Process.stdout are not None + # https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process.stdin + stdin=PIPE, stdout=PIPE, ) From a991c365f4b11984e103dd2d67e329843e0b68f4 Mon Sep 17 00:00:00 2001 From: Danar Prakosa Date: Sun, 19 Apr 2026 21:27:09 +1000 Subject: [PATCH 3/3] chore: add mypy config file --- debugger/pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 debugger/pyproject.toml diff --git a/debugger/pyproject.toml b/debugger/pyproject.toml new file mode 100644 index 000000000..210b3546d --- /dev/null +++ b/debugger/pyproject.toml @@ -0,0 +1,2 @@ +[tool.mypy] +check_untyped_defs = true