diff --git a/stdlib/3/_operator.pyi b/stdlib/3/_operator.pyi index 99262e5e5..6d08cd7ef 100644 --- a/stdlib/3/_operator.pyi +++ b/stdlib/3/_operator.pyi @@ -23,6 +23,7 @@ from operator import ( abs as abs, inv as inv, invert as invert, + length_hint as length_hint, lshift as lshift, rshift as rshift, not_ as not_, @@ -59,7 +60,5 @@ from operator import ( ) if sys.version_info >= (3, 5): from operator import matmul as matmul, imatmul as imatmul -if sys.version_info >= (3, 4): - from operator import length_hint as length_hint def _compare_digest(a: AnyStr, b: AnyStr) -> bool: ... diff --git a/stdlib/3/abc.pyi b/stdlib/3/abc.pyi index b109ea74d..480abc8c0 100644 --- a/stdlib/3/abc.pyi +++ b/stdlib/3/abc.pyi @@ -7,10 +7,7 @@ _FuncT = TypeVar('_FuncT', bound=Callable[..., Any]) # Thesee definitions have special processing in mypy class ABCMeta(type): - if sys.version_info >= (3, 3): - def register(cls: "ABCMeta", subclass: Type[_T]) -> Type[_T]: ... - else: - def register(cls: "ABCMeta", subclass: Type[Any]) -> None: ... + def register(cls: "ABCMeta", subclass: Type[_T]) -> Type[_T]: ... def abstractmethod(callable: _FuncT) -> _FuncT: ... class abstractproperty(property): ... @@ -18,7 +15,6 @@ class abstractproperty(property): ... def abstractstaticmethod(callable: _FuncT) -> _FuncT: ... def abstractclassmethod(callable: _FuncT) -> _FuncT: ... -if sys.version_info >= (3, 4): - class ABC(metaclass=ABCMeta): - pass - def get_cache_token() -> object: ... +class ABC(metaclass=ABCMeta): + pass +def get_cache_token() -> object: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index b77dcc0ee..9e1c74f73 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -334,23 +334,14 @@ class bytes(ByteString): def __init__(self, o: SupportsBytes) -> None: ... def capitalize(self) -> bytes: ... def center(self, width: int, fillchar: bytes = ...) -> bytes: ... - if sys.version_info >= (3, 3): - def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def count(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def decode(self, encoding: str = ..., errors: str = ...) -> str: ... def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytes: ... - if sys.version_info >= (3, 3): - def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def find(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... if sys.version_info >= (3, 5): def hex(self) -> str: ... - if sys.version_info >= (3, 3): - def index(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def index(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def index(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def isalnum(self) -> bool: ... def isalpha(self) -> bool: ... def isdigit(self) -> bool: ... @@ -364,14 +355,8 @@ class bytes(ByteString): def lstrip(self, chars: Optional[bytes] = ...) -> bytes: ... def partition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ... def replace(self, old: bytes, new: bytes, count: int = ...) -> bytes: ... - if sys.version_info >= (3, 3): - def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def rfind(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - if sys.version_info >= (3, 3): - def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def rindex(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def rjust(self, width: int, fillchar: bytes = ...) -> bytes: ... def rpartition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ... def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ... @@ -425,24 +410,15 @@ class bytearray(MutableSequence[int], ByteString): def __init__(self) -> None: ... def capitalize(self) -> bytearray: ... def center(self, width: int, fillchar: bytes = ...) -> bytearray: ... - if sys.version_info >= (3, 3): - def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def count(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def copy(self) -> bytearray: ... def decode(self, encoding: str = ..., errors: str = ...) -> str: ... def endswith(self, suffix: bytes) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytearray: ... - if sys.version_info >= (3, 3): - def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def find(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... if sys.version_info >= (3, 5): def hex(self) -> str: ... - if sys.version_info >= (3, 3): - def index(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def index(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def index(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def insert(self, index: int, object: int) -> None: ... def isalnum(self) -> bool: ... def isalpha(self) -> bool: ... @@ -457,14 +433,8 @@ class bytearray(MutableSequence[int], ByteString): def lstrip(self, chars: Optional[bytes] = ...) -> bytearray: ... def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... def replace(self, old: bytes, new: bytes, count: int = ...) -> bytearray: ... - if sys.version_info >= (3, 3): - def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def rfind(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - if sys.version_info >= (3, 3): - def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... - else: - def rindex(self, sub: bytes, start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... + def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def rjust(self, width: int, fillchar: bytes = ...) -> bytearray: ... def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ... @@ -985,8 +955,7 @@ class OSError(Exception): strerror = ... # type: str # filename, filename2 are actually Union[str, bytes, None] filename = ... # type: Any - if sys.version_info >= (3, 4): - filename2 = ... # type: Any + filename2 = ... # type: Any IOError = OSError EnvironmentError = OSError class WindowsError(OSError): @@ -1000,9 +969,8 @@ class BufferError(Exception): ... class EOFError(Exception): ... class FloatingPointError(ArithmeticError): ... class ImportError(Exception): - if sys.version_info >= (3, 3): - name = ... # type: str - path = ... # type: str + name = ... # type: str + path = ... # type: str if sys.version_info >= (3, 6): class ModuleNotFoundError(ImportError): ... class IndexError(LookupError): ... diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 2289e4212..ab358e229 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -329,20 +329,19 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): # TODO __reversed__ def copy(self: _DefaultDictT) -> _DefaultDictT: ... -if sys.version_info >= (3, 3): - class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): - def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ... +class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): + def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ... - @property - def maps(self) -> List[Mapping[_KT, _VT]]: ... + @property + def maps(self) -> List[Mapping[_KT, _VT]]: ... - def new_child(self, m: Mapping[_KT, _VT] = ...) -> typing.ChainMap[_KT, _VT]: ... + def new_child(self, m: Mapping[_KT, _VT] = ...) -> typing.ChainMap[_KT, _VT]: ... - @property - def parents(self) -> typing.ChainMap[_KT, _VT]: ... + @property + def parents(self) -> typing.ChainMap[_KT, _VT]: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __iter__(self) -> Iterator[_KT]: ... - def __len__(self) -> int: ... + def __setitem__(self, k: _KT, v: _VT) -> None: ... + def __delitem__(self, v: _KT) -> None: ... + def __getitem__(self, k: _KT) -> _VT: ... + def __iter__(self) -> Iterator[_KT]: ... + def __len__(self) -> int: ... diff --git a/stdlib/3/collections/abc.pyi b/stdlib/3/collections/abc.pyi index 38db036d4..a9577285c 100644 --- a/stdlib/3/collections/abc.pyi +++ b/stdlib/3/collections/abc.pyi @@ -3,25 +3,24 @@ # https://docs.python.org/3.3/whatsnew/3.3.html#collections import sys -if sys.version_info >= (3, 3): - from . import ( - Container as Container, - Hashable as Hashable, - Iterable as Iterable, - Iterator as Iterator, - Sized as Sized, - Callable as Callable, - Mapping as Mapping, - MutableMapping as MutableMapping, - Sequence as Sequence, - MutableSequence as MutableSequence, - Set as Set, - MutableSet as MutableSet, - MappingView as MappingView, - ItemsView as ItemsView, - KeysView as KeysView, - ValuesView as ValuesView, - ) +from . import ( + Container as Container, + Hashable as Hashable, + Iterable as Iterable, + Iterator as Iterator, + Sized as Sized, + Callable as Callable, + Mapping as Mapping, + MutableMapping as MutableMapping, + Sequence as Sequence, + MutableSequence as MutableSequence, + Set as Set, + MutableSet as MutableSet, + MappingView as MappingView, + ItemsView as ItemsView, + KeysView as KeysView, + ValuesView as ValuesView, +) if sys.version_info >= (3, 5): from . import ( diff --git a/stdlib/3/functools.pyi b/stdlib/3/functools.pyi index 60a186a72..d3a898427 100644 --- a/stdlib/3/functools.pyi +++ b/stdlib/3/functools.pyi @@ -47,31 +47,30 @@ class partial(Generic[_T]): def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> _T: ... -if sys.version_info >= (3, 4): - # With protocols, this could change into a generic protocol that defines __get__ and returns _T - _Descriptor = Any +# With protocols, this could change into a generic protocol that defines __get__ and returns _T +_Descriptor = Any - class partialmethod(Generic[_T]): - func: Union[Callable[..., _T], _Descriptor] - args: Tuple[Any, ...] - keywords: Dict[str, Any] +class partialmethod(Generic[_T]): + func: Union[Callable[..., _T], _Descriptor] + args: Tuple[Any, ...] + keywords: Dict[str, Any] - @overload - def __init__(self, func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... - @overload - def __init__(self, func: _Descriptor, *args: Any, **keywords: Any) -> None: ... - def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ... - @property - def __isabstractmethod__(self) -> bool: ... + @overload + def __init__(self, func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... + @overload + def __init__(self, func: _Descriptor, *args: Any, **keywords: Any) -> None: ... + def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ... + @property + def __isabstractmethod__(self) -> bool: ... - class _SingleDispatchCallable(Generic[_T]): - registry = ... # type: Mapping[Any, Callable[..., _T]] - def dispatch(self, cls: Any) -> Callable[..., _T]: ... - @overload - def register(self, cls: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... - @overload - def register(self, cls: Any, func: Callable[..., _T]) -> Callable[..., _T]: ... - def _clear_cache(self) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> _T: ... +class _SingleDispatchCallable(Generic[_T]): + registry = ... # type: Mapping[Any, Callable[..., _T]] + def dispatch(self, cls: Any) -> Callable[..., _T]: ... + @overload + def register(self, cls: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + @overload + def register(self, cls: Any, func: Callable[..., _T]) -> Callable[..., _T]: ... + def _clear_cache(self) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> _T: ... - def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ... +def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ... diff --git a/stdlib/3/glob.pyi b/stdlib/3/glob.pyi index f36d26c64..701c4cacc 100644 --- a/stdlib/3/glob.pyi +++ b/stdlib/3/glob.pyi @@ -18,5 +18,4 @@ else: def glob(pathname: AnyStr) -> List[AnyStr]: ... def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ... -if sys.version_info >= (3, 4): - def escape(pathname: AnyStr) -> AnyStr: ... +def escape(pathname: AnyStr) -> AnyStr: ... diff --git a/stdlib/3/hashlib.pyi b/stdlib/3/hashlib.pyi index 850205fb7..90bce96b2 100644 --- a/stdlib/3/hashlib.pyi +++ b/stdlib/3/hashlib.pyi @@ -30,13 +30,10 @@ def sha512(arg: _DataType = ...) -> _Hash: ... def new(name: str, data: _DataType = ...) -> _Hash: ... -# New in version 3.2 algorithms_guaranteed = ... # type: AbstractSet[str] algorithms_available = ... # type: AbstractSet[str] -# New in version 3.4 -if sys.version_info >= (3, 4): - def pbkdf2_hmac(hash_name: str, password: _DataType, salt: _DataType, iterations: int, dklen: Optional[int] = ...) -> bytes: ... +def pbkdf2_hmac(hash_name: str, password: _DataType, salt: _DataType, iterations: int, dklen: Optional[int] = ...) -> bytes: ... if sys.version_info >= (3, 6): class _VarLenHash(object): diff --git a/stdlib/3/http/client.pyi b/stdlib/3/http/client.pyi index 930112278..419fe1b83 100644 --- a/stdlib/3/http/client.pyi +++ b/stdlib/3/http/client.pyi @@ -114,8 +114,7 @@ else: status = ... # type: int reason = ... # type: str def read(self, amt: Optional[int] = ...) -> bytes: ... - if sys.version_info >= (3, 3): - def readinto(self, b: bytearray) -> int: ... + def readinto(self, b: bytearray) -> int: ... @overload def getheader(self, name: str) -> Optional[str]: ... @overload @@ -136,20 +135,13 @@ class HTTPConnection: timeout: int = ..., source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ... ) -> None: ... - elif sys.version_info >= (3, 4): + else: def __init__( self, host: str, port: Optional[int] = ..., timeout: int = ..., source_address: Optional[Tuple[str, int]] = ... ) -> None: ... - else: - def __init__( - self, - host: str, port: Optional[int] = ..., - strict: bool = ..., timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ... - )-> None: ... def request(self, method: str, url: str, body: Optional[_DataType] = ..., headers: Mapping[str, str] = ...) -> None: ... @@ -166,24 +158,14 @@ class HTTPConnection: def send(self, data: _DataType) -> None: ... class HTTPSConnection(HTTPConnection): - if sys.version_info >= (3, 4): - def __init__(self, - host: str, port: Optional[int] = ..., - key_file: Optional[str] = ..., - cert_file: Optional[str] = ..., - timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ..., - *, context: Optional[ssl.SSLContext] = ..., - check_hostname: Optional[bool] = ...) -> None: ... - else: - def __init__(self, - host: str, port: Optional[int] = ..., - key_file: Optional[str] = ..., - cert_file: Optional[str] = ..., - strict: bool = ..., timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ..., - *, context: Optional[ssl.SSLContext] = ..., - check_hostname: Optional[bool] = ...) -> None: ... + def __init__(self, + host: str, port: Optional[int] = ..., + key_file: Optional[str] = ..., + cert_file: Optional[str] = ..., + timeout: int = ..., + source_address: Optional[Tuple[str, int]] = ..., + *, context: Optional[ssl.SSLContext] = ..., + check_hostname: Optional[bool] = ...) -> None: ... class HTTPException(Exception): ... error = HTTPException diff --git a/stdlib/3/http/cookiejar.pyi b/stdlib/3/http/cookiejar.pyi index 3cacc27c4..d7eafec04 100644 --- a/stdlib/3/http/cookiejar.pyi +++ b/stdlib/3/http/cookiejar.pyi @@ -1,14 +1,10 @@ from typing import Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload from http.client import HTTPResponse -import sys from urllib.request import Request _T = TypeVar('_T') -if sys.version_info >= (3, 3): - class LoadError(OSError): ... -else: - class LoadError(IOError): ... +class LoadError(OSError): ... class CookieJar(Iterable['Cookie']): diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index 53944ea90..c0d175bb0 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -92,84 +92,44 @@ if sys.version_info >= (3, 5): pass_fds: Any = ...) -> CompletedProcess: ... # Same args as Popen.__init__ -if sys.version_info >= (3, 3): - # 3.3 added timeout - def call(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float = ...) -> int: ... -else: - def call(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ...) -> int: ... +def call(args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float = ...) -> int: ... # Same args as Popen.__init__ -if sys.version_info >= (3, 3): - # 3.3 added timeout - def check_call(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float = ...) -> int: ... -else: - def check_call(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ...) -> int: ... +def check_call(args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float = ...) -> int: ... if sys.version_info >= (3, 6): # 3.6 added encoding and errors @@ -195,8 +155,7 @@ if sys.version_info >= (3, 6): encoding: Optional[str] = ..., errors: Optional[str] = ..., ) -> Any: ... # morally: -> _TXT -elif sys.version_info >= (3, 4): - # 3.4 added input +else: def check_output(args: _CMD, bufsize: int = ..., executable: _PATH = ..., @@ -216,60 +175,20 @@ elif sys.version_info >= (3, 4): timeout: float = ..., input: _TXT = ..., ) -> Any: ... # morally: -> _TXT -elif sys.version_info >= (3, 3): - # 3.3 added timeout - def check_output(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float = ..., - ) -> Any: ... # morally: -> _TXT -else: - # Same args as Popen.__init__, except for stdout - def check_output(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - ) -> Any: ... # morally: -> _TXT PIPE = ... # type: int STDOUT = ... # type: int -if sys.version_info >= (3, 3): - DEVNULL = ... # type: int - class SubprocessError(Exception): ... - class TimeoutExpired(SubprocessError): - # morally: _CMD - cmd = ... # type: Any - timeout = ... # type: float - # morally: Optional[_TXT] - output = ... # type: Any - stdout = ... # type: Any - stderr = ... # type: Any +DEVNULL = ... # type: int +class SubprocessError(Exception): ... +class TimeoutExpired(SubprocessError): + # morally: _CMD + cmd = ... # type: Any + timeout = ... # type: float + # morally: Optional[_TXT] + output = ... # type: Any + stdout = ... # type: Any + stderr = ... # type: Any class CalledProcessError(Exception): @@ -291,8 +210,7 @@ class CalledProcessError(Exception): stderr: Optional[_TXT] = ...) -> None: ... class Popen: - if sys.version_info >= (3, 3): - args = ... # type: _CMD + args = ... # type: _CMD stdin = ... # type: IO[Any] stdout = ... # type: IO[Any] stderr = ... # type: IO[Any] @@ -342,23 +260,13 @@ class Popen: pass_fds: Any = ...) -> None: ... def poll(self) -> int: ... - if sys.version_info >= (3, 3): - # 3.3 added timeout - def wait(self, timeout: Optional[float] = ...) -> int: ... - else: - def wait(self) ->int: ... + def wait(self, timeout: Optional[float] = ...) -> int: ... # Return str/bytes - if sys.version_info >= (3, 3): - def communicate(self, - input: Optional[_TXT] = ..., - timeout: Optional[float] = ..., - # morally: -> Tuple[Optional[_TXT], Optional[_TXT]] - ) -> Tuple[Any, Any]: ... - else: - def communicate(self, - input: Optional[_TXT] = ..., - # morally: -> Tuple[Optional[_TXT], Optional[_TXT]] - ) -> Tuple[Any, Any]: ... + def communicate(self, + input: Optional[_TXT] = ..., + timeout: Optional[float] = ..., + # morally: -> Tuple[Optional[_TXT], Optional[_TXT]] + ) -> Tuple[Any, Any]: ... def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ...