diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 4c14c4639a39..1a8702ddad94 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -91,40 +91,27 @@ class _ActionsContainer: version: str = ..., **kwargs: Any, ) -> Action: ... - if sys.version_info >= (3, 14): - @overload - def add_argument_group( - self, - title: str | None = None, - description: str | None = None, - *, - # argument_default's type must be valid for the arguments in the group - argument_default: Any = ..., - conflict_handler: str = ..., - ) -> _ArgumentGroup: ... - @overload - @deprecated("The `prefix_chars` parameter deprecated since Python 3.14.") - def add_argument_group( - self, - title: str | None = None, - description: str | None = None, - *, - prefix_chars: str, - argument_default: Any = ..., - conflict_handler: str = ..., - ) -> _ArgumentGroup: ... - else: - def add_argument_group( - self, - title: str | None = None, - description: str | None = None, - *, - prefix_chars: str = ..., - # argument_default's type must be valid for the arguments in the group - argument_default: Any = ..., - conflict_handler: str = ..., - ) -> _ArgumentGroup: ... - + @overload + def add_argument_group( + self, + title: str | None = None, + description: str | None = None, + *, + # argument_default's type must be valid for the arguments in the group + argument_default: Any = ..., + conflict_handler: str = ..., + ) -> _ArgumentGroup: ... + @overload + @deprecated("The `prefix_chars` parameter deprecated since Python 3.14.") + def add_argument_group( + self, + title: str | None = None, + description: str | None = None, + *, + prefix_chars: str, + argument_default: Any = ..., + conflict_handler: str = ..., + ) -> _ArgumentGroup: ... def add_mutually_exclusive_group(self, *, required: bool = False) -> _MutuallyExclusiveGroup: ... def _add_action(self, action: _ActionT) -> _ActionT: ... def _remove_action(self, action: Action) -> None: ... @@ -535,69 +522,42 @@ class Namespace(_AttributeHolder): def __eq__(self, other: object) -> bool: ... __hash__: ClassVar[None] # type: ignore[assignment] -if sys.version_info >= (3, 14): - @deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.") - class FileType: - # undocumented - _mode: str - _bufsize: int - _encoding: str | None - _errors: str | None - def __init__( - self, mode: str = "r", bufsize: int = -1, encoding: str | None = None, errors: str | None = None - ) -> None: ... - def __call__(self, string: str) -> IO[Any]: ... - -else: - class FileType: - # undocumented - _mode: str - _bufsize: int - _encoding: str | None - _errors: str | None - def __init__( - self, mode: str = "r", bufsize: int = -1, encoding: str | None = None, errors: str | None = None - ) -> None: ... - def __call__(self, string: str) -> IO[Any]: ... +@deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.") +class FileType: + # undocumented + _mode: str + _bufsize: int + _encoding: str | None + _errors: str | None + def __init__(self, mode: str = "r", bufsize: int = -1, encoding: str | None = None, errors: str | None = None) -> None: ... + def __call__(self, string: str) -> IO[Any]: ... # undocumented class _ArgumentGroup(_ActionsContainer): title: str | None _group_actions: list[Action] - if sys.version_info >= (3, 14): - @overload - def __init__( - self, - container: _ActionsContainer, - title: str | None = None, - description: str | None = None, - *, - argument_default: Any = ..., - conflict_handler: str = ..., - ) -> None: ... - @overload - @deprecated("Undocumented `prefix_chars` parameter is deprecated since Python 3.14.") - def __init__( - self, - container: _ActionsContainer, - title: str | None = None, - description: str | None = None, - *, - prefix_chars: str, - argument_default: Any = ..., - conflict_handler: str = ..., - ) -> None: ... - else: - def __init__( - self, - container: _ActionsContainer, - title: str | None = None, - description: str | None = None, - *, - prefix_chars: str = ..., - argument_default: Any = ..., - conflict_handler: str = ..., - ) -> None: ... + @overload + def __init__( + self, + container: _ActionsContainer, + title: str | None = None, + description: str | None = None, + *, + argument_default: Any = ..., + conflict_handler: str = ..., + ) -> None: ... + @overload + @deprecated("Undocumented `prefix_chars` parameter is deprecated since Python 3.14.") + def __init__( + self, + container: _ActionsContainer, + title: str | None = None, + description: str | None = None, + *, + prefix_chars: str, + argument_default: Any = ..., + conflict_handler: str = ..., + ) -> None: ... # undocumented class _MutuallyExclusiveGroup(_ArgumentGroup): diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index a8cbbcd10517..b3a6c18fd2b9 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -631,18 +631,12 @@ else: @abstractmethod def new_event_loop(self) -> AbstractEventLoop: ... # Child processes handling (Unix only). - if sys.version_info >= (3, 12): - @abstractmethod - @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") - def get_child_watcher(self) -> AbstractChildWatcher: ... - @abstractmethod - @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") - def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... - else: - @abstractmethod - def get_child_watcher(self) -> AbstractChildWatcher: ... - @abstractmethod - def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... + @abstractmethod + @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") + def get_child_watcher(self) -> AbstractChildWatcher: ... + @abstractmethod + @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") + def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... AbstractEventLoopPolicy = _AbstractEventLoopPolicy @@ -661,25 +655,16 @@ else: if sys.version_info >= (3, 14): def _get_event_loop_policy() -> _AbstractEventLoopPolicy: ... def _set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ... - @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.") - def get_event_loop_policy() -> _AbstractEventLoopPolicy: ... - @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.") - def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ... - -else: - def get_event_loop_policy() -> _AbstractEventLoopPolicy: ... - def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ... +@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.") +def get_event_loop_policy() -> _AbstractEventLoopPolicy: ... +@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.") +def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ... def set_event_loop(loop: AbstractEventLoop | None) -> None: ... def new_event_loop() -> AbstractEventLoop: ... if sys.version_info < (3, 14): - if sys.version_info >= (3, 12): - @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") - def get_child_watcher() -> AbstractChildWatcher: ... - @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") - def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... - - else: - def get_child_watcher() -> AbstractChildWatcher: ... - def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... + @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") + def get_child_watcher() -> AbstractChildWatcher: ... + @deprecated("Deprecated since Python 3.12; removed in Python 3.14.") + def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index c323ab6c99a6..9bb8bb0edc29 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -165,16 +165,10 @@ def create_string_buffer(init: int | bytes, size: int | None = None) -> Array[c_ c_buffer = create_string_buffer def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ... - -if sys.version_info >= (3, 13): - @deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.") - def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ... - @deprecated("Soft deprecated since Python 3.13. Use multiplication instead.") - def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... - -else: - def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ... - def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... +@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.") +def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ... +@deprecated("Soft deprecated since Python 3.13. Use multiplication instead.") +def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... if sys.platform == "win32": def DllCanUnloadNow() -> int: ... diff --git a/stdlib/http/server.pyi b/stdlib/http/server.pyi index 2c1a374331bc..048eb49541e9 100644 --- a/stdlib/http/server.pyi +++ b/stdlib/http/server.pyi @@ -119,24 +119,12 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): def guess_type(self, path: StrPath) -> str: ... # undocumented def executable(path: StrPath) -> bool: ... # undocumented - -if sys.version_info >= (3, 13): - @deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.") - class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): - cgi_directories: list[str] - have_fork: bool # undocumented - def do_POST(self) -> None: ... - def is_cgi(self) -> bool: ... # undocumented - def is_executable(self, path: StrPath) -> bool: ... # undocumented - def is_python(self, path: StrPath) -> bool: ... # undocumented - def run_cgi(self) -> None: ... # undocumented - -else: - class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): - cgi_directories: list[str] - have_fork: bool # undocumented - def do_POST(self) -> None: ... - def is_cgi(self) -> bool: ... # undocumented - def is_executable(self, path: StrPath) -> bool: ... # undocumented - def is_python(self, path: StrPath) -> bool: ... # undocumented - def run_cgi(self) -> None: ... # undocumented +@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.") +class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): + cgi_directories: list[str] + have_fork: bool # undocumented + def do_POST(self) -> None: ... + def is_cgi(self) -> bool: ... # undocumented + def is_executable(self, path: StrPath) -> bool: ... # undocumented + def is_python(self, path: StrPath) -> bool: ... # undocumented + def run_cgi(self) -> None: ... # undocumented diff --git a/stdlib/importlib/resources/__init__.pyi b/stdlib/importlib/resources/__init__.pyi index c7e6b170be47..5e58ddf310c9 100644 --- a/stdlib/importlib/resources/__init__.pyi +++ b/stdlib/importlib/resources/__init__.pyi @@ -62,11 +62,8 @@ else: def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ... def path(package: Package, resource: Resource) -> AbstractContextManager[Path, Literal[False]]: ... def is_resource(package: Package, name: str) -> bool: ... - if sys.version_info >= (3, 11): - @deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.") - def contents(package: Package) -> Iterator[str]: ... - else: - def contents(package: Package) -> Iterator[str]: ... + @deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.") + def contents(package: Package) -> Iterator[str]: ... if sys.version_info >= (3, 11): from importlib.resources._common import as_file as as_file diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 44f9315678e0..1be68ec51634 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -138,11 +138,8 @@ def getpreferredencoding(do_setlocale: bool = True) -> _str: ... def normalize(localename: _str) -> _str: ... if sys.version_info < (3, 13): - if sys.version_info >= (3, 11): - @deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.") - def resetlocale(category: int = ...) -> None: ... - else: - def resetlocale(category: int = ...) -> None: ... + @deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.") + def resetlocale(category: int = ...) -> None: ... if sys.version_info < (3, 12): @deprecated("Deprecated since Python 3.7; removed in Python 3.12. Use `locale.format_string()` instead.") diff --git a/stdlib/nturl2path.pyi b/stdlib/nturl2path.pyi index 014af8a0fd2e..98686ed65420 100644 --- a/stdlib/nturl2path.pyi +++ b/stdlib/nturl2path.pyi @@ -1,12 +1,6 @@ -import sys from typing_extensions import deprecated -if sys.version_info >= (3, 14): - @deprecated("The `nturl2path` module is deprecated since Python 3.14.") - def url2pathname(url: str) -> str: ... - @deprecated("The `nturl2path` module is deprecated since Python 3.14.") - def pathname2url(p: str) -> str: ... - -else: - def url2pathname(url: str) -> str: ... - def pathname2url(p: str) -> str: ... +@deprecated("The `nturl2path` module is deprecated since Python 3.14.") +def url2pathname(url: str) -> str: ... +@deprecated("The `nturl2path` module is deprecated since Python 3.14.") +def pathname2url(p: str) -> str: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index e45bdf2c8237..506623905a9d 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -1404,48 +1404,27 @@ class _wrap_close: def write(self, s: str, /) -> int: ... def writelines(self, lines: Iterable[str], /) -> None: ... -if sys.version_info >= (3, 14): - @deprecated("Soft deprecated. Use the subprocess module instead.") - def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ... - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig - -else: - def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ... - def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... - def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig +@deprecated("Soft deprecated. Use the subprocess module instead.") +def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ... +@deprecated("Soft deprecated. Use the subprocess module instead.") +def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... +@deprecated("Soft deprecated. Use the subprocess module instead.") +def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig if sys.platform != "win32": - if sys.version_info >= (3, 14): - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... - - else: - def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... - def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... - -else: - if sys.version_info >= (3, 14): - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ... - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ... - - else: - def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ... - def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ... - -if sys.version_info >= (3, 14): @deprecated("Soft deprecated. Use the subprocess module instead.") - def system(command: StrOrBytesPath) -> int: ... + def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... else: - def system(command: StrOrBytesPath) -> int: ... + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ... + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ... +@deprecated("Soft deprecated. Use the subprocess module instead.") +def system(command: StrOrBytesPath) -> int: ... @final class times_result(structseq[float], tuple[float, float, float, float, float]): __match_args__: Final = ("user", "system", "children_user", "children_system", "elapsed") @@ -1470,22 +1449,14 @@ if sys.platform == "win32": ) -> None: ... else: - if sys.version_info >= (3, 14): - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... - @deprecated("Soft deprecated. Use the subprocess module instead.") - def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... - - else: - def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... - def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature - def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... - def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... - + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... + @deprecated("Soft deprecated. Use the subprocess module instead.") + def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... def wait() -> tuple[int, int]: ... # Unix only # Added to MacOS in 3.13 if sys.platform != "darwin" or sys.version_info >= (3, 13): diff --git a/stdlib/pathlib/__init__.pyi b/stdlib/pathlib/__init__.pyi index 12cd36425d13..c3d035b0876a 100644 --- a/stdlib/pathlib/__init__.pyi +++ b/stdlib/pathlib/__init__.pyi @@ -103,14 +103,12 @@ class PurePath(PathLike[str]): def is_reserved(self) -> bool: ... if sys.version_info >= (3, 14): def is_relative_to(self, other: StrPath) -> bool: ... - elif sys.version_info >= (3, 12): + else: @overload def is_relative_to(self, other: StrPath, /) -> bool: ... @overload @deprecated("Passing additional arguments is deprecated since Python 3.12; removed in Python 3.14.") def is_relative_to(self, other: StrPath, /, *_deprecated: StrPath) -> bool: ... - else: - def is_relative_to(self, *other: StrPath) -> bool: ... if sys.version_info >= (3, 12): def match(self, path_pattern: str, *, case_sensitive: bool | None = None) -> bool: ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index 7c70dcc4c5ab..723f670e1619 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -39,14 +39,10 @@ if sys.version_info < (3, 12): def __init__(self, fullname: str, file: IO[str], filename: StrOrBytesPath, etc: tuple[str, str, int]) -> None: ... if sys.version_info < (3, 14): - if sys.version_info >= (3, 12): - @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.") - def find_loader(fullname: str) -> LoaderProtocol | None: ... - @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.") - def get_loader(module_or_name: str) -> LoaderProtocol | None: ... - else: - def find_loader(fullname: str) -> LoaderProtocol | None: ... - def get_loader(module_or_name: str) -> LoaderProtocol | None: ... + @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.") + def find_loader(fullname: str) -> LoaderProtocol | None: ... + @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.") + def get_loader(module_or_name: str) -> LoaderProtocol | None: ... def get_importer(path_item: StrOrBytesPath) -> PathEntryFinderProtocol | None: ... def iter_importers(fullname: str = "") -> Iterator[MetaPathFinderProtocol | PathEntryFinderProtocol]: ... diff --git a/stdlib/pty.pyi b/stdlib/pty.pyi index 2b7a605e50e0..e74c02ab1e1e 100644 --- a/stdlib/pty.pyi +++ b/stdlib/pty.pyi @@ -15,14 +15,10 @@ if sys.platform != "win32": def openpty() -> tuple[int, int]: ... if sys.version_info < (3, 14): - if sys.version_info >= (3, 12): - @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.") - def master_open() -> tuple[int, str]: ... - @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.") - def slave_open(tty_name: str) -> int: ... - else: - def master_open() -> tuple[int, str]: ... - def slave_open(tty_name: str) -> int: ... + @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.") + def master_open() -> tuple[int, str]: ... + @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.") + def slave_open(tty_name: str) -> int: ... def fork() -> tuple[int, int]: ... def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 59be9438015a..cd89d4e05167 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -32,14 +32,8 @@ def stripid(text: str) -> str: ... def allmethods(cl: type) -> MutableMapping[str, MethodType]: ... def visiblename(name: str, all: Container[str] | None = None, obj: object = None) -> bool: ... def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ... - -if sys.version_info >= (3, 13): - @deprecated("Deprecated since Python 3.13.") - def ispackage(path: StrPath) -> bool: ... # undocumented - -else: - def ispackage(path: StrPath) -> bool: ... # undocumented - +@deprecated("Deprecated since Python 3.13.") +def ispackage(path: StrPath) -> bool: ... # undocumented def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ... def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = {}) -> str | None: ... diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 2fb1bd0d6c96..2c81aa93eca5 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -318,8 +318,5 @@ def escape(pattern: AnyStr) -> AnyStr: ... def purge() -> None: ... if sys.version_info < (3, 13): - if sys.version_info >= (3, 11): - @deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `re.compile()` instead.") - def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... # undocumented - else: - def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... # undocumented + @deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `re.compile()` instead.") + def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... # undocumented diff --git a/stdlib/symtable.pyi b/stdlib/symtable.pyi index 4142e7c3f52e..d915d2e97dc8 100644 --- a/stdlib/symtable.pyi +++ b/stdlib/symtable.pyi @@ -52,11 +52,8 @@ class Function(SymbolTable): def get_nonlocals(self) -> tuple[str, ...]: ... class Class(SymbolTable): - if sys.version_info >= (3, 14): - @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.") - def get_methods(self) -> tuple[str, ...]: ... - else: - def get_methods(self) -> tuple[str, ...]: ... + @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.") + def get_methods(self) -> tuple[str, ...]: ... class Symbol: def __init__( diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 1251fdc444ec..2ced4364fc65 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -40,17 +40,18 @@ def get_platform() -> str: ... if sys.version_info >= (3, 15): def is_python_build() -> bool: ... -elif sys.version_info >= (3, 12): +elif sys.version_info >= (3, 11): @overload def is_python_build() -> bool: ... @overload @deprecated("The `check_home` parameter is deprecated since Python 3.12; removed in Python 3.15.") def is_python_build(check_home: object = None) -> bool: ... -elif sys.version_info >= (3, 11): - def is_python_build(check_home: object = None) -> bool: ... - else: + @overload + def is_python_build() -> bool: ... + @overload + @deprecated("The `check_home` parameter is deprecated since Python 3.12; removed in Python 3.15.") def is_python_build(check_home: bool = False) -> bool: ... def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = None) -> dict[str, Any]: ... diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index a046fa3e4e1f..3301eaa2468b 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -805,16 +805,12 @@ class TarInfo: gname: str pax_headers: Mapping[str, str] def __init__(self, name: str = "") -> None: ... - if sys.version_info >= (3, 13): - @property - @deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.") - def tarfile(self) -> TarFile | None: ... - @tarfile.setter - @deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.") - def tarfile(self, tarfile: TarFile | None) -> None: ... - else: - tarfile: TarFile | None - + @property + @deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.") + def tarfile(self) -> TarFile | None: ... + @tarfile.setter + @deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.") + def tarfile(self, tarfile: TarFile | None) -> None: ... @classmethod def frombuf(cls, buf: bytes | bytearray, encoding: str, errors: str) -> Self: ... @classmethod diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index c6fe017c79ca..0520a55c92e2 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -326,21 +326,14 @@ class Variable: def trace_add(self, mode: Literal["array", "read", "write", "unset"], callback: Callable[[str, str, str], object]) -> str: ... def trace_remove(self, mode: Literal["array", "read", "write", "unset"], cbname: str) -> None: ... def trace_info(self) -> list[tuple[tuple[Literal["array", "read", "write", "unset"], ...], str]]: ... - if sys.version_info >= (3, 14): - @deprecated("Deprecated since Python 3.14. Use `trace_add()` instead.") - def trace(self, mode, callback) -> str: ... - @deprecated("Deprecated since Python 3.14. Use `trace_add()` instead.") - def trace_variable(self, mode, callback) -> str: ... - @deprecated("Deprecated since Python 3.14. Use `trace_remove()` instead.") - def trace_vdelete(self, mode, cbname) -> None: ... - @deprecated("Deprecated since Python 3.14. Use `trace_info()` instead.") - def trace_vinfo(self) -> list[Incomplete]: ... - else: - def trace(self, mode, callback) -> str: ... - def trace_variable(self, mode, callback) -> str: ... - def trace_vdelete(self, mode, cbname) -> None: ... - def trace_vinfo(self) -> list[Incomplete]: ... - + @deprecated("Deprecated since Python 3.14. Use `trace_add()` instead.") + def trace(self, mode, callback) -> str: ... + @deprecated("Deprecated since Python 3.14. Use `trace_add()` instead.") + def trace_variable(self, mode, callback) -> str: ... + @deprecated("Deprecated since Python 3.14. Use `trace_remove()` instead.") + def trace_vdelete(self, mode, cbname) -> None: ... + @deprecated("Deprecated since Python 3.14. Use `trace_info()` instead.") + def trace_vinfo(self) -> list[Incomplete]: ... def __eq__(self, other: object) -> bool: ... def __del__(self) -> None: ... __hash__: ClassVar[None] # type: ignore[assignment] diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 6db0e3852f9b..995b30a919b3 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -422,12 +422,8 @@ def overload(func: _F) -> _F: ... def no_type_check(arg: _F) -> _F: ... if sys.version_info < (3, 15): - if sys.version_info >= (3, 13): - @deprecated("Deprecated since Python 3.13; removed in Python 3.15.") - def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... - - else: - def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... + @deprecated("Deprecated since Python 3.13; removed in Python 3.15.") + def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... if sys.version_info >= (3, 15): def disjoint_base(cls: _TC) -> _TC: ... diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index 251a394585f3..0d92b78f3461 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -35,38 +35,21 @@ class TestLoader: defaultTestLoader: TestLoader if sys.version_info < (3, 13): - if sys.version_info >= (3, 11): - @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") - def getTestCaseNames( - testCaseClass: type[unittest.case.TestCase], - prefix: str, - sortUsing: _SortComparisonMethod = ..., - testNamePatterns: list[str] | None = None, - ) -> Sequence[str]: ... - @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") - def makeSuite( - testCaseClass: type[unittest.case.TestCase], - prefix: str = "test", - sortUsing: _SortComparisonMethod = ..., - suiteClass: _SuiteClass = ..., - ) -> unittest.suite.TestSuite: ... - @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") - def findTestCases( - module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... - ) -> unittest.suite.TestSuite: ... - else: - def getTestCaseNames( - testCaseClass: type[unittest.case.TestCase], - prefix: str, - sortUsing: _SortComparisonMethod = ..., - testNamePatterns: list[str] | None = None, - ) -> Sequence[str]: ... - def makeSuite( - testCaseClass: type[unittest.case.TestCase], - prefix: str = "test", - sortUsing: _SortComparisonMethod = ..., - suiteClass: _SuiteClass = ..., - ) -> unittest.suite.TestSuite: ... - def findTestCases( - module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... - ) -> unittest.suite.TestSuite: ... + @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") + def getTestCaseNames( + testCaseClass: type[unittest.case.TestCase], + prefix: str, + sortUsing: _SortComparisonMethod = ..., + testNamePatterns: list[str] | None = None, + ) -> Sequence[str]: ... + @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") + def makeSuite( + testCaseClass: type[unittest.case.TestCase], + prefix: str = "test", + sortUsing: _SortComparisonMethod = ..., + suiteClass: _SuiteClass = ..., + ) -> unittest.suite.TestSuite: ... + @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") + def findTestCases( + module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... + ) -> unittest.suite.TestSuite: ... diff --git a/stdlib/unittest/main.pyi b/stdlib/unittest/main.pyi index e1aeac32c591..f48347c16ec3 100644 --- a/stdlib/unittest/main.pyi +++ b/stdlib/unittest/main.pyi @@ -64,11 +64,8 @@ class TestProgram: ) -> None: ... if sys.version_info < (3, 13): - if sys.version_info >= (3, 11): - @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") - def usageExit(self, msg: Any = None) -> None: ... - else: - def usageExit(self, msg: Any = None) -> None: ... + @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") + def usageExit(self, msg: Any = None) -> None: ... def parseArgs(self, argv: list[str]) -> None: ... def createTests(self, from_discovery: bool = False, Loader: unittest.loader.TestLoader | None = None) -> None: ... diff --git a/stdlib/wave.pyi b/stdlib/wave.pyi index 0692d462f002..6ed91b097dba 100644 --- a/stdlib/wave.pyi +++ b/stdlib/wave.pyi @@ -43,16 +43,11 @@ class Wave_read: def getcomptype(self) -> str: ... def getcompname(self) -> str: ... def getparams(self) -> _wave_params: ... - if sys.version_info >= (3, 15): - pass - elif sys.version_info >= (3, 13): + if sys.version_info < (3, 15): @deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.") def getmarkers(self) -> None: ... @deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.") def getmark(self, id: Any) -> NoReturn: ... - else: - def getmarkers(self) -> None: ... - def getmark(self, id: Any) -> NoReturn: ... def setpos(self, pos: int) -> None: ... def readframes(self, nframes: int) -> bytes: ... diff --git a/stdlib/webbrowser.pyi b/stdlib/webbrowser.pyi index 56c30f872727..40b57c3c6a09 100644 --- a/stdlib/webbrowser.pyi +++ b/stdlib/webbrowser.pyi @@ -64,16 +64,10 @@ if sys.platform == "win32": if sys.platform == "darwin": if sys.version_info < (3, 13): - if sys.version_info >= (3, 11): - @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") - class MacOSX(BaseBrowser): - def __init__(self, name: str) -> None: ... - def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... - - else: - class MacOSX(BaseBrowser): - def __init__(self, name: str) -> None: ... - def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... + @deprecated("Deprecated since Python 3.11; removed in Python 3.13.") + class MacOSX(BaseBrowser): + def __init__(self, name: str) -> None: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename` if sys.version_info >= (3, 11):