From 824e9781b237feba41a061a13b6a10075c8d7958 Mon Sep 17 00:00:00 2001 From: phi Date: Sat, 2 Mar 2024 04:27:06 +0900 Subject: [PATCH] fix: typed --- src/timeout_executor/executor.py | 2 +- src/timeout_executor/result.py | 2 +- src/timeout_executor/terminate.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/timeout_executor/executor.py b/src/timeout_executor/executor.py index 3928f1e..06a003f 100644 --- a/src/timeout_executor/executor.py +++ b/src/timeout_executor/executor.py @@ -116,7 +116,7 @@ def _init_process( input_file: Path | anyio.Path, output_file: Path | anyio.Path, stacklevel: int = 2, - ) -> AsyncResult: + ) -> AsyncResult[T]: logger.debug("%r before init process", self, stacklevel=stacklevel) executor_args_builder = partial( self._create_executor_args, input_file, output_file diff --git a/src/timeout_executor/result.py b/src/timeout_executor/result.py index 963f7a0..4b9a091 100644 --- a/src/timeout_executor/result.py +++ b/src/timeout_executor/result.py @@ -143,7 +143,7 @@ def callbacks(self) -> Iterable[ProcessCallback]: async def wait_process( - process: subprocess.Popen, timeout: float, input_file: Path | anyio.Path + process: subprocess.Popen[str], timeout: float, input_file: Path | anyio.Path ) -> None: wait_func = partial(sync_to_async(process.wait), timeout) if not isinstance(input_file, anyio.Path): diff --git a/src/timeout_executor/terminate.py b/src/timeout_executor/terminate.py index 957daab..9efd0bf 100644 --- a/src/timeout_executor/terminate.py +++ b/src/timeout_executor/terminate.py @@ -155,7 +155,7 @@ def remove_callback(self, callback: ProcessCallback) -> Self: return self -def terminate(process: subprocess.Popen, terminator: Terminator) -> None: +def terminate(process: subprocess.Popen[str], terminator: Terminator) -> None: try: with suppress(TimeoutError, subprocess.TimeoutExpired): process.wait(terminator.timeout)