Skip to content

Commit 5e0d6ee

Browse files
[stdlib] Copy-edit deprecation messages (#14614)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 9bb8c4f commit 5e0d6ee

28 files changed

+191
-120
lines changed

stdlib/_frozen_importlib_external.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def spec_from_file_location(
3737
submodule_search_locations: list[str] | None = ...,
3838
) -> importlib.machinery.ModuleSpec | None: ...
3939
@deprecated(
40-
"Deprecated as of Python 3.6: Use site configuration instead. "
40+
"Deprecated since Python 3.6. Use site configuration instead. "
4141
"Future versions of Python may not enable this finder by default."
4242
)
4343
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
@@ -155,7 +155,7 @@ if sys.version_info >= (3, 11):
155155
def get_code(self, fullname: str) -> types.CodeType: ...
156156
def create_module(self, spec: ModuleSpec) -> None: ...
157157
def exec_module(self, module: types.ModuleType) -> None: ...
158-
@deprecated("load_module() is deprecated; use exec_module() instead")
158+
@deprecated("Deprecated since Python 3.10; will be removed in Python 3.15. Use `exec_module()` instead.")
159159
def load_module(self, fullname: str) -> types.ModuleType: ...
160160
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
161161
if sys.version_info < (3, 12):
@@ -177,9 +177,9 @@ else:
177177
def get_code(self, fullname: str) -> types.CodeType: ...
178178
def create_module(self, spec: ModuleSpec) -> None: ...
179179
def exec_module(self, module: types.ModuleType) -> None: ...
180-
@deprecated("load_module() is deprecated; use exec_module() instead")
181-
def load_module(self, fullname: str) -> types.ModuleType: ...
182180
if sys.version_info >= (3, 10):
181+
@deprecated("Deprecated since Python 3.10; will be removed in Python 3.15. Use `exec_module()` instead.")
182+
def load_module(self, fullname: str) -> types.ModuleType: ...
183183
@staticmethod
184184
@deprecated(
185185
"Deprecated since Python 3.4; removed in Python 3.12. "
@@ -188,6 +188,7 @@ else:
188188
def module_repr(module: types.ModuleType) -> str: ...
189189
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
190190
else:
191+
def load_module(self, fullname: str) -> types.ModuleType: ...
191192
@classmethod
192193
@deprecated(
193194
"Deprecated since Python 3.4; removed in Python 3.12. "

stdlib/abc.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ class ABCMeta(type):
2828
def register(cls: ABCMeta, subclass: type[_T]) -> type[_T]: ...
2929

3030
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
31-
@deprecated("Use 'classmethod' with 'abstractmethod' instead")
31+
@deprecated("Deprecated since Python 3.3. Use `@classmethod` stacked on top of `@abstractmethod` instead.")
3232
class abstractclassmethod(classmethod[_T, _P, _R_co]):
3333
__isabstractmethod__: Literal[True]
3434
def __init__(self, callable: Callable[Concatenate[type[_T], _P], _R_co]) -> None: ...
3535

36-
@deprecated("Use 'staticmethod' with 'abstractmethod' instead")
36+
@deprecated("Deprecated since Python 3.3. Use `@staticmethod` stacked on top of `@abstractmethod` instead.")
3737
class abstractstaticmethod(staticmethod[_P, _R_co]):
3838
__isabstractmethod__: Literal[True]
3939
def __init__(self, callable: Callable[_P, _R_co]) -> None: ...
4040

41-
@deprecated("Use 'property' with 'abstractmethod' instead")
41+
@deprecated("Deprecated since Python 3.3. Use `@property` stacked on top of `@abstractmethod` instead.")
4242
class abstractproperty(property):
4343
__isabstractmethod__: Literal[True]
4444

stdlib/annotationlib.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if sys.version_info >= (3, 14):
6464
owner: object = None,
6565
format: Format = Format.VALUE, # noqa: Y011
6666
) -> AnnotationForm: ...
67-
@deprecated("Use ForwardRef.evaluate() or typing.evaluate_forward_ref() instead.")
67+
@deprecated("Use `ForwardRef.evaluate()` or `typing.evaluate_forward_ref()` instead.")
6868
def _evaluate(
6969
self,
7070
globalns: dict[str, Any] | None,

stdlib/argparse.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ class Namespace(_AttributeHolder):
468468
__hash__: ClassVar[None] # type: ignore[assignment]
469469

470470
if sys.version_info >= (3, 14):
471-
@deprecated("Deprecated in Python 3.14; Simply open files after parsing arguments")
471+
@deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.")
472472
class FileType:
473473
# undocumented
474474
_mode: str

stdlib/ast.pyi

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,16 +1098,16 @@ class Constant(expr):
10981098
if sys.version_info < (3, 14):
10991099
# Aliases for value, for backwards compatibility
11001100
@property
1101-
@deprecated("Will be removed in Python 3.14. Use `value` instead.")
1101+
@deprecated("Removed in Python 3.14. Use `value` instead.")
11021102
def n(self) -> _ConstantValue: ...
11031103
@n.setter
1104-
@deprecated("Will be removed in Python 3.14. Use `value` instead.")
1104+
@deprecated("Removed in Python 3.14. Use `value` instead.")
11051105
def n(self, value: _ConstantValue) -> None: ...
11061106
@property
1107-
@deprecated("Will be removed in Python 3.14. Use `value` instead.")
1107+
@deprecated("Removed in Python 3.14. Use `value` instead.")
11081108
def s(self) -> _ConstantValue: ...
11091109
@s.setter
1110-
@deprecated("Will be removed in Python 3.14. Use `value` instead.")
1110+
@deprecated("Removed in Python 3.14. Use `value` instead.")
11111111
def s(self, value: _ConstantValue) -> None: ...
11121112

11131113
def __init__(self, value: _ConstantValue, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
@@ -1206,7 +1206,7 @@ class Slice(expr):
12061206
self, *, lower: expr | None = ..., upper: expr | None = ..., step: expr | None = ..., **kwargs: Unpack[_Attributes]
12071207
) -> Self: ...
12081208

1209-
@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.")
1209+
@deprecated("Deprecated since Python 3.9. Use `ast.Tuple` instead.")
12101210
class ExtSlice(slice):
12111211
def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_Attributes]) -> Tuple: ... # type: ignore[misc]
12121212

@@ -1711,23 +1711,23 @@ else:
17111711
def __init__(cls, *args: Unused) -> None: ...
17121712

17131713
if sys.version_info < (3, 14):
1714-
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
1714+
@deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
17151715
class Num(Constant, metaclass=_ABC):
17161716
def __new__(cls, n: complex, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17171717

1718-
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
1718+
@deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
17191719
class Str(Constant, metaclass=_ABC):
17201720
def __new__(cls, s: str, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17211721

1722-
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
1722+
@deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
17231723
class Bytes(Constant, metaclass=_ABC):
17241724
def __new__(cls, s: bytes, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17251725

1726-
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
1726+
@deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
17271727
class NameConstant(Constant, metaclass=_ABC):
17281728
def __new__(cls, value: _ConstantValue, kind: str | None, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17291729

1730-
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
1730+
@deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
17311731
class Ellipsis(Constant, metaclass=_ABC):
17321732
def __new__(cls, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17331733

@@ -2046,15 +2046,15 @@ class NodeVisitor:
20462046
def visit_Param(self, node: Param) -> Any: ...
20472047

20482048
if sys.version_info < (3, 14):
2049-
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2049+
@deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
20502050
def visit_Num(self, node: Num) -> Any: ... # type: ignore[deprecated]
2051-
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2051+
@deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
20522052
def visit_Str(self, node: Str) -> Any: ... # type: ignore[deprecated]
2053-
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2053+
@deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
20542054
def visit_Bytes(self, node: Bytes) -> Any: ... # type: ignore[deprecated]
2055-
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2055+
@deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
20562056
def visit_NameConstant(self, node: NameConstant) -> Any: ... # type: ignore[deprecated]
2057-
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2057+
@deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
20582058
def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated]
20592059

20602060
class NodeTransformer(NodeVisitor):

stdlib/asyncio/events.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,10 @@ class _AbstractEventLoopPolicy:
614614
if sys.version_info < (3, 14):
615615
if sys.version_info >= (3, 12):
616616
@abstractmethod
617-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
617+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
618618
def get_child_watcher(self) -> AbstractChildWatcher: ...
619619
@abstractmethod
620-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
620+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
621621
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
622622
else:
623623
@abstractmethod
@@ -643,9 +643,9 @@ else:
643643
if sys.version_info >= (3, 14):
644644
def _get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
645645
def _set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
646-
@deprecated("Deprecated as of Python 3.14; will be removed in Python 3.16")
646+
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
647647
def get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
648-
@deprecated("Deprecated as of Python 3.14; will be removed in Python 3.16")
648+
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
649649
def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
650650

651651
else:
@@ -657,9 +657,9 @@ def new_event_loop() -> AbstractEventLoop: ...
657657

658658
if sys.version_info < (3, 14):
659659
if sys.version_info >= (3, 12):
660-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
660+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
661661
def get_child_watcher() -> AbstractChildWatcher: ...
662-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
662+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
663663
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...
664664

665665
else:

stdlib/asyncio/unix_events.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if sys.platform != "win32":
4848
# So, it is special cased.
4949
if sys.version_info < (3, 14):
5050
if sys.version_info >= (3, 12):
51-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
51+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
5252
class AbstractChildWatcher:
5353
@abstractmethod
5454
def add_child_handler(
@@ -100,7 +100,7 @@ if sys.platform != "win32":
100100
def is_active(self) -> bool: ...
101101
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
102102

103-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
103+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
104104
class SafeChildWatcher(BaseChildWatcher):
105105
def __enter__(self) -> Self: ...
106106
def __exit__(
@@ -111,7 +111,7 @@ if sys.platform != "win32":
111111
) -> None: ...
112112
def remove_child_handler(self, pid: int) -> bool: ...
113113

114-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
114+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
115115
class FastChildWatcher(BaseChildWatcher):
116116
def __enter__(self) -> Self: ...
117117
def __exit__(
@@ -171,9 +171,9 @@ if sys.platform != "win32":
171171
else:
172172
class _UnixDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
173173
if sys.version_info >= (3, 12):
174-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
174+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
175175
def get_child_watcher(self) -> AbstractChildWatcher: ...
176-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
176+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
177177
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
178178
else:
179179
def get_child_watcher(self) -> AbstractChildWatcher: ...
@@ -191,7 +191,7 @@ if sys.platform != "win32":
191191

192192
if sys.version_info < (3, 14):
193193
if sys.version_info >= (3, 12):
194-
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
194+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
195195
class MultiLoopChildWatcher(AbstractChildWatcher):
196196
def is_active(self) -> bool: ...
197197
def close(self) -> None: ...

stdlib/ctypes/__init__.pyi

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,14 @@ def create_string_buffer(init: int | bytes, size: int | None = None) -> Array[c_
162162
c_buffer = create_string_buffer
163163

164164
def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ...
165-
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15")
166-
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
165+
166+
if sys.version_info >= (3, 13):
167+
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
168+
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
169+
170+
else:
171+
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
172+
167173
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove
168174

169175
if sys.platform == "win32":

stdlib/glob.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ if sys.version_info >= (3, 13):
1010
__all__ += ["translate"]
1111

1212
if sys.version_info >= (3, 10):
13-
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.")
13+
@deprecated(
14+
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
15+
)
1416
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
15-
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.")
17+
@deprecated(
18+
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
19+
)
1620
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
1721

1822
else:

stdlib/http/server.pyi

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,24 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
119119
def guess_type(self, path: StrPath) -> str: ... # undocumented
120120

121121
def executable(path: StrPath) -> bool: ... # undocumented
122-
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15")
123-
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
124-
cgi_directories: list[str]
125-
have_fork: bool # undocumented
126-
def do_POST(self) -> None: ...
127-
def is_cgi(self) -> bool: ... # undocumented
128-
def is_executable(self, path: StrPath) -> bool: ... # undocumented
129-
def is_python(self, path: StrPath) -> bool: ... # undocumented
130-
def run_cgi(self) -> None: ... # undocumented
122+
123+
if sys.version_info >= (3, 13):
124+
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
125+
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
126+
cgi_directories: list[str]
127+
have_fork: bool # undocumented
128+
def do_POST(self) -> None: ...
129+
def is_cgi(self) -> bool: ... # undocumented
130+
def is_executable(self, path: StrPath) -> bool: ... # undocumented
131+
def is_python(self, path: StrPath) -> bool: ... # undocumented
132+
def run_cgi(self) -> None: ... # undocumented
133+
134+
else:
135+
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
136+
cgi_directories: list[str]
137+
have_fork: bool # undocumented
138+
def do_POST(self) -> None: ...
139+
def is_cgi(self) -> bool: ... # undocumented
140+
def is_executable(self, path: StrPath) -> bool: ... # undocumented
141+
def is_python(self, path: StrPath) -> bool: ... # undocumented
142+
def run_cgi(self) -> None: ... # undocumented

0 commit comments

Comments
 (0)