Skip to content

Commit 0049ecc

Browse files
committed
refactor!(SubprocessCommand): check_output() typings
See also: https://github.com/python/typeshed/blob/8b58371/stdlib/subprocess.pyi#L491-L643
1 parent 54dd394 commit 0049ecc

File tree

1 file changed

+67
-3
lines changed

1 file changed

+67
-3
lines changed

libvcs/_internal/subprocess.py

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,79 @@ def check_call(self, **kwargs) -> int:
237237
return subprocess.check_call(**dataclasses.replace(self, **kwargs).__dict__)
238238

239239
@overload
240-
def check_output(self, input: Optional[str] = None, **kwargs) -> str:
240+
def check_output(
241+
self,
242+
universal_newlines: bool = ...,
243+
*,
244+
input: Optional[Union[str, bytes]] = ...,
245+
encoding: Optional[str] = ...,
246+
errors: Optional[str] = ...,
247+
text: Literal[True],
248+
**kwargs,
249+
) -> str:
250+
...
251+
252+
@overload
253+
def check_output(
254+
self,
255+
universal_newlines: Optional[bool] = ...,
256+
*,
257+
input: Optional[Union[str, bytes]] = ...,
258+
encoding: str,
259+
errors: Optional[str] = ...,
260+
text: Optional[bool] = ...,
261+
**kwargs,
262+
) -> str:
241263
...
242264

243265
@overload
244-
def check_output(self, input: Optional[bytes] = None, **kwargs) -> bytes:
266+
def check_output(
267+
self,
268+
universal_newlines: bool = ...,
269+
*,
270+
input: Optional[Union[str, bytes]] = ...,
271+
encoding: Optional[str] = ...,
272+
errors: str,
273+
text: Optional[bool] = ...,
274+
**kwargs,
275+
) -> str:
245276
...
246277

278+
@overload
247279
def check_output(
248-
self, input: Optional[Union[str, bytes]] = None, **kwargs
280+
self,
281+
universal_newlines: Literal[True] = ...,
282+
*,
283+
input: Optional[Union[str, bytes]] = ...,
284+
encoding: Optional[str] = ...,
285+
errors: Optional[str] = ...,
286+
text: Optional[bool] = ...,
287+
**kwargs,
288+
) -> str:
289+
...
290+
291+
@overload
292+
def check_output(
293+
self,
294+
universal_newlines: Literal[False],
295+
*,
296+
input: Optional[Union[str, bytes]] = ...,
297+
encoding: None = ...,
298+
errors: None = ...,
299+
text: Literal[None, False] = ...,
300+
**kwargs,
301+
) -> bytes:
302+
...
303+
304+
def check_output(
305+
self,
306+
universal_newlines: Optional[bool] = None,
307+
*,
308+
input: Optional[Union[str, bytes]] = None,
309+
encoding: Optional[str] = None,
310+
errors: Optional[str] = None,
311+
text: Optional[bool] = None,
312+
**kwargs,
249313
) -> Union[bytes, str]:
250314
r"""Run command :func:`subprocess.check_output`, optionally overrides via kwargs.
251315

0 commit comments

Comments
 (0)