@@ -1095,20 +1095,28 @@ if sys.version_info >= (3, 14):
1095
1095
** kwargs : Unpack [_Attributes ],
1096
1096
) -> Self : ...
1097
1097
1098
+ if sys .version_info >= (3 , 10 ):
1099
+ from types import EllipsisType
1100
+
1101
+ _ConstantValue : typing_extensions .TypeAlias = str | bytes | bool | int | float | complex | None | EllipsisType
1102
+ else :
1103
+ # Rely on builtins.ellipsis
1104
+ _ConstantValue : typing_extensions .TypeAlias = str | bytes | bool | int | float | complex | None | ellipsis # noqa: F821
1105
+
1098
1106
class Constant (expr ):
1099
1107
if sys .version_info >= (3 , 10 ):
1100
1108
__match_args__ = ("value" , "kind" )
1101
- value : Any # None, str, bytes, bool, int, float, complex, Ellipsis
1109
+ value : _ConstantValue
1102
1110
kind : str | None
1103
1111
if sys .version_info < (3 , 14 ):
1104
1112
# Aliases for value, for backwards compatibility
1105
- s : Any
1106
- n : int | float | complex
1113
+ s : _ConstantValue
1114
+ n : _ConstantValue
1107
1115
1108
- def __init__ (self , value : Any , kind : str | None = None , ** kwargs : Unpack [_Attributes ]) -> None : ...
1116
+ def __init__ (self , value : _ConstantValue , kind : str | None = None , ** kwargs : Unpack [_Attributes ]) -> None : ...
1109
1117
1110
1118
if sys .version_info >= (3 , 14 ):
1111
- def __replace__ (self , * , value : Any = ..., kind : str | None = ..., ** kwargs : Unpack [_Attributes ]) -> Self : ...
1119
+ def __replace__ (self , * , value : _ConstantValue = ..., kind : str | None = ..., ** kwargs : Unpack [_Attributes ]) -> Self : ...
1112
1120
1113
1121
class Attribute (expr ):
1114
1122
if sys .version_info >= (3 , 10 ):
0 commit comments