From 95885c96ede81e200b92009f55e4f98f2972ce08 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 28 Feb 2022 00:01:51 +0000 Subject: [PATCH] Add `subprocess.__all__` (#7390) --- stdlib/subprocess.pyi | 81 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 8c03fa592..f95583129 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -7,6 +7,87 @@ from typing_extensions import Literal if sys.version_info >= (3, 9): from types import GenericAlias +if sys.platform == "win32": + if sys.version_info >= (3, 7): + __all__ = [ + "Popen", + "PIPE", + "STDOUT", + "call", + "check_call", + "getstatusoutput", + "getoutput", + "check_output", + "run", + "CalledProcessError", + "DEVNULL", + "SubprocessError", + "TimeoutExpired", + "CompletedProcess", + "CREATE_NEW_CONSOLE", + "CREATE_NEW_PROCESS_GROUP", + "STD_INPUT_HANDLE", + "STD_OUTPUT_HANDLE", + "STD_ERROR_HANDLE", + "SW_HIDE", + "STARTF_USESTDHANDLES", + "STARTF_USESHOWWINDOW", + "STARTUPINFO", + "ABOVE_NORMAL_PRIORITY_CLASS", + "BELOW_NORMAL_PRIORITY_CLASS", + "HIGH_PRIORITY_CLASS", + "IDLE_PRIORITY_CLASS", + "NORMAL_PRIORITY_CLASS", + "REALTIME_PRIORITY_CLASS", + "CREATE_NO_WINDOW", + "DETACHED_PROCESS", + "CREATE_DEFAULT_ERROR_MODE", + "CREATE_BREAKAWAY_FROM_JOB", + ] + else: + __all__ = [ + "Popen", + "PIPE", + "STDOUT", + "call", + "check_call", + "getstatusoutput", + "getoutput", + "check_output", + "run", + "CalledProcessError", + "DEVNULL", + "SubprocessError", + "TimeoutExpired", + "CompletedProcess", + "CREATE_NEW_CONSOLE", + "CREATE_NEW_PROCESS_GROUP", + "STD_INPUT_HANDLE", + "STD_OUTPUT_HANDLE", + "STD_ERROR_HANDLE", + "SW_HIDE", + "STARTF_USESTDHANDLES", + "STARTF_USESHOWWINDOW", + "STARTUPINFO", + ] +else: + __all__ = [ + "Popen", + "PIPE", + "STDOUT", + "call", + "check_call", + "getstatusoutput", + "getoutput", + "check_output", + "run", + "CalledProcessError", + "DEVNULL", + "SubprocessError", + "TimeoutExpired", + "CompletedProcess", + ] + # We prefer to annotate inputs to methods (eg subprocess.check_call) with these # union types. # For outputs we use laborious literal based overloads to try to determine