@@ -344,14 +344,90 @@ def check_output(
344344 params .pop ("stdout" )
345345 return subprocess .check_output (input = input , ** params )
346346
347+ @overload
347348 def run (
348349 self ,
349- input : Optional [Union [str , bytes ]] = None ,
350- timeout : Optional [int ] = None ,
351- check : bool = False ,
350+ universal_newlines : bool = ...,
351+ * ,
352+ capture_output : bool = ...,
353+ check : bool = ...,
354+ encoding : Optional [str ] = ...,
355+ errors : Optional [str ] = ...,
356+ input : Optional [str ] = ...,
357+ text : Literal [True ],
358+ ) -> subprocess .CompletedProcess [str ]:
359+ ...
360+
361+ @overload
362+ def run (
363+ self ,
364+ universal_newlines : bool = ...,
365+ * ,
366+ capture_output : bool = ...,
367+ check : bool = ...,
368+ encoding : str ,
369+ errors : Optional [str ] = ...,
370+ input : Optional [str ] = ...,
371+ text : Optional [bool ] = ...,
372+ ) -> subprocess .CompletedProcess [str ]:
373+ ...
374+
375+ @overload
376+ def run (
377+ self ,
378+ universal_newlines : bool = ...,
379+ * ,
380+ capture_output : bool = ...,
381+ check : bool = ...,
382+ encoding : Optional [str ] = ...,
383+ errors : str ,
384+ input : Optional [str ] = ...,
385+ text : Optional [bool ] = ...,
386+ ) -> subprocess .CompletedProcess [str ]:
387+ ...
388+
389+ @overload
390+ def run (
391+ self ,
392+ * ,
393+ universal_newlines : Literal [True ],
394+ # where the *real* keyword only args start
395+ capture_output : bool = ...,
396+ check : bool = ...,
397+ encoding : Optional [str ] = ...,
398+ errors : Optional [str ] = ...,
399+ input : Optional [str ] = ...,
400+ text : Optional [bool ] = ...,
401+ ) -> subprocess .CompletedProcess [str ]:
402+ ...
403+
404+ @overload
405+ def run (
406+ self ,
407+ universal_newlines : Literal [False ] = ...,
408+ * ,
409+ capture_output : bool = ...,
410+ check : bool = ...,
411+ encoding : None = ...,
412+ errors : None = ...,
413+ input : Optional [bytes ] = ...,
414+ text : Literal [None , False ] = ...,
415+ ) -> subprocess .CompletedProcess [bytes ]:
416+ ...
417+
418+ def run (
419+ self ,
420+ universal_newlines : Optional [bool ] = None ,
421+ * ,
352422 capture_output : bool = False ,
423+ check : bool = False ,
424+ encoding : Optional [str ] = None ,
425+ errors : Optional [str ] = None ,
426+ input : Optional [Union [str , bytes ]] = None ,
427+ text : Optional [bool ] = None ,
428+ timeout : Optional [float ] = None ,
353429 ** kwargs ,
354- ) -> subprocess .CompletedProcess :
430+ ) -> subprocess .CompletedProcess [ Any ] :
355431 r"""Run command in :func:`subprocess.run`, optionally overrides via kwargs.
356432
357433 Parameters
@@ -408,9 +484,15 @@ def run(
408484 b''
409485 """
410486 return subprocess .run (
411- ** dataclasses .replace (self , ** kwargs ).__dict__ ,
412- input = input ,
487+ ** dataclasses .replace (
488+ self ,
489+ universal_newlines = universal_newlines ,
490+ errors = errors ,
491+ text = text ,
492+ ** kwargs ,
493+ ).__dict__ ,
494+ check = check ,
413495 capture_output = capture_output ,
496+ input = input ,
414497 timeout = timeout ,
415- check = check ,
416498 )
0 commit comments