Skip to content

Commit 5aef831

Browse files
authored
Merge pull request #410 from jatoben/warnings-deprecated
Rewrite `@deprecated` from `typing_extensions` to `warnings`
2 parents 70761f8 + a47810b commit 5aef831

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

reorder_python_imports.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ def _fix_file(
420420
# GENERATED VIA generate-typing-rewrite-info
421421
# Using:
422422
# flake8-typing-imports==1.16.0
423-
# mypy-extensions==1.0.0
424-
# typing-extensions==4.12.2
423+
# mypy-extensions==1.1.0
424+
# typing-extensions==4.13.2
425425
REPLACES[(3, 6)].update((
426426
'typing_extensions=typing:AbstractSet',
427427
'typing_extensions=typing:AnyStr',
@@ -542,6 +542,7 @@ def _fix_file(
542542
'typing_extensions=typing:get_protocol_members',
543543
'typing_extensions=typing:is_protocol',
544544
'typing_extensions=typing:runtime_checkable',
545+
'typing_extensions=warnings:deprecated',
545546
))
546547
# END GENERATED
547548

testing/generate-typing-rewrite-info

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main() -> int:
6565
typing_extensions_version = version('typing_extensions')
6666

6767
mypy_extensions_all = frozenset(
68-
a for a in dir(mypy_extensions) if a != 'Any'
68+
a for a in dir(mypy_extensions) if a not in {'Any', 'Dict'}
6969
)
7070
typing_extensions_all = frozenset(typing_extensions.__all__) - {
7171
sym for v in CUSTOM_TYPING_EXT_SYMBOLS.values() for sym in v
@@ -112,6 +112,12 @@ def main() -> int:
112112
for v, attrs in CUSTOM_TYPING_EXT_SYMBOLS.items():
113113
replaces[v] |= {f'typing_extensions=typing:{s}' for s in attrs}
114114

115+
# NoReturn was removed from mypy_extensions
116+
replaces[(3, 7)].add('mypy_extensions=typing:NoReturn')
117+
118+
# @deprecated was added to warnings in Python 3.13.
119+
replaces[(3, 13)].add('typing_extensions=warnings:deprecated')
120+
115121
print(f'# GENERATED VIA {os.path.basename(sys.argv[0])}')
116122
print('# Using:')
117123
print(f'# flake8-typing-imports=={flake8_typing_imports_version}')

0 commit comments

Comments
 (0)