Skip to content

Commit c5a459f

Browse files
committed
@deprecated is in warnings as of Python 3.13
1 parent 70761f8 commit c5a459f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

reorder_python_imports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ def _fix_file(
469469
'typing_extensions=typing:no_type_check_decorator',
470470
))
471471
REPLACES[(3, 7)].update((
472-
'mypy_extensions=typing:NoReturn',
473472
'typing_extensions=typing:ChainMap',
474473
'typing_extensions=typing:Counter',
475474
'typing_extensions=typing:Deque',
@@ -542,6 +541,7 @@ def _fix_file(
542541
'typing_extensions=typing:get_protocol_members',
543542
'typing_extensions=typing:is_protocol',
544543
'typing_extensions=typing:runtime_checkable',
544+
'typing_extensions=warnings:deprecated',
545545
))
546546
# END GENERATED
547547

testing/generate-typing-rewrite-info

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import typing_extensions
4242
# the first one on py313+, and (Async)ContextManager now has an optional
4343
# second parameter with a default value; typing_extensions backports these
4444
# changes.
45+
# - @deprecated was added to warnings in Python 3.13.
4546
CUSTOM_TYPING_EXT_SYMBOLS = {
4647
(3, 9): {'get_type_hints'},
4748
(3, 10): {'get_origin', 'get_args', 'Literal', 'NewType'},
@@ -54,7 +55,7 @@ CUSTOM_TYPING_EXT_SYMBOLS = {
5455
(3, 13): {
5556
'AsyncContextManager', 'ContextManager', 'AsyncGenerator', 'Generator',
5657
'TypeVar', 'TypeVarTuple', 'ParamSpec', 'TypedDict', 'Protocol',
57-
'runtime_checkable',
58+
'runtime_checkable', 'warnings:deprecated',
5859
},
5960
}
6061

@@ -110,7 +111,11 @@ def main() -> int:
110111
for s in attrs & typing_extensions_all
111112
}
112113
for v, attrs in CUSTOM_TYPING_EXT_SYMBOLS.items():
113-
replaces[v] |= {f'typing_extensions=typing:{s}' for s in attrs}
114+
imps = (
115+
s if ':' in s else f'typing:{s}'
116+
for s in attrs
117+
)
118+
replaces[v] |= {f'typing_extensions={i}' for i in imps}
114119

115120
print(f'# GENERATED VIA {os.path.basename(sys.argv[0])}')
116121
print('# Using:')

0 commit comments

Comments
 (0)