Skip to content

Commit

Permalink
rf(iter_subproc): rename argument input -> inputs
Browse files Browse the repository at this point in the history
The original names shadowed a built-in. While this did not cause
an actual problem, it is confusing.

The plural form also matches better, because `inputs` is an
iterable.
  • Loading branch information
mih committed Jun 14, 2024
1 parent 1d4add7 commit 4b44891
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions datasalad/runners/iter_subproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from shutil import COPY_BUFSIZE # type: ignore
except ImportError: # pragma: no cover
import sys

# too old
# backported windows default from from Python 3.10.
COPY_BUFSIZE = 1024 * 1024 if sys.platform.startswith('win') else 64 * 1024
Expand All @@ -26,7 +27,7 @@
def iter_subproc(
args: list[str],
*,
input: Iterable[bytes] | None = None,
inputs: Iterable[bytes] | None = None,
chunk_size: int = COPY_BUFSIZE,
cwd: Path | None = None,
bufsize: int = -1,
Expand Down Expand Up @@ -70,7 +71,7 @@ def iter_subproc(
... print(chunk)
b'test'
>>> # feed subprocess stdin from an iterable
>>> with iter_subproc(['cat'], input=[b'test']) as proc:
>>> with iter_subproc(['cat'], inputs=[b'test']) as proc:
... for chunk in proc:
... print(chunk)
b'test'
Expand Down Expand Up @@ -100,7 +101,7 @@ def iter_subproc(
----------
args: list
Sequence of program arguments to be passed to ``subprocess.Popen``.
input: iterable, optional
inputs: iterable, optional
If given, chunks of ``bytes`` to be written, iteratively, to the
subprocess's ``stdin``.
chunk_size: int, optional
Expand All @@ -117,7 +118,7 @@ def iter_subproc(
"""
return iterable_subprocess.iterable_subprocess(
args,
() if input is None else input,
() if inputs is None else inputs,
chunk_size=chunk_size,
cwd=cwd,
bufsize=bufsize,
Expand Down

0 comments on commit 4b44891

Please sign in to comment.