basedpyright 1.18.3 → 1.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +3 -3
  2. package/dist/pyright-langserver.js +1 -1
  3. package/dist/pyright-langserver.js.map +1 -1
  4. package/dist/pyright.js +1 -1
  5. package/dist/pyright.js.map +1 -1
  6. package/dist/typeshed-fallback/commit.txt +1 -1
  7. package/dist/typeshed-fallback/stdlib/VERSIONS +2 -0
  8. package/dist/typeshed-fallback/stdlib/_ast.pyi +140 -1667
  9. package/dist/typeshed-fallback/stdlib/_csv.pyi +14 -3
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +857 -65
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +29 -820
  12. package/dist/typeshed-fallback/stdlib/_socket.pyi +4 -12
  13. package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +387 -0
  14. package/dist/typeshed-fallback/stdlib/_ssl.pyi +406 -0
  15. package/dist/typeshed-fallback/stdlib/_weakref.pyi +2 -41
  16. package/dist/typeshed-fallback/stdlib/ast.pyi +1843 -172
  17. package/dist/typeshed-fallback/stdlib/builtins.pyi +5 -0
  18. package/dist/typeshed-fallback/stdlib/cProfile.pyi +3 -3
  19. package/dist/typeshed-fallback/stdlib/calendar.pyi +3 -3
  20. package/dist/typeshed-fallback/stdlib/concurrent/futures/process.pyi +3 -2
  21. package/dist/typeshed-fallback/stdlib/contextlib.pyi +6 -8
  22. package/dist/typeshed-fallback/stdlib/csv.pyi +4 -3
  23. package/dist/typeshed-fallback/stdlib/curses/__init__.pyi +7 -2
  24. package/dist/typeshed-fallback/stdlib/curses/panel.pyi +4 -4
  25. package/dist/typeshed-fallback/stdlib/curses/textpad.pyi +3 -3
  26. package/dist/typeshed-fallback/stdlib/decimal.pyi +840 -2
  27. package/dist/typeshed-fallback/stdlib/email/_policybase.pyi +27 -18
  28. package/dist/typeshed-fallback/stdlib/email/feedparser.pyi +5 -5
  29. package/dist/typeshed-fallback/stdlib/email/generator.pyi +46 -9
  30. package/dist/typeshed-fallback/stdlib/email/message.pyi +8 -6
  31. package/dist/typeshed-fallback/stdlib/email/parser.pyi +6 -4
  32. package/dist/typeshed-fallback/stdlib/email/policy.pyi +28 -10
  33. package/dist/typeshed-fallback/stdlib/http/client.pyi +3 -2
  34. package/dist/typeshed-fallback/stdlib/io.pyi +6 -22
  35. package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +27 -19
  36. package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +5 -2
  37. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +4 -2
  38. package/dist/typeshed-fallback/stdlib/multiprocessing/reduction.pyi +2 -2
  39. package/dist/typeshed-fallback/stdlib/profile.pyi +3 -3
  40. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +1 -5
  41. package/dist/typeshed-fallback/stdlib/re.pyi +10 -1
  42. package/dist/typeshed-fallback/stdlib/socket.pyi +12 -4
  43. package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +739 -1
  44. package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +220 -884
  45. package/dist/typeshed-fallback/stdlib/sre_constants.pyi +1 -8
  46. package/dist/typeshed-fallback/stdlib/ssl.pyi +40 -128
  47. package/dist/typeshed-fallback/stdlib/tarfile.pyi +111 -6
  48. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +127 -21
  49. package/dist/typeshed-fallback/stdlib/tokenize.pyi +1 -1
  50. package/dist/typeshed-fallback/stdlib/typing.pyi +7 -7
  51. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +1 -1
  52. package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +2 -2
  53. package/dist/typeshed-fallback/stdlib/weakref.pyi +49 -14
  54. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/__init__.pyi +6 -0
  55. package/dist/typeshed-fallback/stdlib/xmlrpc/client.pyi +1 -1
  56. package/dist/typeshed-fallback/stdlib/xmlrpc/server.pyi +3 -2
  57. package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +41 -44
  58. package/dist/typeshed-fallback/stdlib/zoneinfo/_common.pyi +13 -0
  59. package/dist/typeshed-fallback/stdlib/zoneinfo/_tzpath.pyi +13 -0
  60. package/dist/typeshed-fallback/stubs/Flask-SocketIO/METADATA.toml +1 -1
  61. package/dist/typeshed-fallback/stubs/braintree/METADATA.toml +1 -1
  62. package/dist/typeshed-fallback/stubs/braintree/braintree/error_codes.pyi +1 -0
  63. package/dist/typeshed-fallback/stubs/docutils/docutils/__init__.pyi +3 -1
  64. package/dist/typeshed-fallback/stubs/docutils/docutils/frontend.pyi +1 -2
  65. package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/directives/admonitions.pyi +15 -2
  66. package/dist/typeshed-fallback/stubs/docutils/docutils/readers/doctree.pyi +1 -1
  67. package/dist/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi +21 -2
  68. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi +4 -4
  69. package/dist/typeshed-fallback/stubs/greenlet/METADATA.toml +1 -1
  70. package/dist/typeshed-fallback/stubs/hdbcli/METADATA.toml +1 -1
  71. package/dist/typeshed-fallback/stubs/icalendar/METADATA.toml +5 -2
  72. package/dist/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi +49 -5
  73. package/dist/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi +32 -6
  74. package/dist/typeshed-fallback/stubs/icalendar/icalendar/caselessdict.pyi +2 -0
  75. package/dist/typeshed-fallback/stubs/icalendar/icalendar/parser.pyi +25 -1
  76. package/dist/typeshed-fallback/stubs/icalendar/icalendar/parser_tools.pyi +7 -3
  77. package/dist/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi +112 -72
  78. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi +8 -0
  79. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/provider.pyi +29 -0
  80. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/pytz.pyi +22 -0
  81. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi +30 -0
  82. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/zoneinfo.pyi +33 -0
  83. package/dist/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi +2 -0
  84. package/dist/typeshed-fallback/stubs/icalendar/icalendar/version.pyi +8 -0
  85. package/dist/typeshed-fallback/stubs/jwcrypto/METADATA.toml +3 -0
  86. package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/common.pyi +48 -0
  87. package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwa.pyi +35 -0
  88. package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwe.pyi +51 -0
  89. package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwk.pyi +115 -0
  90. package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jws.pyi +52 -0
  91. package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwt.pyi +78 -0
  92. package/dist/typeshed-fallback/stubs/m3u8/METADATA.toml +2 -0
  93. package/dist/typeshed-fallback/stubs/m3u8/m3u8/__init__.pyi +74 -0
  94. package/dist/typeshed-fallback/stubs/m3u8/m3u8/httpclient.pyi +19 -0
  95. package/dist/typeshed-fallback/stubs/m3u8/m3u8/mixins.pyi +25 -0
  96. package/dist/typeshed-fallback/stubs/m3u8/m3u8/model.pyi +406 -0
  97. package/dist/typeshed-fallback/stubs/m3u8/m3u8/parser.pyi +14 -0
  98. package/dist/typeshed-fallback/stubs/m3u8/m3u8/protocol.pyi +41 -0
  99. package/dist/typeshed-fallback/stubs/m3u8/m3u8/version_matching.pyi +5 -0
  100. package/dist/typeshed-fallback/stubs/m3u8/m3u8/version_matching_rules.pyi +24 -0
  101. package/dist/typeshed-fallback/stubs/paramiko/paramiko/transport.pyi +2 -1
  102. package/dist/typeshed-fallback/stubs/protobuf/METADATA.toml +2 -2
  103. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +4 -3
  104. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/internal/well_known_types.pyi +0 -1
  105. package/dist/typeshed-fallback/stubs/pytz/pytz/__init__.pyi +4 -4
  106. package/dist/typeshed-fallback/stubs/pytz/pytz/tzinfo.pyi +1 -1
  107. package/dist/typeshed-fallback/stubs/qrcode/METADATA.toml +3 -2
  108. package/dist/typeshed-fallback/stubs/redis/redis/client.pyi +18 -0
  109. package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
  110. package/dist/typeshed-fallback/stubs/reportlab/reportlab/graphics/renderPDF.pyi +2 -2
  111. package/dist/typeshed-fallback/stubs/seaborn/METADATA.toml +9 -1
  112. package/dist/typeshed-fallback/stubs/vobject/vobject/__init__.pyi +4 -0
  113. package/dist/typeshed-fallback/stubs/vobject/vobject/base.pyi +11 -2
  114. package/dist/typeshed-fallback/stubs/vobject/vobject/behavior.pyi +1 -1
  115. package/dist/typeshed-fallback/stubs/vobject/vobject/change_tz.pyi +4 -0
  116. package/dist/typeshed-fallback/stubs/vobject/vobject/ics_diff.pyi +0 -3
  117. package/dist/typeshed-fallback/stubs/vobject/vobject/vcard.pyi +1 -1
  118. package/dist/typeshed-fallback/stubs/waitress/waitress/__init__.pyi +2 -2
  119. package/package.json +1 -1
  120. package/dist/typeshed-fallback/stubs/Pillow/METADATA.toml +0 -8
  121. package/dist/typeshed-fallback/stubs/Pillow/PIL/BdfFontFile.pyi +0 -11
  122. package/dist/typeshed-fallback/stubs/Pillow/PIL/BlpImagePlugin.pyi +0 -39
  123. package/dist/typeshed-fallback/stubs/Pillow/PIL/BmpImagePlugin.pyi +0 -25
  124. package/dist/typeshed-fallback/stubs/Pillow/PIL/BufrStubImagePlugin.pyi +0 -9
  125. package/dist/typeshed-fallback/stubs/Pillow/PIL/ContainerIO.pyi +0 -14
  126. package/dist/typeshed-fallback/stubs/Pillow/PIL/CurImagePlugin.pyi +0 -6
  127. package/dist/typeshed-fallback/stubs/Pillow/PIL/DcxImagePlugin.pyi +0 -13
  128. package/dist/typeshed-fallback/stubs/Pillow/PIL/DdsImagePlugin.pyi +0 -314
  129. package/dist/typeshed-fallback/stubs/Pillow/PIL/EpsImagePlugin.pyi +0 -34
  130. package/dist/typeshed-fallback/stubs/Pillow/PIL/ExifTags.pyi +0 -347
  131. package/dist/typeshed-fallback/stubs/Pillow/PIL/FitsImagePlugin.pyi +0 -7
  132. package/dist/typeshed-fallback/stubs/Pillow/PIL/FliImagePlugin.pyi +0 -9
  133. package/dist/typeshed-fallback/stubs/Pillow/PIL/FontFile.pyi +0 -16
  134. package/dist/typeshed-fallback/stubs/Pillow/PIL/FpxImagePlugin.pyi +0 -23
  135. package/dist/typeshed-fallback/stubs/Pillow/PIL/FtexImagePlugin.pyi +0 -15
  136. package/dist/typeshed-fallback/stubs/Pillow/PIL/GbrImagePlugin.pyi +0 -11
  137. package/dist/typeshed-fallback/stubs/Pillow/PIL/GdImageFile.pyi +0 -9
  138. package/dist/typeshed-fallback/stubs/Pillow/PIL/GifImagePlugin.pyi +0 -31
  139. package/dist/typeshed-fallback/stubs/Pillow/PIL/GimpGradientFile.pyi +0 -19
  140. package/dist/typeshed-fallback/stubs/Pillow/PIL/GimpPaletteFile.pyi +0 -7
  141. package/dist/typeshed-fallback/stubs/Pillow/PIL/GribStubImagePlugin.pyi +0 -9
  142. package/dist/typeshed-fallback/stubs/Pillow/PIL/Hdf5StubImagePlugin.pyi +0 -9
  143. package/dist/typeshed-fallback/stubs/Pillow/PIL/IcnsImagePlugin.pyi +0 -36
  144. package/dist/typeshed-fallback/stubs/Pillow/PIL/IcoImagePlugin.pyi +0 -26
  145. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImImagePlugin.pyi +0 -34
  146. package/dist/typeshed-fallback/stubs/Pillow/PIL/Image.pyi +0 -342
  147. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageChops.pyi +0 -23
  148. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageCms.pyi +0 -84
  149. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageColor.pyi +0 -10
  150. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageDraw.pyi +0 -155
  151. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageDraw2.pyi +0 -37
  152. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageEnhance.pyi +0 -25
  153. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFile.pyi +0 -89
  154. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFilter.pyi +0 -136
  155. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFont.pyi +0 -114
  156. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageGrab.pyi +0 -36
  157. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageMath.pyi +0 -49
  158. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageMode.pyi +0 -10
  159. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageMorph.pyi +0 -26
  160. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageOps.pyi +0 -53
  161. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImagePalette.pyi +0 -26
  162. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImagePath.pyi +0 -3
  163. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageQt.pyi +0 -26
  164. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageSequence.pyi +0 -14
  165. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageShow.pyi +0 -58
  166. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageStat.pyi +0 -14
  167. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageTk.pyi +0 -51
  168. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageTransform.pyi +0 -21
  169. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageWin.pyi +0 -38
  170. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImtImagePlugin.pyi +0 -10
  171. package/dist/typeshed-fallback/stubs/Pillow/PIL/IptcImagePlugin.pyi +0 -23
  172. package/dist/typeshed-fallback/stubs/Pillow/PIL/Jpeg2KImagePlugin.pyi +0 -23
  173. package/dist/typeshed-fallback/stubs/Pillow/PIL/JpegImagePlugin.pyi +0 -30
  174. package/dist/typeshed-fallback/stubs/Pillow/PIL/JpegPresets.pyi +0 -3
  175. package/dist/typeshed-fallback/stubs/Pillow/PIL/McIdasImagePlugin.pyi +0 -7
  176. package/dist/typeshed-fallback/stubs/Pillow/PIL/MicImagePlugin.pyi +0 -18
  177. package/dist/typeshed-fallback/stubs/Pillow/PIL/MpegImagePlugin.pyi +0 -18
  178. package/dist/typeshed-fallback/stubs/Pillow/PIL/MpoImagePlugin.pyi +0 -15
  179. package/dist/typeshed-fallback/stubs/Pillow/PIL/MspImagePlugin.pyi +0 -10
  180. package/dist/typeshed-fallback/stubs/Pillow/PIL/PSDraw.pyi +0 -19
  181. package/dist/typeshed-fallback/stubs/Pillow/PIL/PaletteFile.pyi +0 -7
  182. package/dist/typeshed-fallback/stubs/Pillow/PIL/PalmImagePlugin.pyi +0 -5
  183. package/dist/typeshed-fallback/stubs/Pillow/PIL/PcdImagePlugin.pyi +0 -10
  184. package/dist/typeshed-fallback/stubs/Pillow/PIL/PcfFontFile.pyi +0 -25
  185. package/dist/typeshed-fallback/stubs/Pillow/PIL/PcxImagePlugin.pyi +0 -10
  186. package/dist/typeshed-fallback/stubs/Pillow/PIL/PdfParser.pyi +0 -167
  187. package/dist/typeshed-fallback/stubs/Pillow/PIL/PixarImagePlugin.pyi +0 -7
  188. package/dist/typeshed-fallback/stubs/Pillow/PIL/PngImagePlugin.pyi +0 -115
  189. package/dist/typeshed-fallback/stubs/Pillow/PIL/PpmImagePlugin.pyi +0 -17
  190. package/dist/typeshed-fallback/stubs/Pillow/PIL/PsdImagePlugin.pyi +0 -17
  191. package/dist/typeshed-fallback/stubs/Pillow/PIL/PyAccess.pyi +0 -69
  192. package/dist/typeshed-fallback/stubs/Pillow/PIL/QoiImagePlugin.pyi +0 -11
  193. package/dist/typeshed-fallback/stubs/Pillow/PIL/SgiImagePlugin.pyi +0 -13
  194. package/dist/typeshed-fallback/stubs/Pillow/PIL/SpiderImagePlugin.pyi +0 -28
  195. package/dist/typeshed-fallback/stubs/Pillow/PIL/SunImagePlugin.pyi +0 -7
  196. package/dist/typeshed-fallback/stubs/Pillow/PIL/TarIO.pyi +0 -12
  197. package/dist/typeshed-fallback/stubs/Pillow/PIL/TgaImagePlugin.pyi +0 -12
  198. package/dist/typeshed-fallback/stubs/Pillow/PIL/TiffImagePlugin.pyi +0 -295
  199. package/dist/typeshed-fallback/stubs/Pillow/PIL/TiffTags.pyi +0 -46
  200. package/dist/typeshed-fallback/stubs/Pillow/PIL/WalImageFile.pyi +0 -14
  201. package/dist/typeshed-fallback/stubs/Pillow/PIL/WebPImagePlugin.pyi +0 -18
  202. package/dist/typeshed-fallback/stubs/Pillow/PIL/WmfImagePlugin.pyi +0 -19
  203. package/dist/typeshed-fallback/stubs/Pillow/PIL/XVThumbImagePlugin.pyi +0 -9
  204. package/dist/typeshed-fallback/stubs/Pillow/PIL/XbmImagePlugin.pyi +0 -10
  205. package/dist/typeshed-fallback/stubs/Pillow/PIL/XpmImagePlugin.pyi +0 -11
  206. package/dist/typeshed-fallback/stubs/Pillow/PIL/__init__.pyi +0 -3
  207. package/dist/typeshed-fallback/stubs/Pillow/PIL/_binary.pyi +0 -13
  208. package/dist/typeshed-fallback/stubs/Pillow/PIL/_imaging.pyi +0 -29
  209. package/dist/typeshed-fallback/stubs/Pillow/PIL/_tkinter_finder.pyi +0 -2
  210. package/dist/typeshed-fallback/stubs/Pillow/PIL/_version.pyi +0 -1
  211. package/dist/typeshed-fallback/stubs/Pillow/PIL/features.pyi +0 -23
  212. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone_cache.pyi +0 -0
  213. /package/dist/typeshed-fallback/stubs/icalendar/icalendar/{windows_to_olson.pyi → timezone/windows_to_olson.pyi} +0 -0
  214. /package/dist/typeshed-fallback/stubs/{Pillow/PIL/PdfImagePlugin.pyi → jwcrypto/jwcrypto/__init__.pyi} +0 -0
@@ -1,184 +1,1717 @@
1
1
  import os
2
2
  import sys
3
- from _ast import *
3
+ import typing_extensions
4
+ from _ast import (
5
+ PyCF_ALLOW_TOP_LEVEL_AWAIT as PyCF_ALLOW_TOP_LEVEL_AWAIT,
6
+ PyCF_ONLY_AST as PyCF_ONLY_AST,
7
+ PyCF_TYPE_COMMENTS as PyCF_TYPE_COMMENTS,
8
+ )
4
9
  from _typeshed import ReadableBuffer, Unused
5
10
  from collections.abc import Iterator
6
- from typing import Any, Literal, TypeVar as _TypeVar, overload
7
- from typing_extensions import deprecated
11
+ from typing import Any, ClassVar, Generic, Literal, TypedDict, TypeVar as _TypeVar, overload
12
+ from typing_extensions import Self, Unpack, deprecated
8
13
 
9
- class _ABC(type):
10
- if sys.version_info >= (3, 9):
11
- def __init__(cls, *args: Unused) -> None: ...
14
+ if sys.version_info >= (3, 13):
15
+ from _ast import PyCF_OPTIMIZED_AST as PyCF_OPTIMIZED_AST
12
16
 
13
- if sys.version_info < (3, 14):
14
- @deprecated("Replaced by ast.Constant; removed in Python 3.14")
15
- class Num(Constant, metaclass=_ABC):
16
- value: int | float | complex
17
+ # Alias used for fields that must always be valid identifiers
18
+ # A string `x` counts as a valid identifier if both the following are True
19
+ # (1) `x.isidentifier()` evaluates to `True`
20
+ # (2) `keyword.iskeyword(x)` evaluates to `False`
21
+ _Identifier: typing_extensions.TypeAlias = str
17
22
 
18
- @deprecated("Replaced by ast.Constant; removed in Python 3.14")
19
- class Str(Constant, metaclass=_ABC):
20
- value: str
21
- # Aliases for value, for backwards compatibility
22
- s: str
23
+ # Used for node end positions in constructor keyword arguments
24
+ _EndPositionT = typing_extensions.TypeVar("_EndPositionT", int, int | None, default=int | None)
23
25
 
24
- @deprecated("Replaced by ast.Constant; removed in Python 3.14")
25
- class Bytes(Constant, metaclass=_ABC):
26
- value: bytes
26
+ # Corresponds to the names in the `_attributes` class variable which is non-empty in certain AST nodes
27
+ class _Attributes(TypedDict, Generic[_EndPositionT], total=False):
28
+ lineno: int
29
+ col_offset: int
30
+ end_lineno: _EndPositionT
31
+ end_col_offset: _EndPositionT
32
+
33
+ # The various AST classes are implemented in C, and imported from _ast at runtime,
34
+ # but they consider themselves to live in the ast module,
35
+ # so we'll define the stubs in this file.
36
+ class AST:
37
+ if sys.version_info >= (3, 10):
38
+ __match_args__ = ()
39
+ _attributes: ClassVar[tuple[str, ...]]
40
+ _fields: ClassVar[tuple[str, ...]]
41
+ if sys.version_info >= (3, 13):
42
+ _field_types: ClassVar[dict[str, Any]]
43
+
44
+ if sys.version_info >= (3, 14):
45
+ def __replace__(self) -> Self: ...
46
+
47
+ class mod(AST): ...
48
+
49
+ class Module(mod):
50
+ if sys.version_info >= (3, 10):
51
+ __match_args__ = ("body", "type_ignores")
52
+ body: list[stmt]
53
+ type_ignores: list[TypeIgnore]
54
+ if sys.version_info >= (3, 13):
55
+ def __init__(self, body: list[stmt] = ..., type_ignores: list[TypeIgnore] = ...) -> None: ...
56
+ else:
57
+ def __init__(self, body: list[stmt], type_ignores: list[TypeIgnore]) -> None: ...
58
+
59
+ if sys.version_info >= (3, 14):
60
+ def __replace__(self, *, body: list[stmt] = ..., type_ignores: list[TypeIgnore] = ...) -> Self: ...
61
+
62
+ class Interactive(mod):
63
+ if sys.version_info >= (3, 10):
64
+ __match_args__ = ("body",)
65
+ body: list[stmt]
66
+ if sys.version_info >= (3, 13):
67
+ def __init__(self, body: list[stmt] = ...) -> None: ...
68
+ else:
69
+ def __init__(self, body: list[stmt]) -> None: ...
70
+
71
+ if sys.version_info >= (3, 14):
72
+ def __replace__(self, *, body: list[stmt] = ...) -> Self: ...
73
+
74
+ class Expression(mod):
75
+ if sys.version_info >= (3, 10):
76
+ __match_args__ = ("body",)
77
+ body: expr
78
+ def __init__(self, body: expr) -> None: ...
79
+
80
+ if sys.version_info >= (3, 14):
81
+ def __replace__(self, *, body: expr = ...) -> Self: ...
82
+
83
+ class FunctionType(mod):
84
+ if sys.version_info >= (3, 10):
85
+ __match_args__ = ("argtypes", "returns")
86
+ argtypes: list[expr]
87
+ returns: expr
88
+ if sys.version_info >= (3, 13):
89
+ @overload
90
+ def __init__(self, argtypes: list[expr], returns: expr) -> None: ...
91
+ @overload
92
+ def __init__(self, argtypes: list[expr] = ..., *, returns: expr) -> None: ...
93
+ else:
94
+ def __init__(self, argtypes: list[expr], returns: expr) -> None: ...
95
+
96
+ if sys.version_info >= (3, 14):
97
+ def __replace__(self, *, argtypes: list[expr] = ..., returns: expr = ...) -> Self: ...
98
+
99
+ class stmt(AST):
100
+ lineno: int
101
+ col_offset: int
102
+ end_lineno: int | None
103
+ end_col_offset: int | None
104
+ def __init__(self, **kwargs: Unpack[_Attributes]) -> None: ...
105
+
106
+ if sys.version_info >= (3, 14):
107
+ def __replace__(self, **kwargs: Unpack[_Attributes]) -> Self: ...
108
+
109
+ class FunctionDef(stmt):
110
+ if sys.version_info >= (3, 12):
111
+ __match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment", "type_params")
112
+ elif sys.version_info >= (3, 10):
113
+ __match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
114
+ name: _Identifier
115
+ args: arguments
116
+ body: list[stmt]
117
+ decorator_list: list[expr]
118
+ returns: expr | None
119
+ type_comment: str | None
120
+ if sys.version_info >= (3, 12):
121
+ type_params: list[type_param]
122
+ if sys.version_info >= (3, 13):
123
+ def __init__(
124
+ self,
125
+ name: _Identifier,
126
+ args: arguments,
127
+ body: list[stmt] = ...,
128
+ decorator_list: list[expr] = ...,
129
+ returns: expr | None = None,
130
+ type_comment: str | None = None,
131
+ type_params: list[type_param] = ...,
132
+ **kwargs: Unpack[_Attributes],
133
+ ) -> None: ...
134
+ elif sys.version_info >= (3, 12):
135
+ @overload
136
+ def __init__(
137
+ self,
138
+ name: _Identifier,
139
+ args: arguments,
140
+ body: list[stmt],
141
+ decorator_list: list[expr],
142
+ returns: expr | None,
143
+ type_comment: str | None,
144
+ type_params: list[type_param],
145
+ **kwargs: Unpack[_Attributes],
146
+ ) -> None: ...
147
+ @overload
148
+ def __init__(
149
+ self,
150
+ name: _Identifier,
151
+ args: arguments,
152
+ body: list[stmt],
153
+ decorator_list: list[expr],
154
+ returns: expr | None = None,
155
+ type_comment: str | None = None,
156
+ *,
157
+ type_params: list[type_param],
158
+ **kwargs: Unpack[_Attributes],
159
+ ) -> None: ...
160
+ else:
161
+ def __init__(
162
+ self,
163
+ name: _Identifier,
164
+ args: arguments,
165
+ body: list[stmt],
166
+ decorator_list: list[expr],
167
+ returns: expr | None = None,
168
+ type_comment: str | None = None,
169
+ **kwargs: Unpack[_Attributes],
170
+ ) -> None: ...
171
+
172
+ if sys.version_info >= (3, 14):
173
+ def __replace__(
174
+ self,
175
+ *,
176
+ name: _Identifier = ...,
177
+ args: arguments = ...,
178
+ body: list[stmt] = ...,
179
+ decorator_list: list[expr] = ...,
180
+ returns: expr | None = ...,
181
+ type_comment: str | None = ...,
182
+ type_params: list[type_param] = ...,
183
+ ) -> Self: ...
184
+
185
+ class AsyncFunctionDef(stmt):
186
+ if sys.version_info >= (3, 12):
187
+ __match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment", "type_params")
188
+ elif sys.version_info >= (3, 10):
189
+ __match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
190
+ name: _Identifier
191
+ args: arguments
192
+ body: list[stmt]
193
+ decorator_list: list[expr]
194
+ returns: expr | None
195
+ type_comment: str | None
196
+ if sys.version_info >= (3, 12):
197
+ type_params: list[type_param]
198
+ if sys.version_info >= (3, 13):
199
+ def __init__(
200
+ self,
201
+ name: _Identifier,
202
+ args: arguments,
203
+ body: list[stmt] = ...,
204
+ decorator_list: list[expr] = ...,
205
+ returns: expr | None = None,
206
+ type_comment: str | None = None,
207
+ type_params: list[type_param] = ...,
208
+ **kwargs: Unpack[_Attributes],
209
+ ) -> None: ...
210
+ elif sys.version_info >= (3, 12):
211
+ @overload
212
+ def __init__(
213
+ self,
214
+ name: _Identifier,
215
+ args: arguments,
216
+ body: list[stmt],
217
+ decorator_list: list[expr],
218
+ returns: expr | None,
219
+ type_comment: str | None,
220
+ type_params: list[type_param],
221
+ **kwargs: Unpack[_Attributes],
222
+ ) -> None: ...
223
+ @overload
224
+ def __init__(
225
+ self,
226
+ name: _Identifier,
227
+ args: arguments,
228
+ body: list[stmt],
229
+ decorator_list: list[expr],
230
+ returns: expr | None = None,
231
+ type_comment: str | None = None,
232
+ *,
233
+ type_params: list[type_param],
234
+ **kwargs: Unpack[_Attributes],
235
+ ) -> None: ...
236
+ else:
237
+ def __init__(
238
+ self,
239
+ name: _Identifier,
240
+ args: arguments,
241
+ body: list[stmt],
242
+ decorator_list: list[expr],
243
+ returns: expr | None = None,
244
+ type_comment: str | None = None,
245
+ **kwargs: Unpack[_Attributes],
246
+ ) -> None: ...
247
+
248
+ if sys.version_info >= (3, 14):
249
+ def __replace__(
250
+ self,
251
+ *,
252
+ name: _Identifier = ...,
253
+ args: arguments = ...,
254
+ body: list[stmt],
255
+ decorator_list: list[expr],
256
+ returns: expr | None,
257
+ type_comment: str | None,
258
+ type_params: list[type_param],
259
+ ) -> Self: ...
260
+
261
+ class ClassDef(stmt):
262
+ if sys.version_info >= (3, 12):
263
+ __match_args__ = ("name", "bases", "keywords", "body", "decorator_list", "type_params")
264
+ elif sys.version_info >= (3, 10):
265
+ __match_args__ = ("name", "bases", "keywords", "body", "decorator_list")
266
+ name: _Identifier
267
+ bases: list[expr]
268
+ keywords: list[keyword]
269
+ body: list[stmt]
270
+ decorator_list: list[expr]
271
+ if sys.version_info >= (3, 12):
272
+ type_params: list[type_param]
273
+ if sys.version_info >= (3, 13):
274
+ def __init__(
275
+ self,
276
+ name: _Identifier,
277
+ bases: list[expr] = ...,
278
+ keywords: list[keyword] = ...,
279
+ body: list[stmt] = ...,
280
+ decorator_list: list[expr] = ...,
281
+ type_params: list[type_param] = ...,
282
+ **kwargs: Unpack[_Attributes],
283
+ ) -> None: ...
284
+ elif sys.version_info >= (3, 12):
285
+ def __init__(
286
+ self,
287
+ name: _Identifier,
288
+ bases: list[expr],
289
+ keywords: list[keyword],
290
+ body: list[stmt],
291
+ decorator_list: list[expr],
292
+ type_params: list[type_param],
293
+ **kwargs: Unpack[_Attributes],
294
+ ) -> None: ...
295
+ else:
296
+ def __init__(
297
+ self,
298
+ name: _Identifier,
299
+ bases: list[expr],
300
+ keywords: list[keyword],
301
+ body: list[stmt],
302
+ decorator_list: list[expr],
303
+ **kwargs: Unpack[_Attributes],
304
+ ) -> None: ...
305
+
306
+ if sys.version_info >= (3, 14):
307
+ def __replace__(
308
+ self,
309
+ *,
310
+ name: _Identifier,
311
+ bases: list[expr],
312
+ keywords: list[keyword],
313
+ body: list[stmt],
314
+ decorator_list: list[expr],
315
+ type_params: list[type_param],
316
+ **kwargs: Unpack[_Attributes],
317
+ ) -> Self: ...
318
+
319
+ class Return(stmt):
320
+ if sys.version_info >= (3, 10):
321
+ __match_args__ = ("value",)
322
+ value: expr | None
323
+ def __init__(self, value: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
324
+
325
+ if sys.version_info >= (3, 14):
326
+ def __replace__(self, *, value: expr | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
327
+
328
+ class Delete(stmt):
329
+ if sys.version_info >= (3, 10):
330
+ __match_args__ = ("targets",)
331
+ targets: list[expr]
332
+ if sys.version_info >= (3, 13):
333
+ def __init__(self, targets: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
334
+ else:
335
+ def __init__(self, targets: list[expr], **kwargs: Unpack[_Attributes]) -> None: ...
336
+
337
+ if sys.version_info >= (3, 14):
338
+ def __replace__(self, *, targets: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
339
+
340
+ class Assign(stmt):
341
+ if sys.version_info >= (3, 10):
342
+ __match_args__ = ("targets", "value", "type_comment")
343
+ targets: list[expr]
344
+ value: expr
345
+ type_comment: str | None
346
+ if sys.version_info >= (3, 13):
347
+ @overload
348
+ def __init__(
349
+ self, targets: list[expr], value: expr, type_comment: str | None = None, **kwargs: Unpack[_Attributes]
350
+ ) -> None: ...
351
+ @overload
352
+ def __init__(
353
+ self, targets: list[expr] = ..., *, value: expr, type_comment: str | None = None, **kwargs: Unpack[_Attributes]
354
+ ) -> None: ...
355
+ else:
356
+ def __init__(
357
+ self, targets: list[expr], value: expr, type_comment: str | None = None, **kwargs: Unpack[_Attributes]
358
+ ) -> None: ...
359
+
360
+ if sys.version_info >= (3, 14):
361
+ def __replace__(
362
+ self, *, targets: list[expr] = ..., value: expr = ..., type_comment: str | None = ..., **kwargs: Unpack[_Attributes]
363
+ ) -> Self: ...
364
+
365
+ if sys.version_info >= (3, 12):
366
+ class TypeAlias(stmt):
367
+ __match_args__ = ("name", "type_params", "value")
368
+ name: Name
369
+ type_params: list[type_param]
370
+ value: expr
371
+ if sys.version_info >= (3, 13):
372
+ @overload
373
+ def __init__(
374
+ self, name: Name, type_params: list[type_param], value: expr, **kwargs: Unpack[_Attributes[int]]
375
+ ) -> None: ...
376
+ @overload
377
+ def __init__(
378
+ self, name: Name, type_params: list[type_param] = ..., *, value: expr, **kwargs: Unpack[_Attributes[int]]
379
+ ) -> None: ...
380
+ else:
381
+ def __init__(
382
+ self, name: Name, type_params: list[type_param], value: expr, **kwargs: Unpack[_Attributes[int]]
383
+ ) -> None: ...
384
+
385
+ if sys.version_info >= (3, 14):
386
+ def __replace__(
387
+ self,
388
+ *,
389
+ name: Name = ...,
390
+ type_params: list[type_param] = ...,
391
+ value: expr = ...,
392
+ **kwargs: Unpack[_Attributes[int]],
393
+ ) -> Self: ...
394
+
395
+ class AugAssign(stmt):
396
+ if sys.version_info >= (3, 10):
397
+ __match_args__ = ("target", "op", "value")
398
+ target: Name | Attribute | Subscript
399
+ op: operator
400
+ value: expr
401
+ def __init__(
402
+ self, target: Name | Attribute | Subscript, op: operator, value: expr, **kwargs: Unpack[_Attributes]
403
+ ) -> None: ...
404
+
405
+ if sys.version_info >= (3, 14):
406
+ def __replace__(
407
+ self,
408
+ *,
409
+ target: Name | Attribute | Subscript = ...,
410
+ op: operator = ...,
411
+ value: expr = ...,
412
+ **kwargs: Unpack[_Attributes],
413
+ ) -> Self: ...
414
+
415
+ class AnnAssign(stmt):
416
+ if sys.version_info >= (3, 10):
417
+ __match_args__ = ("target", "annotation", "value", "simple")
418
+ target: Name | Attribute | Subscript
419
+ annotation: expr
420
+ value: expr | None
421
+ simple: int
422
+ @overload
423
+ def __init__(
424
+ self,
425
+ target: Name | Attribute | Subscript,
426
+ annotation: expr,
427
+ value: expr | None,
428
+ simple: int,
429
+ **kwargs: Unpack[_Attributes],
430
+ ) -> None: ...
431
+ @overload
432
+ def __init__(
433
+ self,
434
+ target: Name | Attribute | Subscript,
435
+ annotation: expr,
436
+ value: expr | None = None,
437
+ *,
438
+ simple: int,
439
+ **kwargs: Unpack[_Attributes],
440
+ ) -> None: ...
441
+
442
+ if sys.version_info >= (3, 14):
443
+ def __replace__(
444
+ self,
445
+ *,
446
+ target: Name | Attribute | Subscript = ...,
447
+ annotation: expr = ...,
448
+ value: expr | None = ...,
449
+ simple: int = ...,
450
+ **kwargs: Unpack[_Attributes],
451
+ ) -> Self: ...
452
+
453
+ class For(stmt):
454
+ if sys.version_info >= (3, 10):
455
+ __match_args__ = ("target", "iter", "body", "orelse", "type_comment")
456
+ target: expr
457
+ iter: expr
458
+ body: list[stmt]
459
+ orelse: list[stmt]
460
+ type_comment: str | None
461
+ if sys.version_info >= (3, 13):
462
+ def __init__(
463
+ self,
464
+ target: expr,
465
+ iter: expr,
466
+ body: list[stmt] = ...,
467
+ orelse: list[stmt] = ...,
468
+ type_comment: str | None = None,
469
+ **kwargs: Unpack[_Attributes],
470
+ ) -> None: ...
471
+ else:
472
+ def __init__(
473
+ self,
474
+ target: expr,
475
+ iter: expr,
476
+ body: list[stmt],
477
+ orelse: list[stmt],
478
+ type_comment: str | None = None,
479
+ **kwargs: Unpack[_Attributes],
480
+ ) -> None: ...
481
+
482
+ if sys.version_info >= (3, 14):
483
+ def __replace__(
484
+ self,
485
+ *,
486
+ target: expr = ...,
487
+ iter: expr = ...,
488
+ body: list[stmt] = ...,
489
+ orelse: list[stmt] = ...,
490
+ type_comment: str | None = ...,
491
+ **kwargs: Unpack[_Attributes],
492
+ ) -> Self: ...
493
+
494
+ class AsyncFor(stmt):
495
+ if sys.version_info >= (3, 10):
496
+ __match_args__ = ("target", "iter", "body", "orelse", "type_comment")
497
+ target: expr
498
+ iter: expr
499
+ body: list[stmt]
500
+ orelse: list[stmt]
501
+ type_comment: str | None
502
+ if sys.version_info >= (3, 13):
503
+ def __init__(
504
+ self,
505
+ target: expr,
506
+ iter: expr,
507
+ body: list[stmt] = ...,
508
+ orelse: list[stmt] = ...,
509
+ type_comment: str | None = None,
510
+ **kwargs: Unpack[_Attributes],
511
+ ) -> None: ...
512
+ else:
513
+ def __init__(
514
+ self,
515
+ target: expr,
516
+ iter: expr,
517
+ body: list[stmt],
518
+ orelse: list[stmt],
519
+ type_comment: str | None = None,
520
+ **kwargs: Unpack[_Attributes],
521
+ ) -> None: ...
522
+
523
+ if sys.version_info >= (3, 14):
524
+ def __replace__(
525
+ self,
526
+ *,
527
+ target: expr = ...,
528
+ iter: expr = ...,
529
+ body: list[stmt] = ...,
530
+ orelse: list[stmt] = ...,
531
+ type_comment: str | None = ...,
532
+ **kwargs: Unpack[_Attributes],
533
+ ) -> Self: ...
534
+
535
+ class While(stmt):
536
+ if sys.version_info >= (3, 10):
537
+ __match_args__ = ("test", "body", "orelse")
538
+ test: expr
539
+ body: list[stmt]
540
+ orelse: list[stmt]
541
+ if sys.version_info >= (3, 13):
542
+ def __init__(
543
+ self, test: expr, body: list[stmt] = ..., orelse: list[stmt] = ..., **kwargs: Unpack[_Attributes]
544
+ ) -> None: ...
545
+ else:
546
+ def __init__(self, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> None: ...
547
+
548
+ if sys.version_info >= (3, 14):
549
+ def __replace__(self, *, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> Self: ...
550
+
551
+ class If(stmt):
552
+ if sys.version_info >= (3, 10):
553
+ __match_args__ = ("test", "body", "orelse")
554
+ test: expr
555
+ body: list[stmt]
556
+ orelse: list[stmt]
557
+ if sys.version_info >= (3, 13):
558
+ def __init__(
559
+ self, test: expr, body: list[stmt] = ..., orelse: list[stmt] = ..., **kwargs: Unpack[_Attributes]
560
+ ) -> None: ...
561
+ else:
562
+ def __init__(self, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> None: ...
563
+
564
+ if sys.version_info >= (3, 14):
565
+ def __replace__(
566
+ self, *, test: expr = ..., body: list[stmt] = ..., orelse: list[stmt] = ..., **kwargs: Unpack[_Attributes]
567
+ ) -> Self: ...
568
+
569
+ class With(stmt):
570
+ if sys.version_info >= (3, 10):
571
+ __match_args__ = ("items", "body", "type_comment")
572
+ items: list[withitem]
573
+ body: list[stmt]
574
+ type_comment: str | None
575
+ if sys.version_info >= (3, 13):
576
+ def __init__(
577
+ self,
578
+ items: list[withitem] = ...,
579
+ body: list[stmt] = ...,
580
+ type_comment: str | None = None,
581
+ **kwargs: Unpack[_Attributes],
582
+ ) -> None: ...
583
+ else:
584
+ def __init__(
585
+ self, items: list[withitem], body: list[stmt], type_comment: str | None = None, **kwargs: Unpack[_Attributes]
586
+ ) -> None: ...
587
+
588
+ if sys.version_info >= (3, 14):
589
+ def __replace__(
590
+ self,
591
+ *,
592
+ items: list[withitem] = ...,
593
+ body: list[stmt] = ...,
594
+ type_comment: str | None = ...,
595
+ **kwargs: Unpack[_Attributes],
596
+ ) -> Self: ...
597
+
598
+ class AsyncWith(stmt):
599
+ if sys.version_info >= (3, 10):
600
+ __match_args__ = ("items", "body", "type_comment")
601
+ items: list[withitem]
602
+ body: list[stmt]
603
+ type_comment: str | None
604
+ if sys.version_info >= (3, 13):
605
+ def __init__(
606
+ self,
607
+ items: list[withitem] = ...,
608
+ body: list[stmt] = ...,
609
+ type_comment: str | None = None,
610
+ **kwargs: Unpack[_Attributes],
611
+ ) -> None: ...
612
+ else:
613
+ def __init__(
614
+ self, items: list[withitem], body: list[stmt], type_comment: str | None = None, **kwargs: Unpack[_Attributes]
615
+ ) -> None: ...
616
+
617
+ if sys.version_info >= (3, 14):
618
+ def __replace__(
619
+ self,
620
+ *,
621
+ items: list[withitem] = ...,
622
+ body: list[stmt] = ...,
623
+ type_comment: str | None = ...,
624
+ **kwargs: Unpack[_Attributes],
625
+ ) -> Self: ...
626
+
627
+ if sys.version_info >= (3, 10):
628
+ class Match(stmt):
629
+ __match_args__ = ("subject", "cases")
630
+ subject: expr
631
+ cases: list[match_case]
632
+ if sys.version_info >= (3, 13):
633
+ def __init__(self, subject: expr, cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
634
+ else:
635
+ def __init__(self, subject: expr, cases: list[match_case], **kwargs: Unpack[_Attributes]) -> None: ...
636
+
637
+ if sys.version_info >= (3, 14):
638
+ def __replace__(
639
+ self, *, subject: expr = ..., cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]
640
+ ) -> Self: ...
641
+
642
+ class Raise(stmt):
643
+ if sys.version_info >= (3, 10):
644
+ __match_args__ = ("exc", "cause")
645
+ exc: expr | None
646
+ cause: expr | None
647
+ def __init__(self, exc: expr | None = None, cause: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
648
+
649
+ if sys.version_info >= (3, 14):
650
+ def __replace__(self, *, exc: expr | None = ..., cause: expr | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
651
+
652
+ class Try(stmt):
653
+ if sys.version_info >= (3, 10):
654
+ __match_args__ = ("body", "handlers", "orelse", "finalbody")
655
+ body: list[stmt]
656
+ handlers: list[ExceptHandler]
657
+ orelse: list[stmt]
658
+ finalbody: list[stmt]
659
+ if sys.version_info >= (3, 13):
660
+ def __init__(
661
+ self,
662
+ body: list[stmt] = ...,
663
+ handlers: list[ExceptHandler] = ...,
664
+ orelse: list[stmt] = ...,
665
+ finalbody: list[stmt] = ...,
666
+ **kwargs: Unpack[_Attributes],
667
+ ) -> None: ...
668
+ else:
669
+ def __init__(
670
+ self,
671
+ body: list[stmt],
672
+ handlers: list[ExceptHandler],
673
+ orelse: list[stmt],
674
+ finalbody: list[stmt],
675
+ **kwargs: Unpack[_Attributes],
676
+ ) -> None: ...
677
+
678
+ if sys.version_info >= (3, 14):
679
+ def __replace__(
680
+ self,
681
+ *,
682
+ body: list[stmt] = ...,
683
+ handlers: list[ExceptHandler] = ...,
684
+ orelse: list[stmt] = ...,
685
+ finalbody: list[stmt] = ...,
686
+ **kwargs: Unpack[_Attributes],
687
+ ) -> Self: ...
688
+
689
+ if sys.version_info >= (3, 11):
690
+ class TryStar(stmt):
691
+ __match_args__ = ("body", "handlers", "orelse", "finalbody")
692
+ body: list[stmt]
693
+ handlers: list[ExceptHandler]
694
+ orelse: list[stmt]
695
+ finalbody: list[stmt]
696
+ if sys.version_info >= (3, 13):
697
+ def __init__(
698
+ self,
699
+ body: list[stmt] = ...,
700
+ handlers: list[ExceptHandler] = ...,
701
+ orelse: list[stmt] = ...,
702
+ finalbody: list[stmt] = ...,
703
+ **kwargs: Unpack[_Attributes],
704
+ ) -> None: ...
705
+ else:
706
+ def __init__(
707
+ self,
708
+ body: list[stmt],
709
+ handlers: list[ExceptHandler],
710
+ orelse: list[stmt],
711
+ finalbody: list[stmt],
712
+ **kwargs: Unpack[_Attributes],
713
+ ) -> None: ...
714
+
715
+ if sys.version_info >= (3, 14):
716
+ def __replace__(
717
+ self,
718
+ *,
719
+ body: list[stmt] = ...,
720
+ handlers: list[ExceptHandler] = ...,
721
+ orelse: list[stmt] = ...,
722
+ finalbody: list[stmt] = ...,
723
+ **kwargs: Unpack[_Attributes],
724
+ ) -> Self: ...
725
+
726
+ class Assert(stmt):
727
+ if sys.version_info >= (3, 10):
728
+ __match_args__ = ("test", "msg")
729
+ test: expr
730
+ msg: expr | None
731
+ def __init__(self, test: expr, msg: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
732
+
733
+ if sys.version_info >= (3, 14):
734
+ def __replace__(self, *, test: expr, msg: expr | None, **kwargs: Unpack[_Attributes]) -> Self: ...
735
+
736
+ class Import(stmt):
737
+ if sys.version_info >= (3, 10):
738
+ __match_args__ = ("names",)
739
+ names: list[alias]
740
+ if sys.version_info >= (3, 13):
741
+ def __init__(self, names: list[alias] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
742
+ else:
743
+ def __init__(self, names: list[alias], **kwargs: Unpack[_Attributes]) -> None: ...
744
+
745
+ if sys.version_info >= (3, 14):
746
+ def __replace__(self, *, names: list[alias] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
747
+
748
+ class ImportFrom(stmt):
749
+ if sys.version_info >= (3, 10):
750
+ __match_args__ = ("module", "names", "level")
751
+ module: str | None
752
+ names: list[alias]
753
+ level: int
754
+ if sys.version_info >= (3, 13):
755
+ @overload
756
+ def __init__(self, module: str | None, names: list[alias], level: int, **kwargs: Unpack[_Attributes]) -> None: ...
757
+ @overload
758
+ def __init__(
759
+ self, module: str | None = None, names: list[alias] = ..., *, level: int, **kwargs: Unpack[_Attributes]
760
+ ) -> None: ...
761
+ else:
762
+ @overload
763
+ def __init__(self, module: str | None, names: list[alias], level: int, **kwargs: Unpack[_Attributes]) -> None: ...
764
+ @overload
765
+ def __init__(
766
+ self, module: str | None = None, *, names: list[alias], level: int, **kwargs: Unpack[_Attributes]
767
+ ) -> None: ...
768
+
769
+ if sys.version_info >= (3, 14):
770
+ def __replace__(
771
+ self, *, module: str | None = ..., names: list[alias] = ..., level: int = ..., **kwargs: Unpack[_Attributes]
772
+ ) -> Self: ...
773
+
774
+ class Global(stmt):
775
+ if sys.version_info >= (3, 10):
776
+ __match_args__ = ("names",)
777
+ names: list[_Identifier]
778
+ if sys.version_info >= (3, 13):
779
+ def __init__(self, names: list[_Identifier] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
780
+ else:
781
+ def __init__(self, names: list[_Identifier], **kwargs: Unpack[_Attributes]) -> None: ...
782
+
783
+ if sys.version_info >= (3, 14):
784
+ def __replace__(self, *, names: list[_Identifier], **kwargs: Unpack[_Attributes]) -> Self: ...
785
+
786
+ class Nonlocal(stmt):
787
+ if sys.version_info >= (3, 10):
788
+ __match_args__ = ("names",)
789
+ names: list[_Identifier]
790
+ if sys.version_info >= (3, 13):
791
+ def __init__(self, names: list[_Identifier] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
792
+ else:
793
+ def __init__(self, names: list[_Identifier], **kwargs: Unpack[_Attributes]) -> None: ...
794
+
795
+ if sys.version_info >= (3, 14):
796
+ def __replace__(self, *, names: list[_Identifier] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
797
+
798
+ class Expr(stmt):
799
+ if sys.version_info >= (3, 10):
800
+ __match_args__ = ("value",)
801
+ value: expr
802
+ def __init__(self, value: expr, **kwargs: Unpack[_Attributes]) -> None: ...
803
+
804
+ if sys.version_info >= (3, 14):
805
+ def __replace__(self, *, value: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
806
+
807
+ class Pass(stmt): ...
808
+ class Break(stmt): ...
809
+ class Continue(stmt): ...
810
+
811
+ class expr(AST):
812
+ lineno: int
813
+ col_offset: int
814
+ end_lineno: int | None
815
+ end_col_offset: int | None
816
+ def __init__(self, **kwargs: Unpack[_Attributes]) -> None: ...
817
+
818
+ if sys.version_info >= (3, 14):
819
+ def __replace__(self, **kwargs: Unpack[_Attributes]) -> Self: ...
820
+
821
+ class BoolOp(expr):
822
+ if sys.version_info >= (3, 10):
823
+ __match_args__ = ("op", "values")
824
+ op: boolop
825
+ values: list[expr]
826
+ if sys.version_info >= (3, 13):
827
+ def __init__(self, op: boolop, values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
828
+ else:
829
+ def __init__(self, op: boolop, values: list[expr], **kwargs: Unpack[_Attributes]) -> None: ...
830
+
831
+ if sys.version_info >= (3, 14):
832
+ def __replace__(self, *, op: boolop = ..., values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
833
+
834
+ class NamedExpr(expr):
835
+ if sys.version_info >= (3, 10):
836
+ __match_args__ = ("target", "value")
837
+ target: Name
838
+ value: expr
839
+ def __init__(self, target: Name, value: expr, **kwargs: Unpack[_Attributes]) -> None: ...
840
+
841
+ if sys.version_info >= (3, 14):
842
+ def __replace__(self, *, target: Name = ..., value: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
843
+
844
+ class BinOp(expr):
845
+ if sys.version_info >= (3, 10):
846
+ __match_args__ = ("left", "op", "right")
847
+ left: expr
848
+ op: operator
849
+ right: expr
850
+ def __init__(self, left: expr, op: operator, right: expr, **kwargs: Unpack[_Attributes]) -> None: ...
851
+
852
+ if sys.version_info >= (3, 14):
853
+ def __replace__(
854
+ self, *, left: expr = ..., op: operator = ..., right: expr = ..., **kwargs: Unpack[_Attributes]
855
+ ) -> Self: ...
856
+
857
+ class UnaryOp(expr):
858
+ if sys.version_info >= (3, 10):
859
+ __match_args__ = ("op", "operand")
860
+ op: unaryop
861
+ operand: expr
862
+ def __init__(self, op: unaryop, operand: expr, **kwargs: Unpack[_Attributes]) -> None: ...
863
+
864
+ if sys.version_info >= (3, 14):
865
+ def __replace__(self, *, op: unaryop = ..., operand: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
866
+
867
+ class Lambda(expr):
868
+ if sys.version_info >= (3, 10):
869
+ __match_args__ = ("args", "body")
870
+ args: arguments
871
+ body: expr
872
+ def __init__(self, args: arguments, body: expr, **kwargs: Unpack[_Attributes]) -> None: ...
873
+
874
+ if sys.version_info >= (3, 14):
875
+ def __replace__(self, *, args: arguments = ..., body: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
876
+
877
+ class IfExp(expr):
878
+ if sys.version_info >= (3, 10):
879
+ __match_args__ = ("test", "body", "orelse")
880
+ test: expr
881
+ body: expr
882
+ orelse: expr
883
+ def __init__(self, test: expr, body: expr, orelse: expr, **kwargs: Unpack[_Attributes]) -> None: ...
884
+
885
+ if sys.version_info >= (3, 14):
886
+ def __replace__(
887
+ self, *, test: expr = ..., body: expr = ..., orelse: expr = ..., **kwargs: Unpack[_Attributes]
888
+ ) -> Self: ...
889
+
890
+ class Dict(expr):
891
+ if sys.version_info >= (3, 10):
892
+ __match_args__ = ("keys", "values")
893
+ keys: list[expr | None]
894
+ values: list[expr]
895
+ if sys.version_info >= (3, 13):
896
+ def __init__(self, keys: list[expr | None] = ..., values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
897
+ else:
898
+ def __init__(self, keys: list[expr | None], values: list[expr], **kwargs: Unpack[_Attributes]) -> None: ...
899
+
900
+ if sys.version_info >= (3, 14):
901
+ def __replace__(
902
+ self, *, keys: list[expr | None] = ..., values: list[expr] = ..., **kwargs: Unpack[_Attributes]
903
+ ) -> Self: ...
904
+
905
+ class Set(expr):
906
+ if sys.version_info >= (3, 10):
907
+ __match_args__ = ("elts",)
908
+ elts: list[expr]
909
+ if sys.version_info >= (3, 13):
910
+ def __init__(self, elts: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
911
+ else:
912
+ def __init__(self, elts: list[expr], **kwargs: Unpack[_Attributes]) -> None: ...
913
+
914
+ if sys.version_info >= (3, 14):
915
+ def __replace__(self, *, elts: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
916
+
917
+ class ListComp(expr):
918
+ if sys.version_info >= (3, 10):
919
+ __match_args__ = ("elt", "generators")
920
+ elt: expr
921
+ generators: list[comprehension]
922
+ if sys.version_info >= (3, 13):
923
+ def __init__(self, elt: expr, generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
924
+ else:
925
+ def __init__(self, elt: expr, generators: list[comprehension], **kwargs: Unpack[_Attributes]) -> None: ...
926
+
927
+ if sys.version_info >= (3, 14):
928
+ def __replace__(
929
+ self, *, elt: expr = ..., generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]
930
+ ) -> Self: ...
931
+
932
+ class SetComp(expr):
933
+ if sys.version_info >= (3, 10):
934
+ __match_args__ = ("elt", "generators")
935
+ elt: expr
936
+ generators: list[comprehension]
937
+ if sys.version_info >= (3, 13):
938
+ def __init__(self, elt: expr, generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
939
+ else:
940
+ def __init__(self, elt: expr, generators: list[comprehension], **kwargs: Unpack[_Attributes]) -> None: ...
941
+
942
+ if sys.version_info >= (3, 14):
943
+ def __replace__(
944
+ self, *, elt: expr = ..., generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]
945
+ ) -> Self: ...
946
+
947
+ class DictComp(expr):
948
+ if sys.version_info >= (3, 10):
949
+ __match_args__ = ("key", "value", "generators")
950
+ key: expr
951
+ value: expr
952
+ generators: list[comprehension]
953
+ if sys.version_info >= (3, 13):
954
+ def __init__(
955
+ self, key: expr, value: expr, generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]
956
+ ) -> None: ...
957
+ else:
958
+ def __init__(self, key: expr, value: expr, generators: list[comprehension], **kwargs: Unpack[_Attributes]) -> None: ...
959
+
960
+ if sys.version_info >= (3, 14):
961
+ def __replace__(
962
+ self, *, key: expr = ..., value: expr = ..., generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]
963
+ ) -> Self: ...
964
+
965
+ class GeneratorExp(expr):
966
+ if sys.version_info >= (3, 10):
967
+ __match_args__ = ("elt", "generators")
968
+ elt: expr
969
+ generators: list[comprehension]
970
+ if sys.version_info >= (3, 13):
971
+ def __init__(self, elt: expr, generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
972
+ else:
973
+ def __init__(self, elt: expr, generators: list[comprehension], **kwargs: Unpack[_Attributes]) -> None: ...
974
+
975
+ if sys.version_info >= (3, 14):
976
+ def __replace__(
977
+ self, *, elt: expr = ..., generators: list[comprehension] = ..., **kwargs: Unpack[_Attributes]
978
+ ) -> Self: ...
979
+
980
+ class Await(expr):
981
+ if sys.version_info >= (3, 10):
982
+ __match_args__ = ("value",)
983
+ value: expr
984
+ def __init__(self, value: expr, **kwargs: Unpack[_Attributes]) -> None: ...
985
+
986
+ if sys.version_info >= (3, 14):
987
+ def __replace__(self, *, value: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
988
+
989
+ class Yield(expr):
990
+ if sys.version_info >= (3, 10):
991
+ __match_args__ = ("value",)
992
+ value: expr | None
993
+ def __init__(self, value: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
994
+
995
+ if sys.version_info >= (3, 14):
996
+ def __replace__(self, *, value: expr | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
997
+
998
+ class YieldFrom(expr):
999
+ if sys.version_info >= (3, 10):
1000
+ __match_args__ = ("value",)
1001
+ value: expr
1002
+ def __init__(self, value: expr, **kwargs: Unpack[_Attributes]) -> None: ...
1003
+
1004
+ if sys.version_info >= (3, 14):
1005
+ def __replace__(self, *, value: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1006
+
1007
+ class Compare(expr):
1008
+ if sys.version_info >= (3, 10):
1009
+ __match_args__ = ("left", "ops", "comparators")
1010
+ left: expr
1011
+ ops: list[cmpop]
1012
+ comparators: list[expr]
1013
+ if sys.version_info >= (3, 13):
1014
+ def __init__(
1015
+ self, left: expr, ops: list[cmpop] = ..., comparators: list[expr] = ..., **kwargs: Unpack[_Attributes]
1016
+ ) -> None: ...
1017
+ else:
1018
+ def __init__(self, left: expr, ops: list[cmpop], comparators: list[expr], **kwargs: Unpack[_Attributes]) -> None: ...
1019
+
1020
+ if sys.version_info >= (3, 14):
1021
+ def __replace__(
1022
+ self, *, left: expr = ..., ops: list[cmpop] = ..., comparators: list[expr] = ..., **kwargs: Unpack[_Attributes]
1023
+ ) -> Self: ...
1024
+
1025
+ class Call(expr):
1026
+ if sys.version_info >= (3, 10):
1027
+ __match_args__ = ("func", "args", "keywords")
1028
+ func: expr
1029
+ args: list[expr]
1030
+ keywords: list[keyword]
1031
+ if sys.version_info >= (3, 13):
1032
+ def __init__(
1033
+ self, func: expr, args: list[expr] = ..., keywords: list[keyword] = ..., **kwargs: Unpack[_Attributes]
1034
+ ) -> None: ...
1035
+ else:
1036
+ def __init__(self, func: expr, args: list[expr], keywords: list[keyword], **kwargs: Unpack[_Attributes]) -> None: ...
1037
+
1038
+ if sys.version_info >= (3, 14):
1039
+ def __replace__(
1040
+ self, *, func: expr = ..., args: list[expr] = ..., keywords: list[keyword] = ..., **kwargs: Unpack[_Attributes]
1041
+ ) -> Self: ...
1042
+
1043
+ class FormattedValue(expr):
1044
+ if sys.version_info >= (3, 10):
1045
+ __match_args__ = ("value", "conversion", "format_spec")
1046
+ value: expr
1047
+ conversion: int
1048
+ format_spec: expr | None
1049
+ def __init__(self, value: expr, conversion: int, format_spec: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
1050
+
1051
+ if sys.version_info >= (3, 14):
1052
+ def __replace__(
1053
+ self, *, value: expr = ..., conversion: int = ..., format_spec: expr | None = ..., **kwargs: Unpack[_Attributes]
1054
+ ) -> Self: ...
1055
+
1056
+ class JoinedStr(expr):
1057
+ if sys.version_info >= (3, 10):
1058
+ __match_args__ = ("values",)
1059
+ values: list[expr]
1060
+ if sys.version_info >= (3, 13):
1061
+ def __init__(self, values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1062
+ else:
1063
+ def __init__(self, values: list[expr], **kwargs: Unpack[_Attributes]) -> None: ...
1064
+
1065
+ if sys.version_info >= (3, 14):
1066
+ def __replace__(self, *, values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1067
+
1068
+ class Constant(expr):
1069
+ if sys.version_info >= (3, 10):
1070
+ __match_args__ = ("value", "kind")
1071
+ value: Any # None, str, bytes, bool, int, float, complex, Ellipsis
1072
+ kind: str | None
1073
+ if sys.version_info < (3, 14):
27
1074
  # Aliases for value, for backwards compatibility
28
- s: bytes
1075
+ s: Any
1076
+ n: int | float | complex
29
1077
 
30
- @deprecated("Replaced by ast.Constant; removed in Python 3.14")
31
- class NameConstant(Constant, metaclass=_ABC): ...
1078
+ def __init__(self, value: Any, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
32
1079
 
33
- @deprecated("Replaced by ast.Constant; removed in Python 3.14")
34
- class Ellipsis(Constant, metaclass=_ABC): ...
1080
+ if sys.version_info >= (3, 14):
1081
+ def __replace__(self, *, value: Any = ..., kind: str | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1082
+
1083
+ class Attribute(expr):
1084
+ if sys.version_info >= (3, 10):
1085
+ __match_args__ = ("value", "attr", "ctx")
1086
+ value: expr
1087
+ attr: _Identifier
1088
+ ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
1089
+ def __init__(self, value: expr, attr: _Identifier, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1090
+
1091
+ if sys.version_info >= (3, 14):
1092
+ def __replace__(
1093
+ self, *, value: expr = ..., attr: _Identifier = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]
1094
+ ) -> Self: ...
1095
+
1096
+ class Subscript(expr):
1097
+ if sys.version_info >= (3, 10):
1098
+ __match_args__ = ("value", "slice", "ctx")
1099
+ value: expr
1100
+ slice: _Slice
1101
+ ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
1102
+ def __init__(self, value: expr, slice: _Slice, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1103
+
1104
+ if sys.version_info >= (3, 14):
1105
+ def __replace__(
1106
+ self, *, value: expr = ..., slice: _Slice = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]
1107
+ ) -> Self: ...
1108
+
1109
+ class Starred(expr):
1110
+ if sys.version_info >= (3, 10):
1111
+ __match_args__ = ("value", "ctx")
1112
+ value: expr
1113
+ ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
1114
+ def __init__(self, value: expr, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1115
+
1116
+ if sys.version_info >= (3, 14):
1117
+ def __replace__(self, *, value: expr = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1118
+
1119
+ class Name(expr):
1120
+ if sys.version_info >= (3, 10):
1121
+ __match_args__ = ("id", "ctx")
1122
+ id: _Identifier
1123
+ ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
1124
+ def __init__(self, id: _Identifier, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1125
+
1126
+ if sys.version_info >= (3, 14):
1127
+ def __replace__(self, *, id: _Identifier = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1128
+
1129
+ class List(expr):
1130
+ if sys.version_info >= (3, 10):
1131
+ __match_args__ = ("elts", "ctx")
1132
+ elts: list[expr]
1133
+ ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
1134
+ if sys.version_info >= (3, 13):
1135
+ def __init__(self, elts: list[expr] = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1136
+ else:
1137
+ def __init__(self, elts: list[expr], ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1138
+
1139
+ if sys.version_info >= (3, 14):
1140
+ def __replace__(self, *, elts: list[expr] = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1141
+
1142
+ class Tuple(expr):
1143
+ if sys.version_info >= (3, 10):
1144
+ __match_args__ = ("elts", "ctx")
1145
+ elts: list[expr]
1146
+ 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]
1149
+ if sys.version_info >= (3, 13):
1150
+ def __init__(self, elts: list[expr] = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1151
+ else:
1152
+ def __init__(self, elts: list[expr], ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1153
+
1154
+ if sys.version_info >= (3, 14):
1155
+ def __replace__(self, *, elts: list[expr] = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1156
+
1157
+ class slice(AST): ... # deprecated and moved to ast.py for >= (3, 9)
35
1158
 
36
1159
  if sys.version_info >= (3, 9):
37
- class slice(AST): ...
38
- class ExtSlice(slice): ...
39
- class Index(slice): ...
40
- class Suite(mod): ...
41
- class AugLoad(expr_context): ...
42
- class AugStore(expr_context): ...
43
- class Param(expr_context): ...
1160
+ _Slice: typing_extensions.TypeAlias = expr
1161
+ _SliceAttributes: typing_extensions.TypeAlias = _Attributes
1162
+ else:
1163
+ # alias for use with variables named slice
1164
+ _Slice: typing_extensions.TypeAlias = slice
44
1165
 
45
- class NodeVisitor:
46
- def visit(self, node: AST) -> Any: ...
47
- def generic_visit(self, node: AST) -> Any: ...
48
- def visit_Module(self, node: Module) -> Any: ...
49
- def visit_Interactive(self, node: Interactive) -> Any: ...
50
- def visit_Expression(self, node: Expression) -> Any: ...
51
- def visit_FunctionDef(self, node: FunctionDef) -> Any: ...
52
- def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> Any: ...
53
- def visit_ClassDef(self, node: ClassDef) -> Any: ...
54
- def visit_Return(self, node: Return) -> Any: ...
55
- def visit_Delete(self, node: Delete) -> Any: ...
56
- def visit_Assign(self, node: Assign) -> Any: ...
57
- def visit_AugAssign(self, node: AugAssign) -> Any: ...
58
- def visit_AnnAssign(self, node: AnnAssign) -> Any: ...
59
- def visit_For(self, node: For) -> Any: ...
60
- def visit_AsyncFor(self, node: AsyncFor) -> Any: ...
61
- def visit_While(self, node: While) -> Any: ...
62
- def visit_If(self, node: If) -> Any: ...
63
- def visit_With(self, node: With) -> Any: ...
64
- def visit_AsyncWith(self, node: AsyncWith) -> Any: ...
65
- def visit_Raise(self, node: Raise) -> Any: ...
66
- def visit_Try(self, node: Try) -> Any: ...
67
- def visit_Assert(self, node: Assert) -> Any: ...
68
- def visit_Import(self, node: Import) -> Any: ...
69
- def visit_ImportFrom(self, node: ImportFrom) -> Any: ...
70
- def visit_Global(self, node: Global) -> Any: ...
71
- def visit_Nonlocal(self, node: Nonlocal) -> Any: ...
72
- def visit_Expr(self, node: Expr) -> Any: ...
73
- def visit_Pass(self, node: Pass) -> Any: ...
74
- def visit_Break(self, node: Break) -> Any: ...
75
- def visit_Continue(self, node: Continue) -> Any: ...
76
- def visit_Slice(self, node: Slice) -> Any: ...
77
- def visit_BoolOp(self, node: BoolOp) -> Any: ...
78
- def visit_BinOp(self, node: BinOp) -> Any: ...
79
- def visit_UnaryOp(self, node: UnaryOp) -> Any: ...
80
- def visit_Lambda(self, node: Lambda) -> Any: ...
81
- def visit_IfExp(self, node: IfExp) -> Any: ...
82
- def visit_Dict(self, node: Dict) -> Any: ...
83
- def visit_Set(self, node: Set) -> Any: ...
84
- def visit_ListComp(self, node: ListComp) -> Any: ...
85
- def visit_SetComp(self, node: SetComp) -> Any: ...
86
- def visit_DictComp(self, node: DictComp) -> Any: ...
87
- def visit_GeneratorExp(self, node: GeneratorExp) -> Any: ...
88
- def visit_Await(self, node: Await) -> Any: ...
89
- def visit_Yield(self, node: Yield) -> Any: ...
90
- def visit_YieldFrom(self, node: YieldFrom) -> Any: ...
91
- def visit_Compare(self, node: Compare) -> Any: ...
92
- def visit_Call(self, node: Call) -> Any: ...
93
- def visit_FormattedValue(self, node: FormattedValue) -> Any: ...
94
- def visit_JoinedStr(self, node: JoinedStr) -> Any: ...
95
- def visit_Constant(self, node: Constant) -> Any: ...
96
- def visit_NamedExpr(self, node: NamedExpr) -> Any: ...
97
- def visit_TypeIgnore(self, node: TypeIgnore) -> Any: ...
98
- def visit_Attribute(self, node: Attribute) -> Any: ...
99
- def visit_Subscript(self, node: Subscript) -> Any: ...
100
- def visit_Starred(self, node: Starred) -> Any: ...
101
- def visit_Name(self, node: Name) -> Any: ...
102
- def visit_List(self, node: List) -> Any: ...
103
- def visit_Tuple(self, node: Tuple) -> Any: ...
104
- def visit_Del(self, node: Del) -> Any: ...
105
- def visit_Load(self, node: Load) -> Any: ...
106
- def visit_Store(self, node: Store) -> Any: ...
107
- def visit_And(self, node: And) -> Any: ...
108
- def visit_Or(self, node: Or) -> Any: ...
109
- def visit_Add(self, node: Add) -> Any: ...
110
- def visit_BitAnd(self, node: BitAnd) -> Any: ...
111
- def visit_BitOr(self, node: BitOr) -> Any: ...
112
- def visit_BitXor(self, node: BitXor) -> Any: ...
113
- def visit_Div(self, node: Div) -> Any: ...
114
- def visit_FloorDiv(self, node: FloorDiv) -> Any: ...
115
- def visit_LShift(self, node: LShift) -> Any: ...
116
- def visit_Mod(self, node: Mod) -> Any: ...
117
- def visit_Mult(self, node: Mult) -> Any: ...
118
- def visit_MatMult(self, node: MatMult) -> Any: ...
119
- def visit_Pow(self, node: Pow) -> Any: ...
120
- def visit_RShift(self, node: RShift) -> Any: ...
121
- def visit_Sub(self, node: Sub) -> Any: ...
122
- def visit_Invert(self, node: Invert) -> Any: ...
123
- def visit_Not(self, node: Not) -> Any: ...
124
- def visit_UAdd(self, node: UAdd) -> Any: ...
125
- def visit_USub(self, node: USub) -> Any: ...
126
- def visit_Eq(self, node: Eq) -> Any: ...
127
- def visit_Gt(self, node: Gt) -> Any: ...
128
- def visit_GtE(self, node: GtE) -> Any: ...
129
- def visit_In(self, node: In) -> Any: ...
130
- def visit_Is(self, node: Is) -> Any: ...
131
- def visit_IsNot(self, node: IsNot) -> Any: ...
132
- def visit_Lt(self, node: Lt) -> Any: ...
133
- def visit_LtE(self, node: LtE) -> Any: ...
134
- def visit_NotEq(self, node: NotEq) -> Any: ...
135
- def visit_NotIn(self, node: NotIn) -> Any: ...
136
- def visit_comprehension(self, node: comprehension) -> Any: ...
137
- def visit_ExceptHandler(self, node: ExceptHandler) -> Any: ...
138
- def visit_arguments(self, node: arguments) -> Any: ...
139
- def visit_arg(self, node: arg) -> Any: ...
140
- def visit_keyword(self, node: keyword) -> Any: ...
141
- def visit_alias(self, node: alias) -> Any: ...
142
- def visit_withitem(self, node: withitem) -> Any: ...
1166
+ class _SliceAttributes(TypedDict): ...
1167
+
1168
+ class Slice(_Slice):
1169
+ if sys.version_info >= (3, 10):
1170
+ __match_args__ = ("lower", "upper", "step")
1171
+ lower: expr | None
1172
+ upper: expr | None
1173
+ step: expr | None
1174
+ def __init__(
1175
+ self, lower: expr | None = None, upper: expr | None = None, step: expr | None = None, **kwargs: Unpack[_SliceAttributes]
1176
+ ) -> None: ...
1177
+
1178
+ if sys.version_info >= (3, 14):
1179
+ def __replace__(
1180
+ self,
1181
+ *,
1182
+ lower: expr | None = ...,
1183
+ upper: expr | None = ...,
1184
+ step: expr | None = ...,
1185
+ **kwargs: Unpack[_SliceAttributes],
1186
+ ) -> Self: ...
1187
+
1188
+ class ExtSlice(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1189
+ dims: list[slice]
1190
+ def __init__(self, dims: list[slice], **kwargs: Unpack[_SliceAttributes]) -> None: ...
1191
+
1192
+ class Index(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1193
+ value: expr
1194
+ def __init__(self, value: expr, **kwargs: Unpack[_SliceAttributes]) -> None: ...
1195
+
1196
+ class expr_context(AST): ...
1197
+ class AugLoad(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1198
+ class AugStore(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1199
+ class Param(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1200
+
1201
+ class Suite(mod): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
1202
+ body: list[stmt]
1203
+ def __init__(self, body: list[stmt]) -> None: ...
1204
+
1205
+ class Load(expr_context): ...
1206
+ class Store(expr_context): ...
1207
+ class Del(expr_context): ...
1208
+ class boolop(AST): ...
1209
+ class And(boolop): ...
1210
+ class Or(boolop): ...
1211
+ class operator(AST): ...
1212
+ class Add(operator): ...
1213
+ class Sub(operator): ...
1214
+ class Mult(operator): ...
1215
+ class MatMult(operator): ...
1216
+ class Div(operator): ...
1217
+ class Mod(operator): ...
1218
+ class Pow(operator): ...
1219
+ class LShift(operator): ...
1220
+ class RShift(operator): ...
1221
+ class BitOr(operator): ...
1222
+ class BitXor(operator): ...
1223
+ class BitAnd(operator): ...
1224
+ class FloorDiv(operator): ...
1225
+ class unaryop(AST): ...
1226
+ class Invert(unaryop): ...
1227
+ class Not(unaryop): ...
1228
+ class UAdd(unaryop): ...
1229
+ class USub(unaryop): ...
1230
+ class cmpop(AST): ...
1231
+ class Eq(cmpop): ...
1232
+ class NotEq(cmpop): ...
1233
+ class Lt(cmpop): ...
1234
+ class LtE(cmpop): ...
1235
+ class Gt(cmpop): ...
1236
+ class GtE(cmpop): ...
1237
+ class Is(cmpop): ...
1238
+ class IsNot(cmpop): ...
1239
+ class In(cmpop): ...
1240
+ class NotIn(cmpop): ...
1241
+
1242
+ class comprehension(AST):
1243
+ if sys.version_info >= (3, 10):
1244
+ __match_args__ = ("target", "iter", "ifs", "is_async")
1245
+ target: expr
1246
+ iter: expr
1247
+ ifs: list[expr]
1248
+ is_async: int
1249
+ if sys.version_info >= (3, 13):
1250
+ @overload
1251
+ def __init__(self, target: expr, iter: expr, ifs: list[expr], is_async: int) -> None: ...
1252
+ @overload
1253
+ def __init__(self, target: expr, iter: expr, ifs: list[expr] = ..., *, is_async: int) -> None: ...
1254
+ else:
1255
+ def __init__(self, target: expr, iter: expr, ifs: list[expr], is_async: int) -> None: ...
1256
+
1257
+ if sys.version_info >= (3, 14):
1258
+ def __replace__(self, *, target: expr = ..., iter: expr = ..., ifs: list[expr] = ..., is_async: int = ...) -> Self: ...
1259
+
1260
+ class excepthandler(AST):
1261
+ lineno: int
1262
+ col_offset: int
1263
+ end_lineno: int | None
1264
+ end_col_offset: int | None
1265
+ def __init__(self, **kwargs: Unpack[_Attributes]) -> None: ...
1266
+
1267
+ if sys.version_info >= (3, 14):
1268
+ def __replace__(
1269
+ self, *, lineno: int = ..., col_offset: int = ..., end_lineno: int | None = ..., end_col_offset: int | None = ...
1270
+ ) -> Self: ...
1271
+
1272
+ class ExceptHandler(excepthandler):
1273
+ if sys.version_info >= (3, 10):
1274
+ __match_args__ = ("type", "name", "body")
1275
+ type: expr | None
1276
+ name: _Identifier | None
1277
+ body: list[stmt]
1278
+ if sys.version_info >= (3, 13):
1279
+ def __init__(
1280
+ self, type: expr | None = None, name: _Identifier | None = None, body: list[stmt] = ..., **kwargs: Unpack[_Attributes]
1281
+ ) -> None: ...
1282
+ else:
1283
+ @overload
1284
+ def __init__(
1285
+ self, type: expr | None, name: _Identifier | None, body: list[stmt], **kwargs: Unpack[_Attributes]
1286
+ ) -> None: ...
1287
+ @overload
1288
+ def __init__(
1289
+ self, type: expr | None = None, name: _Identifier | None = None, *, body: list[stmt], **kwargs: Unpack[_Attributes]
1290
+ ) -> None: ...
1291
+
1292
+ if sys.version_info >= (3, 14):
1293
+ def __replace__(
1294
+ self,
1295
+ *,
1296
+ type: expr | None = ...,
1297
+ name: _Identifier | None = ...,
1298
+ body: list[stmt] = ...,
1299
+ **kwargs: Unpack[_Attributes],
1300
+ ) -> Self: ...
1301
+
1302
+ class arguments(AST):
1303
+ if sys.version_info >= (3, 10):
1304
+ __match_args__ = ("posonlyargs", "args", "vararg", "kwonlyargs", "kw_defaults", "kwarg", "defaults")
1305
+ posonlyargs: list[arg]
1306
+ args: list[arg]
1307
+ vararg: arg | None
1308
+ kwonlyargs: list[arg]
1309
+ kw_defaults: list[expr | None]
1310
+ kwarg: arg | None
1311
+ defaults: list[expr]
1312
+ if sys.version_info >= (3, 13):
1313
+ def __init__(
1314
+ self,
1315
+ posonlyargs: list[arg] = ...,
1316
+ args: list[arg] = ...,
1317
+ vararg: arg | None = None,
1318
+ kwonlyargs: list[arg] = ...,
1319
+ kw_defaults: list[expr | None] = ...,
1320
+ kwarg: arg | None = None,
1321
+ defaults: list[expr] = ...,
1322
+ ) -> None: ...
1323
+ else:
1324
+ @overload
1325
+ def __init__(
1326
+ self,
1327
+ posonlyargs: list[arg],
1328
+ args: list[arg],
1329
+ vararg: arg | None,
1330
+ kwonlyargs: list[arg],
1331
+ kw_defaults: list[expr | None],
1332
+ kwarg: arg | None,
1333
+ defaults: list[expr],
1334
+ ) -> None: ...
1335
+ @overload
1336
+ def __init__(
1337
+ self,
1338
+ posonlyargs: list[arg],
1339
+ args: list[arg],
1340
+ vararg: arg | None,
1341
+ kwonlyargs: list[arg],
1342
+ kw_defaults: list[expr | None],
1343
+ kwarg: arg | None = None,
1344
+ *,
1345
+ defaults: list[expr],
1346
+ ) -> None: ...
1347
+ @overload
1348
+ def __init__(
1349
+ self,
1350
+ posonlyargs: list[arg],
1351
+ args: list[arg],
1352
+ vararg: arg | None = None,
1353
+ *,
1354
+ kwonlyargs: list[arg],
1355
+ kw_defaults: list[expr | None],
1356
+ kwarg: arg | None = None,
1357
+ defaults: list[expr],
1358
+ ) -> None: ...
1359
+
1360
+ if sys.version_info >= (3, 14):
1361
+ def __replace__(
1362
+ self,
1363
+ *,
1364
+ posonlyargs: list[arg] = ...,
1365
+ args: list[arg] = ...,
1366
+ vararg: arg | None = ...,
1367
+ kwonlyargs: list[arg] = ...,
1368
+ kw_defaults: list[expr | None] = ...,
1369
+ kwarg: arg | None = ...,
1370
+ defaults: list[expr] = ...,
1371
+ ) -> Self: ...
1372
+
1373
+ class arg(AST):
1374
+ lineno: int
1375
+ col_offset: int
1376
+ end_lineno: int | None
1377
+ end_col_offset: int | None
1378
+ if sys.version_info >= (3, 10):
1379
+ __match_args__ = ("arg", "annotation", "type_comment")
1380
+ arg: _Identifier
1381
+ annotation: expr | None
1382
+ type_comment: str | None
1383
+ def __init__(
1384
+ self, arg: _Identifier, annotation: expr | None = None, type_comment: str | None = None, **kwargs: Unpack[_Attributes]
1385
+ ) -> None: ...
1386
+
1387
+ if sys.version_info >= (3, 14):
1388
+ def __replace__(
1389
+ self,
1390
+ *,
1391
+ arg: _Identifier = ...,
1392
+ annotation: expr | None = ...,
1393
+ type_comment: str | None = ...,
1394
+ **kwargs: Unpack[_Attributes],
1395
+ ) -> Self: ...
1396
+
1397
+ class keyword(AST):
1398
+ lineno: int
1399
+ col_offset: int
1400
+ end_lineno: int | None
1401
+ end_col_offset: int | None
1402
+ if sys.version_info >= (3, 10):
1403
+ __match_args__ = ("arg", "value")
1404
+ arg: _Identifier | None
1405
+ value: expr
1406
+ @overload
1407
+ def __init__(self, arg: _Identifier | None, value: expr, **kwargs: Unpack[_Attributes]) -> None: ...
1408
+ @overload
1409
+ def __init__(self, arg: _Identifier | None = None, *, value: expr, **kwargs: Unpack[_Attributes]) -> None: ...
1410
+
1411
+ if sys.version_info >= (3, 14):
1412
+ def __replace__(self, *, arg: _Identifier | None = ..., value: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
1413
+
1414
+ class alias(AST):
1415
+ lineno: int
1416
+ col_offset: int
1417
+ end_lineno: int | None
1418
+ end_col_offset: int | None
143
1419
  if sys.version_info >= (3, 10):
144
- def visit_Match(self, node: Match) -> Any: ...
145
- def visit_match_case(self, node: match_case) -> Any: ...
146
- def visit_MatchValue(self, node: MatchValue) -> Any: ...
147
- def visit_MatchSequence(self, node: MatchSequence) -> Any: ...
148
- def visit_MatchSingleton(self, node: MatchSingleton) -> Any: ...
149
- def visit_MatchStar(self, node: MatchStar) -> Any: ...
150
- def visit_MatchMapping(self, node: MatchMapping) -> Any: ...
151
- def visit_MatchClass(self, node: MatchClass) -> Any: ...
152
- def visit_MatchAs(self, node: MatchAs) -> Any: ...
153
- def visit_MatchOr(self, node: MatchOr) -> Any: ...
1420
+ __match_args__ = ("name", "asname")
1421
+ name: str
1422
+ asname: _Identifier | None
1423
+ def __init__(self, name: str, asname: _Identifier | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
154
1424
 
155
- if sys.version_info >= (3, 11):
156
- def visit_TryStar(self, node: TryStar) -> Any: ...
1425
+ if sys.version_info >= (3, 14):
1426
+ def __replace__(self, *, name: str = ..., asname: _Identifier | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
157
1427
 
158
- if sys.version_info >= (3, 12):
159
- def visit_TypeVar(self, node: TypeVar) -> Any: ...
160
- def visit_ParamSpec(self, node: ParamSpec) -> Any: ...
161
- def visit_TypeVarTuple(self, node: TypeVarTuple) -> Any: ...
162
- def visit_TypeAlias(self, node: TypeAlias) -> Any: ...
1428
+ class withitem(AST):
1429
+ if sys.version_info >= (3, 10):
1430
+ __match_args__ = ("context_expr", "optional_vars")
1431
+ context_expr: expr
1432
+ optional_vars: expr | None
1433
+ def __init__(self, context_expr: expr, optional_vars: expr | None = None) -> None: ...
163
1434
 
164
- # visit methods for deprecated nodes
165
- def visit_ExtSlice(self, node: ExtSlice) -> Any: ...
166
- def visit_Index(self, node: Index) -> Any: ...
167
- def visit_Suite(self, node: Suite) -> Any: ...
168
- def visit_AugLoad(self, node: AugLoad) -> Any: ...
169
- def visit_AugStore(self, node: AugStore) -> Any: ...
170
- def visit_Param(self, node: Param) -> Any: ...
171
- def visit_Num(self, node: Num) -> Any: ...
172
- def visit_Str(self, node: Str) -> Any: ...
173
- def visit_Bytes(self, node: Bytes) -> Any: ...
174
- def visit_NameConstant(self, node: NameConstant) -> Any: ...
175
- def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
1435
+ if sys.version_info >= (3, 14):
1436
+ def __replace__(self, *, context_expr: expr = ..., optional_vars: expr | None = ...) -> Self: ...
176
1437
 
177
- class NodeTransformer(NodeVisitor):
178
- def generic_visit(self, node: AST) -> AST: ...
179
- # TODO: Override the visit_* methods with better return types.
180
- # The usual return type is AST | None, but Iterable[AST]
181
- # is also allowed in some cases -- this needs to be mapped.
1438
+ if sys.version_info >= (3, 10):
1439
+ class match_case(AST):
1440
+ __match_args__ = ("pattern", "guard", "body")
1441
+ pattern: _Pattern
1442
+ guard: expr | None
1443
+ body: list[stmt]
1444
+ if sys.version_info >= (3, 13):
1445
+ def __init__(self, pattern: _Pattern, guard: expr | None = None, body: list[stmt] = ...) -> None: ...
1446
+ else:
1447
+ @overload
1448
+ def __init__(self, pattern: _Pattern, guard: expr | None, body: list[stmt]) -> None: ...
1449
+ @overload
1450
+ def __init__(self, pattern: _Pattern, guard: expr | None = None, *, body: list[stmt]) -> None: ...
1451
+
1452
+ if sys.version_info >= (3, 14):
1453
+ def __replace__(self, *, pattern: _Pattern = ..., guard: expr | None = ..., body: list[stmt] = ...) -> Self: ...
1454
+
1455
+ class pattern(AST):
1456
+ lineno: int
1457
+ col_offset: int
1458
+ end_lineno: int
1459
+ end_col_offset: int
1460
+ def __init__(self, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1461
+
1462
+ if sys.version_info >= (3, 14):
1463
+ def __replace__(
1464
+ self, *, lineno: int = ..., col_offset: int = ..., end_lineno: int = ..., end_col_offset: int = ...
1465
+ ) -> Self: ...
1466
+
1467
+ # Without the alias, Pyright complains variables named pattern are recursively defined
1468
+ _Pattern: typing_extensions.TypeAlias = pattern
1469
+
1470
+ class MatchValue(pattern):
1471
+ __match_args__ = ("value",)
1472
+ value: expr
1473
+ def __init__(self, value: expr, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1474
+
1475
+ if sys.version_info >= (3, 14):
1476
+ def __replace__(self, *, value: expr = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
1477
+
1478
+ class MatchSingleton(pattern):
1479
+ __match_args__ = ("value",)
1480
+ value: Literal[True, False] | None
1481
+ def __init__(self, value: Literal[True, False] | None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1482
+
1483
+ if sys.version_info >= (3, 14):
1484
+ def __replace__(self, *, value: Literal[True, False] | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
1485
+
1486
+ class MatchSequence(pattern):
1487
+ __match_args__ = ("patterns",)
1488
+ patterns: list[pattern]
1489
+ if sys.version_info >= (3, 13):
1490
+ def __init__(self, patterns: list[pattern] = ..., **kwargs: Unpack[_Attributes[int]]) -> None: ...
1491
+ else:
1492
+ def __init__(self, patterns: list[pattern], **kwargs: Unpack[_Attributes[int]]) -> None: ...
1493
+
1494
+ if sys.version_info >= (3, 14):
1495
+ def __replace__(self, *, patterns: list[pattern] = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
1496
+
1497
+ class MatchMapping(pattern):
1498
+ __match_args__ = ("keys", "patterns", "rest")
1499
+ keys: list[expr]
1500
+ patterns: list[pattern]
1501
+ rest: _Identifier | None
1502
+ if sys.version_info >= (3, 13):
1503
+ def __init__(
1504
+ self,
1505
+ keys: list[expr] = ...,
1506
+ patterns: list[pattern] = ...,
1507
+ rest: _Identifier | None = None,
1508
+ **kwargs: Unpack[_Attributes[int]],
1509
+ ) -> None: ...
1510
+ else:
1511
+ def __init__(
1512
+ self,
1513
+ keys: list[expr],
1514
+ patterns: list[pattern],
1515
+ rest: _Identifier | None = None,
1516
+ **kwargs: Unpack[_Attributes[int]],
1517
+ ) -> None: ...
1518
+
1519
+ if sys.version_info >= (3, 14):
1520
+ def __replace__(
1521
+ self,
1522
+ *,
1523
+ keys: list[expr] = ...,
1524
+ patterns: list[pattern] = ...,
1525
+ rest: _Identifier | None = ...,
1526
+ **kwargs: Unpack[_Attributes[int]],
1527
+ ) -> Self: ...
1528
+
1529
+ class MatchClass(pattern):
1530
+ __match_args__ = ("cls", "patterns", "kwd_attrs", "kwd_patterns")
1531
+ cls: expr
1532
+ patterns: list[pattern]
1533
+ kwd_attrs: list[_Identifier]
1534
+ kwd_patterns: list[pattern]
1535
+ if sys.version_info >= (3, 13):
1536
+ def __init__(
1537
+ self,
1538
+ cls: expr,
1539
+ patterns: list[pattern] = ...,
1540
+ kwd_attrs: list[_Identifier] = ...,
1541
+ kwd_patterns: list[pattern] = ...,
1542
+ **kwargs: Unpack[_Attributes[int]],
1543
+ ) -> None: ...
1544
+ else:
1545
+ def __init__(
1546
+ self,
1547
+ cls: expr,
1548
+ patterns: list[pattern],
1549
+ kwd_attrs: list[_Identifier],
1550
+ kwd_patterns: list[pattern],
1551
+ **kwargs: Unpack[_Attributes[int]],
1552
+ ) -> None: ...
1553
+
1554
+ if sys.version_info >= (3, 14):
1555
+ def __replace__(
1556
+ self,
1557
+ *,
1558
+ cls: expr = ...,
1559
+ patterns: list[pattern] = ...,
1560
+ kwd_attrs: list[_Identifier] = ...,
1561
+ kwd_patterns: list[pattern] = ...,
1562
+ **kwargs: Unpack[_Attributes[int]],
1563
+ ) -> Self: ...
1564
+
1565
+ class MatchStar(pattern):
1566
+ __match_args__ = ("name",)
1567
+ name: _Identifier | None
1568
+ def __init__(self, name: _Identifier | None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1569
+
1570
+ if sys.version_info >= (3, 14):
1571
+ def __replace__(self, *, name: _Identifier | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
1572
+
1573
+ class MatchAs(pattern):
1574
+ __match_args__ = ("pattern", "name")
1575
+ pattern: _Pattern | None
1576
+ name: _Identifier | None
1577
+ def __init__(
1578
+ self, pattern: _Pattern | None = None, name: _Identifier | None = None, **kwargs: Unpack[_Attributes[int]]
1579
+ ) -> None: ...
1580
+
1581
+ if sys.version_info >= (3, 14):
1582
+ def __replace__(
1583
+ self, *, pattern: _Pattern | None = ..., name: _Identifier | None = ..., **kwargs: Unpack[_Attributes[int]]
1584
+ ) -> Self: ...
1585
+
1586
+ class MatchOr(pattern):
1587
+ __match_args__ = ("patterns",)
1588
+ patterns: list[pattern]
1589
+ if sys.version_info >= (3, 13):
1590
+ def __init__(self, patterns: list[pattern] = ..., **kwargs: Unpack[_Attributes[int]]) -> None: ...
1591
+ else:
1592
+ def __init__(self, patterns: list[pattern], **kwargs: Unpack[_Attributes[int]]) -> None: ...
1593
+
1594
+ if sys.version_info >= (3, 14):
1595
+ def __replace__(self, *, patterns: list[pattern] = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
1596
+
1597
+ class type_ignore(AST): ...
1598
+
1599
+ class TypeIgnore(type_ignore):
1600
+ if sys.version_info >= (3, 10):
1601
+ __match_args__ = ("lineno", "tag")
1602
+ lineno: int
1603
+ tag: str
1604
+ def __init__(self, lineno: int, tag: str) -> None: ...
1605
+
1606
+ if sys.version_info >= (3, 14):
1607
+ def __replace__(self, *, lineno: int = ..., tag: str = ...) -> Self: ...
1608
+
1609
+ if sys.version_info >= (3, 12):
1610
+ class type_param(AST):
1611
+ lineno: int
1612
+ col_offset: int
1613
+ end_lineno: int
1614
+ end_col_offset: int
1615
+ def __init__(self, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1616
+
1617
+ if sys.version_info >= (3, 14):
1618
+ def __replace__(self, **kwargs: Unpack[_Attributes[int]]) -> Self: ...
1619
+
1620
+ class TypeVar(type_param):
1621
+ if sys.version_info >= (3, 13):
1622
+ __match_args__ = ("name", "bound", "default_value")
1623
+ else:
1624
+ __match_args__ = ("name", "bound")
1625
+ name: _Identifier
1626
+ bound: expr | None
1627
+ if sys.version_info >= (3, 13):
1628
+ default_value: expr | None
1629
+ def __init__(
1630
+ self,
1631
+ name: _Identifier,
1632
+ bound: expr | None = None,
1633
+ default_value: expr | None = None,
1634
+ **kwargs: Unpack[_Attributes[int]],
1635
+ ) -> None: ...
1636
+ else:
1637
+ def __init__(self, name: _Identifier, bound: expr | None = None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1638
+
1639
+ if sys.version_info >= (3, 14):
1640
+ def __replace__(
1641
+ self,
1642
+ *,
1643
+ name: _Identifier = ...,
1644
+ bound: expr | None = ...,
1645
+ default_value: expr | None = ...,
1646
+ **kwargs: Unpack[_Attributes[int]],
1647
+ ) -> Self: ...
1648
+
1649
+ class ParamSpec(type_param):
1650
+ if sys.version_info >= (3, 13):
1651
+ __match_args__ = ("name", "default_value")
1652
+ else:
1653
+ __match_args__ = ("name",)
1654
+ name: _Identifier
1655
+ if sys.version_info >= (3, 13):
1656
+ default_value: expr | None
1657
+ def __init__(
1658
+ self, name: _Identifier, default_value: expr | None = None, **kwargs: Unpack[_Attributes[int]]
1659
+ ) -> None: ...
1660
+ else:
1661
+ def __init__(self, name: _Identifier, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1662
+
1663
+ if sys.version_info >= (3, 14):
1664
+ def __replace__(
1665
+ self, *, name: _Identifier = ..., default_value: expr | None = ..., **kwargs: Unpack[_Attributes[int]]
1666
+ ) -> Self: ...
1667
+
1668
+ class TypeVarTuple(type_param):
1669
+ if sys.version_info >= (3, 13):
1670
+ __match_args__ = ("name", "default_value")
1671
+ else:
1672
+ __match_args__ = ("name",)
1673
+ name: _Identifier
1674
+ if sys.version_info >= (3, 13):
1675
+ default_value: expr | None
1676
+ def __init__(
1677
+ self, name: _Identifier, default_value: expr | None = None, **kwargs: Unpack[_Attributes[int]]
1678
+ ) -> None: ...
1679
+ else:
1680
+ def __init__(self, name: _Identifier, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1681
+
1682
+ if sys.version_info >= (3, 14):
1683
+ def __replace__(
1684
+ self, *, name: _Identifier = ..., default_value: expr | None = ..., **kwargs: Unpack[_Attributes[int]]
1685
+ ) -> Self: ...
1686
+
1687
+ class _ABC(type):
1688
+ if sys.version_info >= (3, 9):
1689
+ def __init__(cls, *args: Unused) -> None: ...
1690
+
1691
+ if sys.version_info < (3, 14):
1692
+ @deprecated("Replaced by ast.Constant; removed in Python 3.14")
1693
+ class Num(Constant, metaclass=_ABC):
1694
+ value: int | float | complex
1695
+
1696
+ @deprecated("Replaced by ast.Constant; removed in Python 3.14")
1697
+ class Str(Constant, metaclass=_ABC):
1698
+ value: str
1699
+ # Aliases for value, for backwards compatibility
1700
+ s: str
1701
+
1702
+ @deprecated("Replaced by ast.Constant; removed in Python 3.14")
1703
+ class Bytes(Constant, metaclass=_ABC):
1704
+ value: bytes
1705
+ # Aliases for value, for backwards compatibility
1706
+ s: bytes
1707
+
1708
+ @deprecated("Replaced by ast.Constant; removed in Python 3.14")
1709
+ class NameConstant(Constant, metaclass=_ABC): ...
1710
+
1711
+ @deprecated("Replaced by ast.Constant; removed in Python 3.14")
1712
+ class Ellipsis(Constant, metaclass=_ABC): ...
1713
+
1714
+ # everything below here is defined in ast.py
182
1715
 
183
1716
  _T = _TypeVar("_T", bound=AST)
184
1717
 
@@ -332,10 +1865,7 @@ else:
332
1865
  feature_version: None | int | tuple[int, int] = None,
333
1866
  ) -> AST: ...
334
1867
 
335
- if sys.version_info >= (3, 9):
336
- def unparse(ast_obj: AST) -> str: ...
337
-
338
- def copy_location(new_node: _T, old_node: AST) -> _T: ...
1868
+ def literal_eval(node_or_string: str | AST) -> Any: ...
339
1869
 
340
1870
  if sys.version_info >= (3, 13):
341
1871
  def dump(
@@ -355,17 +1885,158 @@ elif sys.version_info >= (3, 9):
355
1885
  else:
356
1886
  def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = False) -> str: ...
357
1887
 
1888
+ def copy_location(new_node: _T, old_node: AST) -> _T: ...
358
1889
  def fix_missing_locations(node: _T) -> _T: ...
359
- def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = True) -> str | None: ...
360
1890
  def increment_lineno(node: _T, n: int = 1) -> _T: ...
361
- def iter_child_nodes(node: AST) -> Iterator[AST]: ...
362
1891
  def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
363
- def literal_eval(node_or_string: str | AST) -> Any: ...
1892
+ def iter_child_nodes(node: AST) -> Iterator[AST]: ...
1893
+ def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = True) -> str | None: ...
364
1894
  def get_source_segment(source: str, node: AST, *, padded: bool = False) -> str | None: ...
365
1895
  def walk(node: AST) -> Iterator[AST]: ...
366
1896
 
367
- if sys.version_info >= (3, 9):
368
- def main() -> None: ...
369
-
370
1897
  if sys.version_info >= (3, 14):
371
1898
  def compare(left: AST, right: AST, /, *, compare_attributes: bool = False) -> bool: ...
1899
+
1900
+ class NodeVisitor:
1901
+ def visit(self, node: AST) -> Any: ...
1902
+ def generic_visit(self, node: AST) -> Any: ...
1903
+ def visit_Module(self, node: Module) -> Any: ...
1904
+ def visit_Interactive(self, node: Interactive) -> Any: ...
1905
+ def visit_Expression(self, node: Expression) -> Any: ...
1906
+ def visit_FunctionDef(self, node: FunctionDef) -> Any: ...
1907
+ def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> Any: ...
1908
+ def visit_ClassDef(self, node: ClassDef) -> Any: ...
1909
+ def visit_Return(self, node: Return) -> Any: ...
1910
+ def visit_Delete(self, node: Delete) -> Any: ...
1911
+ def visit_Assign(self, node: Assign) -> Any: ...
1912
+ def visit_AugAssign(self, node: AugAssign) -> Any: ...
1913
+ def visit_AnnAssign(self, node: AnnAssign) -> Any: ...
1914
+ def visit_For(self, node: For) -> Any: ...
1915
+ def visit_AsyncFor(self, node: AsyncFor) -> Any: ...
1916
+ def visit_While(self, node: While) -> Any: ...
1917
+ def visit_If(self, node: If) -> Any: ...
1918
+ def visit_With(self, node: With) -> Any: ...
1919
+ def visit_AsyncWith(self, node: AsyncWith) -> Any: ...
1920
+ def visit_Raise(self, node: Raise) -> Any: ...
1921
+ def visit_Try(self, node: Try) -> Any: ...
1922
+ def visit_Assert(self, node: Assert) -> Any: ...
1923
+ def visit_Import(self, node: Import) -> Any: ...
1924
+ def visit_ImportFrom(self, node: ImportFrom) -> Any: ...
1925
+ def visit_Global(self, node: Global) -> Any: ...
1926
+ def visit_Nonlocal(self, node: Nonlocal) -> Any: ...
1927
+ def visit_Expr(self, node: Expr) -> Any: ...
1928
+ def visit_Pass(self, node: Pass) -> Any: ...
1929
+ def visit_Break(self, node: Break) -> Any: ...
1930
+ def visit_Continue(self, node: Continue) -> Any: ...
1931
+ def visit_Slice(self, node: Slice) -> Any: ...
1932
+ def visit_BoolOp(self, node: BoolOp) -> Any: ...
1933
+ def visit_BinOp(self, node: BinOp) -> Any: ...
1934
+ def visit_UnaryOp(self, node: UnaryOp) -> Any: ...
1935
+ def visit_Lambda(self, node: Lambda) -> Any: ...
1936
+ def visit_IfExp(self, node: IfExp) -> Any: ...
1937
+ def visit_Dict(self, node: Dict) -> Any: ...
1938
+ def visit_Set(self, node: Set) -> Any: ...
1939
+ def visit_ListComp(self, node: ListComp) -> Any: ...
1940
+ def visit_SetComp(self, node: SetComp) -> Any: ...
1941
+ def visit_DictComp(self, node: DictComp) -> Any: ...
1942
+ def visit_GeneratorExp(self, node: GeneratorExp) -> Any: ...
1943
+ def visit_Await(self, node: Await) -> Any: ...
1944
+ def visit_Yield(self, node: Yield) -> Any: ...
1945
+ def visit_YieldFrom(self, node: YieldFrom) -> Any: ...
1946
+ def visit_Compare(self, node: Compare) -> Any: ...
1947
+ def visit_Call(self, node: Call) -> Any: ...
1948
+ def visit_FormattedValue(self, node: FormattedValue) -> Any: ...
1949
+ def visit_JoinedStr(self, node: JoinedStr) -> Any: ...
1950
+ def visit_Constant(self, node: Constant) -> Any: ...
1951
+ def visit_NamedExpr(self, node: NamedExpr) -> Any: ...
1952
+ def visit_TypeIgnore(self, node: TypeIgnore) -> Any: ...
1953
+ def visit_Attribute(self, node: Attribute) -> Any: ...
1954
+ def visit_Subscript(self, node: Subscript) -> Any: ...
1955
+ def visit_Starred(self, node: Starred) -> Any: ...
1956
+ def visit_Name(self, node: Name) -> Any: ...
1957
+ def visit_List(self, node: List) -> Any: ...
1958
+ def visit_Tuple(self, node: Tuple) -> Any: ...
1959
+ def visit_Del(self, node: Del) -> Any: ...
1960
+ def visit_Load(self, node: Load) -> Any: ...
1961
+ def visit_Store(self, node: Store) -> Any: ...
1962
+ def visit_And(self, node: And) -> Any: ...
1963
+ def visit_Or(self, node: Or) -> Any: ...
1964
+ def visit_Add(self, node: Add) -> Any: ...
1965
+ def visit_BitAnd(self, node: BitAnd) -> Any: ...
1966
+ def visit_BitOr(self, node: BitOr) -> Any: ...
1967
+ def visit_BitXor(self, node: BitXor) -> Any: ...
1968
+ def visit_Div(self, node: Div) -> Any: ...
1969
+ def visit_FloorDiv(self, node: FloorDiv) -> Any: ...
1970
+ def visit_LShift(self, node: LShift) -> Any: ...
1971
+ def visit_Mod(self, node: Mod) -> Any: ...
1972
+ def visit_Mult(self, node: Mult) -> Any: ...
1973
+ def visit_MatMult(self, node: MatMult) -> Any: ...
1974
+ def visit_Pow(self, node: Pow) -> Any: ...
1975
+ def visit_RShift(self, node: RShift) -> Any: ...
1976
+ def visit_Sub(self, node: Sub) -> Any: ...
1977
+ def visit_Invert(self, node: Invert) -> Any: ...
1978
+ def visit_Not(self, node: Not) -> Any: ...
1979
+ def visit_UAdd(self, node: UAdd) -> Any: ...
1980
+ def visit_USub(self, node: USub) -> Any: ...
1981
+ def visit_Eq(self, node: Eq) -> Any: ...
1982
+ def visit_Gt(self, node: Gt) -> Any: ...
1983
+ def visit_GtE(self, node: GtE) -> Any: ...
1984
+ def visit_In(self, node: In) -> Any: ...
1985
+ def visit_Is(self, node: Is) -> Any: ...
1986
+ def visit_IsNot(self, node: IsNot) -> Any: ...
1987
+ def visit_Lt(self, node: Lt) -> Any: ...
1988
+ def visit_LtE(self, node: LtE) -> Any: ...
1989
+ def visit_NotEq(self, node: NotEq) -> Any: ...
1990
+ def visit_NotIn(self, node: NotIn) -> Any: ...
1991
+ def visit_comprehension(self, node: comprehension) -> Any: ...
1992
+ def visit_ExceptHandler(self, node: ExceptHandler) -> Any: ...
1993
+ def visit_arguments(self, node: arguments) -> Any: ...
1994
+ def visit_arg(self, node: arg) -> Any: ...
1995
+ def visit_keyword(self, node: keyword) -> Any: ...
1996
+ def visit_alias(self, node: alias) -> Any: ...
1997
+ def visit_withitem(self, node: withitem) -> Any: ...
1998
+ if sys.version_info >= (3, 10):
1999
+ def visit_Match(self, node: Match) -> Any: ...
2000
+ def visit_match_case(self, node: match_case) -> Any: ...
2001
+ def visit_MatchValue(self, node: MatchValue) -> Any: ...
2002
+ def visit_MatchSequence(self, node: MatchSequence) -> Any: ...
2003
+ def visit_MatchSingleton(self, node: MatchSingleton) -> Any: ...
2004
+ def visit_MatchStar(self, node: MatchStar) -> Any: ...
2005
+ def visit_MatchMapping(self, node: MatchMapping) -> Any: ...
2006
+ def visit_MatchClass(self, node: MatchClass) -> Any: ...
2007
+ def visit_MatchAs(self, node: MatchAs) -> Any: ...
2008
+ def visit_MatchOr(self, node: MatchOr) -> Any: ...
2009
+
2010
+ if sys.version_info >= (3, 11):
2011
+ def visit_TryStar(self, node: TryStar) -> Any: ...
2012
+
2013
+ if sys.version_info >= (3, 12):
2014
+ def visit_TypeVar(self, node: TypeVar) -> Any: ...
2015
+ def visit_ParamSpec(self, node: ParamSpec) -> Any: ...
2016
+ def visit_TypeVarTuple(self, node: TypeVarTuple) -> Any: ...
2017
+ def visit_TypeAlias(self, node: TypeAlias) -> Any: ...
2018
+
2019
+ # visit methods for deprecated nodes
2020
+ def visit_ExtSlice(self, node: ExtSlice) -> Any: ...
2021
+ def visit_Index(self, node: Index) -> Any: ...
2022
+ def visit_Suite(self, node: Suite) -> Any: ...
2023
+ def visit_AugLoad(self, node: AugLoad) -> Any: ...
2024
+ def visit_AugStore(self, node: AugStore) -> Any: ...
2025
+ def visit_Param(self, node: Param) -> Any: ...
2026
+ def visit_Num(self, node: Num) -> Any: ...
2027
+ def visit_Str(self, node: Str) -> Any: ...
2028
+ def visit_Bytes(self, node: Bytes) -> Any: ...
2029
+ def visit_NameConstant(self, node: NameConstant) -> Any: ...
2030
+ def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
2031
+
2032
+ class NodeTransformer(NodeVisitor):
2033
+ def generic_visit(self, node: AST) -> AST: ...
2034
+ # TODO: Override the visit_* methods with better return types.
2035
+ # The usual return type is AST | None, but Iterable[AST]
2036
+ # is also allowed in some cases -- this needs to be mapped.
2037
+
2038
+ if sys.version_info >= (3, 9):
2039
+ def unparse(ast_obj: AST) -> str: ...
2040
+
2041
+ if sys.version_info >= (3, 9):
2042
+ def main() -> None: ...