From 91582e6921253aff0ff1b26bf9a1073bd42a039f Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 30 Dec 2020 21:41:09 +0100 Subject: [PATCH] Drop old branches in stdlib/3/os/path.pyi (#4878) * Drop support for Python 3.5 in stdlib/3/os/path.pyi * Remove more obsolete branches --- stdlib/3/asyncio/events.pyi | 5 +- stdlib/3/ntpath.pyi | 145 ++++++++++++++---------------------- stdlib/3/os/path.pyi | 145 ++++++++++++++---------------------- stdlib/3/pathlib.pyi | 8 +- stdlib/3/posixpath.pyi | 145 ++++++++++++++---------------------- stdlib/3/socketserver.pyi | 20 ++--- stdlib/3/unittest/mock.pyi | 5 +- stdlib/3/venv/__init__.pyi | 21 +----- stdlib/3/winreg.pyi | 5 +- 9 files changed, 188 insertions(+), 311 deletions(-) diff --git a/stdlib/3/asyncio/events.pyi b/stdlib/3/asyncio/events.pyi index c61a96eea..8cda63a5c 100644 --- a/stdlib/3/asyncio/events.pyi +++ b/stdlib/3/asyncio/events.pyi @@ -82,9 +82,8 @@ class AbstractEventLoop(metaclass=ABCMeta): def is_closed(self) -> bool: ... @abstractmethod def close(self) -> None: ... - if sys.version_info >= (3, 6): - @abstractmethod - async def shutdown_asyncgens(self) -> None: ... + @abstractmethod + async def shutdown_asyncgens(self) -> None: ... # Methods scheduling callbacks. All these return Handles. @abstractmethod def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ... diff --git a/stdlib/3/ntpath.pyi b/stdlib/3/ntpath.pyi index 7dac80e52..9fe5a7df6 100644 --- a/stdlib/3/ntpath.pyi +++ b/stdlib/3/ntpath.pyi @@ -1,14 +1,12 @@ import os import sys from _typeshed import AnyPath, BytesPath, StrPath +from builtins import _PathLike from genericpath import exists as exists from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload _T = TypeVar("_T") -if sys.version_info >= (3, 6): - from builtins import _PathLike - # ----- os.path variables ----- supports_unicode_filenames: bool # aliases (also in os) @@ -25,67 +23,51 @@ defpath: str devnull: str # ----- os.path function stubs ----- -if sys.version_info >= (3, 6): - # Overloads are necessary to work around python/mypy#3644. +# Overloads are necessary to work around python/mypy#3644. +@overload +def abspath(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def abspath(path: AnyStr) -> AnyStr: ... +@overload +def basename(p: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def basename(p: AnyStr) -> AnyStr: ... +@overload +def dirname(p: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def dirname(p: AnyStr) -> AnyStr: ... +@overload +def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def expanduser(path: AnyStr) -> AnyStr: ... +@overload +def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def expandvars(path: AnyStr) -> AnyStr: ... +@overload +def normcase(s: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def normcase(s: AnyStr) -> AnyStr: ... +@overload +def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def normpath(path: AnyStr) -> AnyStr: ... + +if sys.platform == "win32": @overload - def abspath(path: _PathLike[AnyStr]) -> AnyStr: ... + def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload - def abspath(path: AnyStr) -> AnyStr: ... - @overload - def basename(p: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def basename(p: AnyStr) -> AnyStr: ... - @overload - def dirname(p: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def dirname(p: AnyStr) -> AnyStr: ... - @overload - def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def expanduser(path: AnyStr) -> AnyStr: ... - @overload - def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def expandvars(path: AnyStr) -> AnyStr: ... - @overload - def normcase(s: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def normcase(s: AnyStr) -> AnyStr: ... - @overload - def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == "win32": - @overload - def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(path: AnyStr) -> AnyStr: ... - else: - @overload - def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(filename: AnyStr) -> AnyStr: ... + def realpath(path: AnyStr) -> AnyStr: ... else: - def abspath(path: AnyStr) -> AnyStr: ... - def basename(p: AnyStr) -> AnyStr: ... - def dirname(p: AnyStr) -> AnyStr: ... - def expanduser(path: AnyStr) -> AnyStr: ... - def expandvars(path: AnyStr) -> AnyStr: ... - def normcase(s: AnyStr) -> AnyStr: ... - def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - else: - def realpath(filename: AnyStr) -> AnyStr: ... + @overload + def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ... + @overload + def realpath(filename: AnyStr) -> AnyStr: ... -if sys.version_info >= (3, 6): - # In reality it returns str for sequences of StrPath and bytes for sequences - # of BytesPath, but mypy does not accept such a signature. - def commonpath(paths: Sequence[AnyPath]) -> Any: ... - -elif sys.version_info >= (3, 5): - def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... +# In reality it returns str for sequences of StrPath and bytes for sequences +# of BytesPath, but mypy does not accept such a signature. +def commonpath(paths: Sequence[AnyPath]) -> Any: ... # NOTE: Empty lists results in '' (str) regardless of contained type. # So, fall back to Any @@ -103,16 +85,10 @@ def isfile(path: AnyPath) -> bool: ... def isdir(s: AnyPath) -> bool: ... def islink(path: AnyPath) -> bool: ... def ismount(path: AnyPath) -> bool: ... - -if sys.version_info >= (3, 6): - @overload - def join(a: StrPath, *paths: StrPath) -> str: ... - @overload - def join(a: BytesPath, *paths: BytesPath) -> bytes: ... - -else: - def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ... - +@overload +def join(a: StrPath, *paths: StrPath) -> str: ... +@overload +def join(a: BytesPath, *paths: BytesPath) -> bytes: ... @overload def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ... @overload @@ -120,25 +96,18 @@ def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ... def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... - -if sys.version_info >= (3, 6): - @overload - def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -else: - def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... if sys.version_info < (3, 7) and sys.platform == "win32": def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated diff --git a/stdlib/3/os/path.pyi b/stdlib/3/os/path.pyi index 7dac80e52..9fe5a7df6 100644 --- a/stdlib/3/os/path.pyi +++ b/stdlib/3/os/path.pyi @@ -1,14 +1,12 @@ import os import sys from _typeshed import AnyPath, BytesPath, StrPath +from builtins import _PathLike from genericpath import exists as exists from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload _T = TypeVar("_T") -if sys.version_info >= (3, 6): - from builtins import _PathLike - # ----- os.path variables ----- supports_unicode_filenames: bool # aliases (also in os) @@ -25,67 +23,51 @@ defpath: str devnull: str # ----- os.path function stubs ----- -if sys.version_info >= (3, 6): - # Overloads are necessary to work around python/mypy#3644. +# Overloads are necessary to work around python/mypy#3644. +@overload +def abspath(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def abspath(path: AnyStr) -> AnyStr: ... +@overload +def basename(p: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def basename(p: AnyStr) -> AnyStr: ... +@overload +def dirname(p: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def dirname(p: AnyStr) -> AnyStr: ... +@overload +def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def expanduser(path: AnyStr) -> AnyStr: ... +@overload +def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def expandvars(path: AnyStr) -> AnyStr: ... +@overload +def normcase(s: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def normcase(s: AnyStr) -> AnyStr: ... +@overload +def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def normpath(path: AnyStr) -> AnyStr: ... + +if sys.platform == "win32": @overload - def abspath(path: _PathLike[AnyStr]) -> AnyStr: ... + def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload - def abspath(path: AnyStr) -> AnyStr: ... - @overload - def basename(p: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def basename(p: AnyStr) -> AnyStr: ... - @overload - def dirname(p: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def dirname(p: AnyStr) -> AnyStr: ... - @overload - def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def expanduser(path: AnyStr) -> AnyStr: ... - @overload - def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def expandvars(path: AnyStr) -> AnyStr: ... - @overload - def normcase(s: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def normcase(s: AnyStr) -> AnyStr: ... - @overload - def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == "win32": - @overload - def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(path: AnyStr) -> AnyStr: ... - else: - @overload - def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(filename: AnyStr) -> AnyStr: ... + def realpath(path: AnyStr) -> AnyStr: ... else: - def abspath(path: AnyStr) -> AnyStr: ... - def basename(p: AnyStr) -> AnyStr: ... - def dirname(p: AnyStr) -> AnyStr: ... - def expanduser(path: AnyStr) -> AnyStr: ... - def expandvars(path: AnyStr) -> AnyStr: ... - def normcase(s: AnyStr) -> AnyStr: ... - def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - else: - def realpath(filename: AnyStr) -> AnyStr: ... + @overload + def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ... + @overload + def realpath(filename: AnyStr) -> AnyStr: ... -if sys.version_info >= (3, 6): - # In reality it returns str for sequences of StrPath and bytes for sequences - # of BytesPath, but mypy does not accept such a signature. - def commonpath(paths: Sequence[AnyPath]) -> Any: ... - -elif sys.version_info >= (3, 5): - def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... +# In reality it returns str for sequences of StrPath and bytes for sequences +# of BytesPath, but mypy does not accept such a signature. +def commonpath(paths: Sequence[AnyPath]) -> Any: ... # NOTE: Empty lists results in '' (str) regardless of contained type. # So, fall back to Any @@ -103,16 +85,10 @@ def isfile(path: AnyPath) -> bool: ... def isdir(s: AnyPath) -> bool: ... def islink(path: AnyPath) -> bool: ... def ismount(path: AnyPath) -> bool: ... - -if sys.version_info >= (3, 6): - @overload - def join(a: StrPath, *paths: StrPath) -> str: ... - @overload - def join(a: BytesPath, *paths: BytesPath) -> bytes: ... - -else: - def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ... - +@overload +def join(a: StrPath, *paths: StrPath) -> str: ... +@overload +def join(a: BytesPath, *paths: BytesPath) -> bytes: ... @overload def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ... @overload @@ -120,25 +96,18 @@ def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ... def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... - -if sys.version_info >= (3, 6): - @overload - def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -else: - def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... if sys.version_info < (3, 7) and sys.platform == "win32": def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated diff --git a/stdlib/3/pathlib.pyi b/stdlib/3/pathlib.pyi index 7882f9006..cd00398fe 100644 --- a/stdlib/3/pathlib.pyi +++ b/stdlib/3/pathlib.pyi @@ -11,12 +11,8 @@ if sys.version_info >= (3, 9): _P = TypeVar("_P", bound=PurePath) -if sys.version_info >= (3, 6): - _PurePathBase = os.PathLike[str] - _PathLike = os.PathLike[str] -else: - _PurePathBase = object - _PathLike = PurePath +_PurePathBase = os.PathLike[str] +_PathLike = os.PathLike[str] class PurePath(_PurePathBase): parts: Tuple[str, ...] diff --git a/stdlib/3/posixpath.pyi b/stdlib/3/posixpath.pyi index 7dac80e52..9fe5a7df6 100644 --- a/stdlib/3/posixpath.pyi +++ b/stdlib/3/posixpath.pyi @@ -1,14 +1,12 @@ import os import sys from _typeshed import AnyPath, BytesPath, StrPath +from builtins import _PathLike from genericpath import exists as exists from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload _T = TypeVar("_T") -if sys.version_info >= (3, 6): - from builtins import _PathLike - # ----- os.path variables ----- supports_unicode_filenames: bool # aliases (also in os) @@ -25,67 +23,51 @@ defpath: str devnull: str # ----- os.path function stubs ----- -if sys.version_info >= (3, 6): - # Overloads are necessary to work around python/mypy#3644. +# Overloads are necessary to work around python/mypy#3644. +@overload +def abspath(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def abspath(path: AnyStr) -> AnyStr: ... +@overload +def basename(p: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def basename(p: AnyStr) -> AnyStr: ... +@overload +def dirname(p: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def dirname(p: AnyStr) -> AnyStr: ... +@overload +def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def expanduser(path: AnyStr) -> AnyStr: ... +@overload +def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def expandvars(path: AnyStr) -> AnyStr: ... +@overload +def normcase(s: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def normcase(s: AnyStr) -> AnyStr: ... +@overload +def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... +@overload +def normpath(path: AnyStr) -> AnyStr: ... + +if sys.platform == "win32": @overload - def abspath(path: _PathLike[AnyStr]) -> AnyStr: ... + def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload - def abspath(path: AnyStr) -> AnyStr: ... - @overload - def basename(p: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def basename(p: AnyStr) -> AnyStr: ... - @overload - def dirname(p: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def dirname(p: AnyStr) -> AnyStr: ... - @overload - def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def expanduser(path: AnyStr) -> AnyStr: ... - @overload - def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def expandvars(path: AnyStr) -> AnyStr: ... - @overload - def normcase(s: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def normcase(s: AnyStr) -> AnyStr: ... - @overload - def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == "win32": - @overload - def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(path: AnyStr) -> AnyStr: ... - else: - @overload - def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(filename: AnyStr) -> AnyStr: ... + def realpath(path: AnyStr) -> AnyStr: ... else: - def abspath(path: AnyStr) -> AnyStr: ... - def basename(p: AnyStr) -> AnyStr: ... - def dirname(p: AnyStr) -> AnyStr: ... - def expanduser(path: AnyStr) -> AnyStr: ... - def expandvars(path: AnyStr) -> AnyStr: ... - def normcase(s: AnyStr) -> AnyStr: ... - def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - else: - def realpath(filename: AnyStr) -> AnyStr: ... + @overload + def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ... + @overload + def realpath(filename: AnyStr) -> AnyStr: ... -if sys.version_info >= (3, 6): - # In reality it returns str for sequences of StrPath and bytes for sequences - # of BytesPath, but mypy does not accept such a signature. - def commonpath(paths: Sequence[AnyPath]) -> Any: ... - -elif sys.version_info >= (3, 5): - def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... +# In reality it returns str for sequences of StrPath and bytes for sequences +# of BytesPath, but mypy does not accept such a signature. +def commonpath(paths: Sequence[AnyPath]) -> Any: ... # NOTE: Empty lists results in '' (str) regardless of contained type. # So, fall back to Any @@ -103,16 +85,10 @@ def isfile(path: AnyPath) -> bool: ... def isdir(s: AnyPath) -> bool: ... def islink(path: AnyPath) -> bool: ... def ismount(path: AnyPath) -> bool: ... - -if sys.version_info >= (3, 6): - @overload - def join(a: StrPath, *paths: StrPath) -> str: ... - @overload - def join(a: BytesPath, *paths: BytesPath) -> bytes: ... - -else: - def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ... - +@overload +def join(a: StrPath, *paths: StrPath) -> str: ... +@overload +def join(a: BytesPath, *paths: BytesPath) -> bytes: ... @overload def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ... @overload @@ -120,25 +96,18 @@ def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ... def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... - -if sys.version_info >= (3, 6): - @overload - def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -else: - def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +@overload +def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... if sys.version_info < (3, 7) and sys.platform == "win32": def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated diff --git a/stdlib/3/socketserver.pyi b/stdlib/3/socketserver.pyi index 01ab760bf..aec166013 100644 --- a/stdlib/3/socketserver.pyi +++ b/stdlib/3/socketserver.pyi @@ -26,11 +26,10 @@ class BaseServer: def server_activate(self) -> None: ... def server_bind(self) -> None: ... def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ... - if sys.version_info >= (3, 6): - def __enter__(self) -> BaseServer: ... - def __exit__( - self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType] - ) -> None: ... + def __enter__(self) -> BaseServer: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType] + ) -> None: ... def service_actions(self) -> None: ... class TCPServer(BaseServer): @@ -72,15 +71,11 @@ if sys.platform != "win32": max_children: int # undocumented if sys.version_info >= (3, 7): block_on_close: bool - if sys.version_info >= (3, 6): - def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented - else: - def collect_children(self) -> None: ... # undocumented + def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented def handle_timeout(self) -> None: ... # undocumented def service_actions(self) -> None: ... # undocumented def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - if sys.version_info >= (3, 6): - def server_close(self) -> None: ... + def server_close(self) -> None: ... class ThreadingMixIn: daemon_threads: bool @@ -88,8 +83,7 @@ class ThreadingMixIn: block_on_close: bool def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - if sys.version_info >= (3, 6): - def server_close(self) -> None: ... + def server_close(self) -> None: ... if sys.platform != "win32": class ForkingTCPServer(ForkingMixIn, TCPServer): ... diff --git a/stdlib/3/unittest/mock.pyi b/stdlib/3/unittest/mock.pyi index bf7e3ef76..bfeba5739 100644 --- a/stdlib/3/unittest/mock.pyi +++ b/stdlib/3/unittest/mock.pyi @@ -107,10 +107,7 @@ class NonCallableMock(Base, Any): # type: ignore elif sys.version_info >= (3, 6): def assert_called(_mock_self) -> None: ... def assert_called_once(_mock_self) -> None: ... - if sys.version_info >= (3, 6): - def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ... - elif sys.version_info >= (3, 5): - def reset_mock(self, visited: Any = ...) -> None: ... + def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ... if sys.version_info >= (3, 7): def _extract_mock_name(self) -> str: ... def _get_call_signature_from_name(self, name: str) -> Any: ... diff --git a/stdlib/3/venv/__init__.pyi b/stdlib/3/venv/__init__.pyi index 2919aab2a..d44d17ea9 100644 --- a/stdlib/3/venv/__init__.pyi +++ b/stdlib/3/venv/__init__.pyi @@ -9,8 +9,7 @@ class EnvBuilder: symlinks: bool upgrade: bool with_pip: bool - if sys.version_info >= (3, 6): - prompt: Optional[str] + prompt: Optional[str] if sys.version_info >= (3, 9): def __init__( @@ -23,16 +22,6 @@ class EnvBuilder: prompt: Optional[str] = ..., upgrade_deps: bool = ..., ) -> None: ... - elif sys.version_info >= (3, 6): - def __init__( - self, - system_site_packages: bool = ..., - clear: bool = ..., - symlinks: bool = ..., - upgrade: bool = ..., - with_pip: bool = ..., - prompt: Optional[str] = ..., - ) -> None: ... else: def __init__( self, @@ -41,6 +30,7 @@ class EnvBuilder: symlinks: bool = ..., upgrade: bool = ..., with_pip: bool = ..., + prompt: Optional[str] = ..., ) -> None: ... def create(self, env_dir: AnyPath) -> None: ... def clear_directory(self, path: AnyPath) -> None: ... # undocumented @@ -67,7 +57,7 @@ if sys.version_info >= (3, 9): upgrade_deps: bool = ..., ) -> None: ... -elif sys.version_info >= (3, 6): +else: def create( env_dir: AnyPath, system_site_packages: bool = ..., @@ -77,9 +67,4 @@ elif sys.version_info >= (3, 6): prompt: Optional[str] = ..., ) -> None: ... -else: - def create( - env_dir: AnyPath, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ... - ) -> None: ... - def main(args: Optional[Sequence[str]] = ...) -> None: ... diff --git a/stdlib/3/winreg.pyi b/stdlib/3/winreg.pyi index 90cf74eae..eb28ddd21 100644 --- a/stdlib/3/winreg.pyi +++ b/stdlib/3/winreg.pyi @@ -60,9 +60,8 @@ REG_EXPAND_SZ: int REG_LINK: int REG_MULTI_SZ: int REG_NONE: int -if sys.version_info >= (3, 6): - REG_QWORD: int - REG_QWORD_LITTLE_ENDIAN: int +REG_QWORD: int +REG_QWORD_LITTLE_ENDIAN: int REG_RESOURCE_LIST: int REG_FULL_RESOURCE_DESCRIPTOR: int REG_RESOURCE_REQUIREMENTS_LIST: int