Skip to content

Commit

Permalink
improve type annotation in iter_subproc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
christian-monch committed Nov 27, 2023
1 parent 1dfbb14 commit 9b3f3e8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions datalad_next/runners/iter_subproc.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9b3f3e8

Please sign in to comment.