8000 ast: mark ast.Num etc. as deprecated by JelleZijlstra · Pull Request #10994 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

as 8000 t: mark ast.Num etc. as deprecated #10994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@
"reportOverlappingOverload": "none",
// The name of the self/cls parameter is out of typeshed's control.
"reportSelfClsParameterName": "none",
// Not actionable in typeshed
"reportDeprecated": "none",
}
2 changes: 2 additions & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,6 @@
"reportOverlappingOverload": "none",
// The name of the self/cls parameter is out of typeshed's control.
"reportSelfClsParameterName": "none",
// Not actionable in typeshed
"reportDeprecated": "none",
}
11 changes: 7 additions & 4 deletions stdlib/ast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,30 @@ from _ast import *
from _typeshed import ReadableBuffer, Unused
from collections.abc import Iterator
from typing import Any, TypeVar as _TypeVar, overload
from typing_extensions import Literal
from typing_extensions import Literal, deprecated

if sys.version_info >= (3, 8):
class _ABC(type):
if sys.version_info >= (3, 9):
def __init__(cls, *args: Unused) -> None: ...

@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Num(Constant, metaclass=_ABC):
value: int | float | complex

@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Str(Constant, metaclass=_ABC):
value: str
# Aliases for value, for backwards compatibility
s: str

@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Bytes(Constant, metaclass=_ABC):
value: bytes
# Aliases for value, for backwards compatibility
s: bytes

@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class NameConstant(Constant, metaclass=_ABC): ...

@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Ellipsis(Constant, metaclass=_ABC): ...

if sys.version_info >= (3, 9):
Expand Down
0