From dce45edc74cca4b0d73cf7affd904108d1dd6c02 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Mon, 19 Feb 2018 20:51:49 +0300 Subject: [PATCH] Enable `subprocess` stubs (PY-19898, PY-24760) --- python/helpers/python-skeletons/subprocess.py | 140 ------------------ .../python/codeInsight/typing/PyTypeShed.kt | 2 +- 2 files changed, 1 insertion(+), 141 deletions(-) delete mode 100644 python/helpers/python-skeletons/subprocess.py diff --git a/python/helpers/python-skeletons/subprocess.py b/python/helpers/python-skeletons/subprocess.py deleted file mode 100644 index aa3af255d4a2..000000000000 --- a/python/helpers/python-skeletons/subprocess.py +++ /dev/null @@ -1,140 +0,0 @@ -"""Skeleton for 'subprocess' stdlib module.""" - - -def call(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, - preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, - universal_newlines=False, startupinfo=None, creationflags=0, - timeout=None, restore_signals=True, start_new_session=False, - pass_fds=()): - """Run the command described by args. - - :type args: collections.Iterable[bytes | unicode] - :type bufsize: int - :type executable: bytes | unicode | None - :type close_fds: bool - :type shell: bool - :type cwd: bytes | unicode | None - :type env: collections.Mapping | None - :type universal_newlines: bool - :type creationflags: int - :rtype: int - """ - return 0 - - -def check_call(args, bufsize=0, executable=None, stdin=None, stdout=None, - stderr=None, preexec_fn=None, close_fds=False, shell=False, - cwd=None, env=None, universal_newlines=False, startupinfo=None, - creationflags=0, timeout=None, restore_signals=True, - start_new_session=False, pass_fds=()): - """Run command with arguments. Wait for command to complete. If the return - code was zero then return, otherwise raise CalledProcessError. - - :type args: collections.Iterable[bytes | unicode] - :type bufsize: int - :type executable: bytes | unicode | None - :type close_fds: bool - :type shell: bool - :type cwd: bytes | unicode | None - :type env: collections.Mapping | None - :type universal_newlines: bool - :type creationflags: int - :rtype: int - """ - return 0 - - -def check_output(args, bufsize=0, executable=None, stdin=None, stderr=None, - preexec_fn=None, close_fds=False, shell=False, cwd=None, - env=None, universal_newlines=False, startupinfo=None, - creationflags=0, timeout=None, restore_signals=True, - start_new_session=False, pass_fds=()): - """Run command with arguments and return its output as a byte string. - - :type args: collections.Iterable[bytes | unicode] - :type bufsize: int - :type executable: bytes | unicode | None - :type close_fds: bool - :type shell: bool - :type cwd: bytes | unicode | None - :type env: collections.Mapping | None - :type universal_newlines: bool - :type creationflags: int - :rtype: bytes - """ - pass - - -class Popen(object): - """Execute a child program in a new process. - - :type returncode: int - """ - - def __init__(self, args, bufsize=0, executable=None, stdin=None, - stdout=None, stderr=None, preexec_fn=None, close_fds=False, - shell=False, cwd=None, env=None, universal_newlines=False, - startupinfo=None, creationflags=0, timeout=None, - restore_signals=True, start_new_session=False, pass_fds=()): - """Popen constructor. - - :type args: collections.Iterable[bytes | unicode] - :type bufsize: int - :type executable: bytes | unicode | None - :type close_fds: bool - :type shell: bool - :type cwd: bytes | unicode | None - :type env: collections.Mapping | None - :type universal_newlines: bool - :type creationflags: int - """ - self.stdin = stdin - self.stdout = stdout - self.stderr = stderr - self.pid = 0 - self.returncode = 0 - - def poll(self): - """Check if child process has terminated. - - :rtype: int - """ - return 0 - - def wait(self, timeout=None): - """Wait for child process to terminate. - - :rtype: int - """ - return 0 - - def communicate(self, input=None, timeout=None): - """Interact with process: Send data to stdin. Read data from stdout and - stderr, until end-of-file is reached. - - :type input: bytes | unicode | None - :rtype: (bytes, bytes) - """ - return b'', b'' - - def send_signal(self, signal): - """Sends the signal signal to the child. - - :type signal: int - :rtype: None - """ - pass - - def terminate(self): - """Stop the child. - - :rtype: None - """ - pass - - def kill(self): - """Kills the child. - - :rtype: None - """ - pass diff --git a/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt b/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt index 43216913f465..a83339a1bbd0 100644 --- a/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt +++ b/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt @@ -42,7 +42,7 @@ object PyTypeShed { private val ONLY_SUPPORTED_PY2_MINOR = 7 private val SUPPORTED_PY3_MINORS = 2..7 val WHITE_LIST = setOf(TYPING, "six", "__builtin__", "builtins", "exceptions", "types", "datetime", "functools", "shutil", "re", "time", - "argparse", "uuid", "threading", "signal", "collections") + "argparse", "uuid", "threading", "signal", "collections", "subprocess") private val BLACK_LIST = setOf() /**