@@ -1096,8 +1096,16 @@ class Constant(expr):
1096
1096
kind : str | None
1097
1097
if sys .version_info < (3 , 14 ):
1098
1098
# Aliases for value, for backwards compatibility
1099
- s : _ConstantValue
1100
- n : _ConstantValue
1099
+ @deprecated ("Will be removed in Python 3.14; use value instead" )
1100
+ @property
1101
+ def n (self ) -> _ConstantValue : ...
1102
+ @n .setter
1103
+ def n (self , value : _ConstantValue ) -> None : ...
1104
+ @deprecated ("Will be removed in Python 3.14; use value instead" )
1105
+ @property
1106
+ def s (self ) -> _ConstantValue : ...
1107
+ @s .setter
1108
+ def s (self , value : _ConstantValue ) -> None : ...
1101
1109
1102
1110
def __init__ (self , value : _ConstantValue , kind : str | None = None , ** kwargs : Unpack [_Attributes ]) -> None : ...
1103
1111
@@ -1495,11 +1503,11 @@ if sys.version_info >= (3, 10):
1495
1503
1496
1504
class MatchSingleton (pattern ):
1497
1505
__match_args__ = ("value" ,)
1498
- value : Literal [ True , False ] | None
1499
- def __init__ (self , value : Literal [ True , False ] | None , ** kwargs : Unpack [_Attributes [int ]]) -> None : ...
1506
+ value : bool | None
1507
+ def __init__ (self , value : bool | None , ** kwargs : Unpack [_Attributes [int ]]) -> None : ...
1500
1508
1501
1509
if sys .version_info >= (3 , 14 ):
1502
- def __replace__ (self , * , value : Literal [ True , False ] | None = ..., ** kwargs : Unpack [_Attributes [int ]]) -> Self : ...
1510
+ def __replace__ (self , * , value : bool | None = ..., ** kwargs : Unpack [_Attributes [int ]]) -> Self : ...
1503
1511
1504
1512
class MatchSequence (pattern ):
1505
1513
__match_args__ = ("patterns" ,)
@@ -1696,25 +1704,23 @@ class _ABC(type):
1696
1704
if sys .version_info < (3 , 14 ):
1697
1705
@deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1698
1706
class Num (Constant , metaclass = _ABC ):
1699
- value : int | float | complex
1707
+ def __new__ ( cls , n : complex , ** kwargs : Unpack [ _Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
1700
1708
1701
1709
@deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1702
1710
class Str (Constant , metaclass = _ABC ):
1703
- value : str
1704
- # Aliases for value, for backwards compatibility
1705
- s : str
1711
+ def __new__ (cls , s : str , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
1706
1712
1707
1713
@deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1708
1714
class Bytes (Constant , metaclass = _ABC ):
1709
- value : bytes
1710
- # Aliases for value, for backwards compatibility
1711
- s : bytes
1715
+ def __new__ (cls , s : bytes , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
1712
1716
1713
1717
@deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1714
- class NameConstant (Constant , metaclass = _ABC ): ...
1718
+ class NameConstant (Constant , metaclass = _ABC ):
1719
+ def __new__ (cls , value : _ConstantValue , kind : str | None , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
1715
1720
1716
1721
@deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1717
- class Ellipsis (Constant , metaclass = _ABC ): ...
1722
+ class Ellipsis (Constant , metaclass = _ABC ):
1723
+ def __new__ (cls , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
1718
1724
1719
1725
# everything below here is defined in ast.py
1720
1726
@@ -1797,7 +1803,7 @@ if sys.version_info >= (3, 13):
1797
1803
type_comments : bool = False ,
1798
1804
feature_version : None | int | tuple [int , int ] = None ,
1799
1805
optimize : Literal [- 1 , 0 , 1 , 2 ] = - 1 ,
1800
- ) -> AST : ...
1806
+ ) -> mod : ...
1801
1807
1802
1808
else :
1803
1809
@overload
@@ -1868,7 +1874,7 @@ else:
1868
1874
* ,
1869
1875
type_comments : bool = False ,
1870
1876
feature_version : None | int | tuple [int , int ] = None ,
1871
- ) -> AST : ...
1877
+ ) -> mod : ...
1872
1878
1873
1879
def literal_eval (node_or_string : str | AST ) -> Any : ...
1874
1880
0 commit comments