From 9b3f3e8f8a6448b8aa0d45b39c3d4e7b84cb36a4 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Mon, 27 Nov 2023 10:19:38 +0100 Subject: [PATCH] improve type annotation in `iter_subproc` This commit changes the type of the `input`-parameter of `iter_subproc` from `List[bytes]` to `Iterable[bytes]` (wich includes `List[bytes]`). The previous annotation was unnecessarily restrictive and would lead to type-check errors if an iterator-object, e.g. a result of `iter(...)` was provided as `input`-parameter. --- datalad_next/runners/iter_subproc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datalad_next/runners/iter_subproc.py b/datalad_next/runners/iter_subproc.py index 9fcfe23d..5d5bf932 100644 --- a/datalad_next/runners/iter_subproc.py +++ b/datalad_next/runners/iter_subproc.py @@ -1,5 +1,8 @@ from __future__ import annotations -from typing import List +from typing import ( + Iterable, + List, +) from datalad_next.iterable_subprocess.iterable_subprocess \ import iterable_subprocess @@ -11,7 +14,7 @@ def iter_subproc( args: List[str], *, - input: List[bytes] | None = None, + input: Iterable[bytes] | None = None, chunk_size: int = COPY_BUFSIZE, ): """Context manager to communicate with a subprocess using iterables