@@ -1144,8 +1144,7 @@ class Tuple(expr):
11441144 __match_args__ = ("elts" , "ctx" )
11451145 elts : list [expr ]
11461146 ctx : expr_context # Not present in Python < 3.13 if not passed to `__init__`
1147- if sys .version_info >= (3 , 9 ):
1148- dims : list [expr ]
1147+ dims : list [expr ]
11491148 if sys .version_info >= (3 , 13 ):
11501149 def __init__ (self , elts : list [expr ] = ..., ctx : expr_context = ..., ** kwargs : Unpack [_Attributes ]) -> None : ...
11511150 else :
@@ -1155,16 +1154,10 @@ class Tuple(expr):
11551154 def __replace__ (self , * , elts : list [expr ] = ..., ctx : expr_context = ..., ** kwargs : Unpack [_Attributes ]) -> Self : ...
11561155
11571156@deprecated ("Deprecated since Python 3.9." )
1158- class slice (AST ): ... # deprecated and moved to ast.py for >= (3, 9)
1157+ class slice (AST ): ...
11591158
1160- if sys .version_info >= (3 , 9 ):
1161- _Slice : typing_extensions .TypeAlias = expr
1162- _SliceAttributes : typing_extensions .TypeAlias = _Attributes
1163- else :
1164- # alias for use with variables named slice
1165- _Slice : typing_extensions .TypeAlias = slice
1166-
1167- class _SliceAttributes (TypedDict ): ...
1159+ _Slice : typing_extensions .TypeAlias = expr
1160+ _SliceAttributes : typing_extensions .TypeAlias = _Attributes
11681161
11691162class Slice (_Slice ):
11701163 if sys .version_info >= (3 , 10 ):
@@ -1187,37 +1180,26 @@ class Slice(_Slice):
11871180 ) -> Self : ...
11881181
11891182@deprecated ("Deprecated since Python 3.9. Use ast.Tuple instead." )
1190- class ExtSlice (slice ): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1191- if sys .version_info >= (3 , 9 ):
1192- def __new__ (cls , dims : Iterable [slice ] = (), ** kwargs : Unpack [_SliceAttributes ]) -> Tuple : ... # type: ignore[misc]
1193- else :
1194- dims : list [slice ]
1195- def __init__ (self , dims : list [slice ], ** kwargs : Unpack [_SliceAttributes ]) -> None : ...
1183+ class ExtSlice (slice ):
1184+ def __new__ (cls , dims : Iterable [slice ] = (), ** kwargs : Unpack [_SliceAttributes ]) -> Tuple : ... # type: ignore[misc]
11961185
11971186@deprecated ("Deprecated since Python 3.9. Use the index value directly instead." )
1198- class Index (slice ): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1199- if sys .version_info >= (3 , 9 ):
1200- def __new__ (cls , value : expr , ** kwargs : Unpack [_SliceAttributes ]) -> expr : ... # type: ignore[misc]
1201- else :
1202- value : expr
1203- def __init__ (self , value : expr , ** kwargs : Unpack [_SliceAttributes ]) -> None : ...
1187+ class Index (slice ):
1188+ def __new__ (cls , value : expr , ** kwargs : Unpack [_SliceAttributes ]) -> expr : ... # type: ignore[misc]
12041189
12051190class expr_context (AST ): ...
12061191
12071192@deprecated ("Deprecated since Python 3.9. Unused in Python 3." )
1208- class AugLoad (expr_context ): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1193+ class AugLoad (expr_context ): ...
12091194
12101195@deprecated ("Deprecated since Python 3.9. Unused in Python 3." )
1211- class AugStore (expr_context ): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1196+ class AugStore (expr_context ): ...
12121197
12131198@deprecated ("Deprecated since Python 3.9. Unused in Python 3." )
1214- class Param (expr_context ): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1199+ class Param (expr_context ): ...
12151200
12161201@deprecated ("Deprecated since Python 3.9. Unused in Python 3." )
1217- class Suite (mod ): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1218- if sys .version_info < (3 , 9 ):
1219- body : list [stmt ]
1220- def __init__ (self , body : list [stmt ]) -> None : ...
1202+ class Suite (mod ): ...
12211203
12221204class Load (expr_context ): ...
12231205class Store (expr_context ): ...
@@ -1702,8 +1684,7 @@ if sys.version_info >= (3, 12):
17021684 ) -> Self : ...
17031685
17041686class _ABC (type ):
1705- if sys .version_info >= (3 , 9 ):
1706- def __init__ (cls , * args : Unused ) -> None : ...
1687+ def __init__ (cls , * args : Unused ) -> None : ...
17071688
17081689if sys .version_info < (3 , 14 ):
17091690 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
@@ -1894,14 +1875,11 @@ if sys.version_info >= (3, 13):
18941875 show_empty : bool = False ,
18951876 ) -> str : ...
18961877
1897- elif sys . version_info >= ( 3 , 9 ) :
1878+ else :
18981879 def dump (
18991880 node : AST , annotate_fields : bool = True , include_attributes : bool = False , * , indent : int | str | None = None
19001881 ) -> str : ...
19011882
1902- else :
1903- def dump (node : AST , annotate_fields : bool = True , include_attributes : bool = False ) -> str : ...
1904-
19051883def copy_location (new_node : _T , old_node : AST ) -> _T : ...
19061884def fix_missing_locations (node : _T ) -> _T : ...
19071885def increment_lineno (node : _T , n : int = 1 ) -> _T : ...
@@ -2059,8 +2037,5 @@ class NodeTransformer(NodeVisitor):
20592037 # The usual return type is AST | None, but Iterable[AST]
20602038 # is also allowed in some cases -- this needs to be mapped.
20612039
2062- if sys .version_info >= (3 , 9 ):
2063- def unparse (ast_obj : AST ) -> str : ...
2064-
2065- if sys .version_info >= (3 , 9 ):
2066- def main () -> None : ...
2040+ def unparse (ast_obj : AST ) -> str : ...
2041+ def main () -> None : ...
0 commit comments