Skip to content

Commit 61df823

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

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/libvcs/_internal/subprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self, output: str, *args: object) -> None:
6363
_ENV: t.TypeAlias = Mapping[str, str]
6464
else:
6565
_ENV: t.TypeAlias = Mapping[bytes, StrOrBytesPath] | Mapping[str, StrOrBytesPath]
66-
_FILE: t.TypeAlias = None | int | t.IO[t.Any]
66+
_FILE: t.TypeAlias = None | int | t.IO[str] | t.IO[bytes]
6767
_TXT: t.TypeAlias = bytes | str
6868
#: Command
6969
_CMD: t.TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath]
@@ -96,7 +96,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin):
9696
stdin: _FILE = None
9797
stdout: _FILE = None
9898
stderr: _FILE = None
99-
preexec_fn: t.Callable[[], t.Any] | None = None
99+
preexec_fn: t.Callable[[], None] | None = None
100100
close_fds: bool = True
101101
shell: bool = False
102102
cwd: StrOrBytesPath | None = None
@@ -109,7 +109,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin):
109109
# POSIX-only
110110
restore_signals: bool = True
111111
start_new_session: bool = False
112-
pass_fds: t.Any = ()
112+
pass_fds: Sequence[int] = ()
113113
umask: int = -1
114114
pipesize: int = -1
115115
user: str | None = None

0 commit comments

Comments
 (0)