Skip to content

Commit 61d0401

Browse files
committed
internal/run(refactor[typing]): Tighten run() parameter types
why: Reduce overly broad typing on subprocess helper parameters. what: - Narrow _FILE to IO[str] | IO[bytes] - Specify preexec_fn returns None - Constrain pass_fds to sequence of ints
1 parent 61df823 commit 61d0401

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/libvcs/_internal/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __call__(self, output: str, timestamp: datetime.datetime) -> None:
100100
_ENV: t.TypeAlias = Mapping[bytes, StrPath] | Mapping[str, StrPath]
101101

102102
_CMD = StrPath | Sequence[StrPath]
103-
_FILE: t.TypeAlias = int | t.IO[t.Any] | None
103+
_FILE: t.TypeAlias = int | t.IO[str] | t.IO[bytes] | None
104104

105105

106106
def run(
@@ -110,7 +110,7 @@ def run(
110110
stdin: _FILE | None = None,
111111
stdout: _FILE | None = None,
112112
stderr: _FILE | None = None,
113-
preexec_fn: t.Callable[[], t.Any] | None = None,
113+
preexec_fn: t.Callable[[], None] | None = None,
114114
close_fds: bool = True,
115115
shell: bool = False,
116116
cwd: StrPath | None = None,
@@ -119,7 +119,7 @@ def run(
119119
creationflags: int = 0,
120120
restore_signals: bool = True,
121121
start_new_session: bool = False,
122-
pass_fds: t.Any = (),
122+
pass_fds: Sequence[int] = (),
123123
*,
124124
encoding: str | None = None,
125125
errors: str | None = None,

0 commit comments

Comments
 (0)