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
@@ -0,0 +1,406 @@
1
+ """
2
+ Implementation module for SSL socket operations. See the socket module
3
+ for documentation.
4
+ """
5
+
6
+ import sys
7
+ from _typeshed import ReadableBuffer, StrOrBytesPath
8
+ from collections.abc import Callable
9
+ from ssl import (
10
+ SSLCertVerificationError as SSLCertVerificationError,
11
+ SSLContext,
12
+ SSLEOFError as SSLEOFError,
13
+ SSLError as SSLError,
14
+ SSLObject,
15
+ SSLSyscallError as SSLSyscallError,
16
+ SSLWantReadError as SSLWantReadError,
17
+ SSLWantWriteError as SSLWantWriteError,
18
+ SSLZeroReturnError as SSLZeroReturnError,
19
+ )
20
+ from typing import Any, Literal, TypedDict, final, overload
21
+ from typing_extensions import NotRequired, Self, TypeAlias
22
+
23
+ _PasswordType: TypeAlias = Callable[[], str | bytes | bytearray] | str | bytes | bytearray
24
+ _PCTRTT: TypeAlias = tuple[tuple[str, str], ...]
25
+ _PCTRTTT: TypeAlias = tuple[_PCTRTT, ...]
26
+ _PeerCertRetDictType: TypeAlias = dict[str, str | _PCTRTTT | _PCTRTT]
27
+
28
+ class _Cipher(TypedDict):
29
+ aead: bool
30
+ alg_bits: int
31
+ auth: str
32
+ description: str
33
+ digest: str | None
34
+ id: int
35
+ kea: str
36
+ name: str
37
+ protocol: str
38
+ strength_bits: int
39
+ symmetric: str
40
+
41
+ class _CertInfo(TypedDict):
42
+ subject: tuple[tuple[tuple[str, str], ...], ...]
43
+ issuer: tuple[tuple[tuple[str, str], ...], ...]
44
+ version: int
45
+ serialNumber: str
46
+ notBefore: str
47
+ notAfter: str
48
+ subjectAltName: NotRequired[tuple[tuple[str, str], ...] | None]
49
+ OCSP: NotRequired[tuple[str, ...] | None]
50
+ caIssuers: NotRequired[tuple[str, ...] | None]
51
+ crlDistributionPoints: NotRequired[tuple[str, ...] | None]
52
+
53
+ def RAND_add(string: str | ReadableBuffer, entropy: float, /) -> None:
54
+ """
55
+ Mix string into the OpenSSL PRNG state.
56
+
57
+ entropy (a float) is a lower bound on the entropy contained in
58
+ string. See RFC 4086.
59
+ """
60
+ ...
61
+ def RAND_bytes(n: int, /) -> bytes:
62
+ """Generate n cryptographically strong pseudo-random bytes."""
63
+ ...
64
+
65
+ if sys.version_info < (3, 12):
66
+ def RAND_pseudo_bytes(n: int, /) -> tuple[bytes, bool]:
67
+ """
68
+ Generate n pseudo-random bytes.
69
+
70
+ Return a pair (bytes, is_cryptographic). is_cryptographic is True
71
+ if the bytes generated are cryptographically strong.
72
+ """
73
+ ...
74
+
75
+ if sys.version_info < (3, 10):
76
+ def RAND_egd(path: str) -> None: ...
77
+
78
+ def RAND_status() -> bool:
79
+ """
80
+ Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.
81
+
82
+ It is necessary to seed the PRNG with RAND_add() on some platforms before
83
+ using the ssl() function.
84
+ """
85
+ ...
86
+ def get_default_verify_paths() -> tuple[str, str, str, str]:
87
+ """
88
+ Return search paths and environment vars that are used by SSLContext's set_default_verify_paths() to load default CAs.
89
+
90
+ The values are 'cert_file_env', 'cert_file', 'cert_dir_env', 'cert_dir'.
91
+ """
92
+ ...
93
+
94
+ if sys.platform == "win32":
95
+ _EnumRetType: TypeAlias = list[tuple[bytes, str, set[str] | bool]]
96
+ def enum_certificates(store_name: str) -> _EnumRetType: ...
97
+ def enum_crls(store_name: str) -> _EnumRetType: ...
98
+
99
+ def txt2obj(txt: str, name: bool = False) -> tuple[int, str, str, str]:
100
+ """
101
+ Lookup NID, short name, long name and OID of an ASN1_OBJECT.
102
+
103
+ By default objects are looked up by OID. With name=True short and
104
+ long name are also matched.
105
+ """
106
+ ...
107
+ def nid2obj(nid: int, /) -> tuple[int, str, str, str]:
108
+ """Lookup NID, short name, long name and OID of an ASN1_OBJECT by NID."""
109
+ ...
110
+
111
+ class _SSLContext:
112
+ check_hostname: bool
113
+ keylog_filename: str | None
114
+ maximum_version: int
115
+ minimum_version: int
116
+ num_tickets: int
117
+ options: int
118
+ post_handshake_auth: bool
119
+ protocol: int
120
+ if sys.version_info >= (3, 10):
121
+ security_level: int
122
+ sni_callback: Callable[[SSLObject, str, SSLContext], None | int] | None
123
+ verify_flags: int
124
+ verify_mode: int
125
+ def __new__(cls, protocol: int, /) -> Self: ...
126
+ def cert_store_stats(self) -> dict[str, int]:
127
+ """
128
+ Returns quantities of loaded X.509 certificates.
129
+
130
+ X.509 certificates with a CA extension and certificate revocation lists
131
+ inside the context's cert store.
132
+
133
+ NOTE: Certificates in a capath directory aren't loaded unless they have
134
+ been used at least once.
135
+ """
136
+ ...
137
+ @overload
138
+ def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]:
139
+ """
140
+ Returns a list of dicts with information of loaded CA certs.
141
+
142
+ If the optional argument is True, returns a DER-encoded copy of the CA
143
+ certificate.
144
+
145
+ NOTE: Certificates in a capath directory aren't loaded unless they have
146
+ been used at least once.
147
+ """
148
+ ...
149
+ @overload
150
+ def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]:
151
+ """
152
+ Returns a list of dicts with information of loaded CA certs.
153
+
154
+ If the optional argument is True, returns a DER-encoded copy of the CA
155
+ certificate.
156
+
157
+ NOTE: Certificates in a capath directory aren't loaded unless they have
158
+ been used at least once.
159
+ """
160
+ ...
161
+ @overload
162
+ def get_ca_certs(self, binary_form: bool = False) -> Any:
163
+ """
164
+ Returns a list of dicts with information of loaded CA certs.
165
+
166
+ If the optional argument is True, returns a DER-encoded copy of the CA
167
+ certificate.
168
+
169
+ NOTE: Certificates in a capath directory aren't loaded unless they have
170
+ been used at least once.
171
+ """
172
+ ...
173
+ def get_ciphers(self) -> list[_Cipher]: ...
174
+ def load_cert_chain(
175
+ self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = None, password: _PasswordType | None = None
176
+ ) -> None: ...
177
+ def load_dh_params(self, path: str, /) -> None: ...
178
+ def load_verify_locations(
179
+ self,
180
+ cafile: StrOrBytesPath | None = None,
181
+ capath: StrOrBytesPath | None = None,
182
+ cadata: str | ReadableBuffer | None = None,
183
+ ) -> None: ...
184
+ def session_stats(self) -> dict[str, int]: ...
185
+ def set_ciphers(self, cipherlist: str, /) -> None: ...
186
+ def set_default_verify_paths(self) -> None: ...
187
+ def set_ecdh_curve(self, name: str, /) -> None: ...
188
+ if sys.version_info >= (3, 13):
189
+ def set_psk_client_callback(self, callback: Callable[[str | None], tuple[str | None, bytes]] | None) -> None: ...
190
+ def set_psk_server_callback(
191
+ self, callback: Callable[[str | None], tuple[str | None, bytes]] | None, identity_hint: str | None = None
192
+ ) -> None: ...
193
+
194
+ @final
195
+ class MemoryBIO:
196
+ eof: bool
197
+ pending: int
198
+ def __new__(self) -> Self: ...
199
+ def read(self, size: int = -1, /) -> bytes:
200
+ """
201
+ Read up to size bytes from the memory BIO.
202
+
203
+ If size is not specified, read the entire buffer.
204
+ If the return value is an empty bytes instance, this means either
205
+ EOF or that no data is available. Use the "eof" property to
206
+ distinguish between the two.
207
+ """
208
+ ...
209
+ def write(self, b: ReadableBuffer, /) -> int:
210
+ """
211
+ Writes the bytes b into the memory BIO.
212
+
213
+ Returns the number of bytes written.
214
+ """
215
+ ...
216
+ def write_eof(self) -> None:
217
+ """
218
+ Write an EOF marker to the memory BIO.
219
+
220
+ When all data has been read, the "eof" property will be True.
221
+ """
222
+ ...
223
+
224
+ @final
225
+ class SSLSession:
226
+ @property
227
+ def has_ticket(self) -> bool:
228
+ """Does the session contain a ticket?"""
229
+ ...
230
+ @property
231
+ def id(self) -> bytes:
232
+ """Session id"""
233
+ ...
234
+ @property
235
+ def ticket_lifetime_hint(self) -> int:
236
+ """Ticket life time hint."""
237
+ ...
238
+ @property
239
+ def time(self) -> int:
240
+ """Session creation time (seconds since epoch)."""
241
+ ...
242
+ @property
243
+ def timeout(self) -> int:
244
+ """Session timeout (delta in seconds)."""
245
+ ...
246
+
247
+ # _ssl.Certificate is weird: it can't be instantiated or subclassed.
248
+ # Instances can only be created via methods of the private _ssl._SSLSocket class,
249
+ # for which the relevant method signatures are:
250
+ #
251
+ # class _SSLSocket:
252
+ # def get_unverified_chain(self) -> list[Certificate] | None: ...
253
+ # def get_verified_chain(self) -> list[Certificate] | None: ...
254
+ #
255
+ # You can find a _ssl._SSLSocket object as the _sslobj attribute of a ssl.SSLSocket object
256
+
257
+ if sys.version_info >= (3, 10):
258
+ @final
259
+ class Certificate:
260
+ def get_info(self) -> _CertInfo: ...
261
+ @overload
262
+ def public_bytes(self) -> str: ...
263
+ @overload
264
+ def public_bytes(self, format: Literal[1] = 1, /) -> str: ... # ENCODING_PEM
265
+ @overload
266
+ def public_bytes(self, format: Literal[2], /) -> bytes: ... # ENCODING_DER
267
+ @overload
268
+ def public_bytes(self, format: int, /) -> str | bytes: ...
269
+
270
+ if sys.version_info < (3, 12):
271
+ err_codes_to_names: dict[tuple[int, int], str]
272
+ err_names_to_codes: dict[str, tuple[int, int]]
273
+ lib_codes_to_names: dict[int, str]
274
+
275
+ _DEFAULT_CIPHERS: str
276
+
277
+ # SSL error numbers
278
+ SSL_ERROR_ZERO_RETURN: int
279
+ SSL_ERROR_WANT_READ: int
280
+ SSL_ERROR_WANT_WRITE: int
281
+ SSL_ERROR_WANT_X509_LOOKUP: int
282
+ SSL_ERROR_SYSCALL: int
283
+ SSL_ERROR_SSL: int
284
+ SSL_ERROR_WANT_CONNECT: int
285
+ SSL_ERROR_EOF: int
286
+ SSL_ERROR_INVALID_ERROR_CODE: int
287
+
288
+ # verify modes
289
+ CERT_NONE: int
290
+ CERT_OPTIONAL: int
291
+ CERT_REQUIRED: int
292
+
293
+ # verify flags
294
+ VERIFY_DEFAULT: int
295
+ VERIFY_CRL_CHECK_LEAF: int
296
+ VERIFY_CRL_CHECK_CHAIN: int
297
+ VERIFY_X509_STRICT: int
298
+ VERIFY_X509_TRUSTED_FIRST: int
299
+ if sys.version_info >= (3, 10):
300
+ VERIFY_ALLOW_PROXY_CERTS: int
301
+ VERIFY_X509_PARTIAL_CHAIN: int
302
+
303
+ # alert descriptions
304
+ ALERT_DESCRIPTION_CLOSE_NOTIFY: int
305
+ ALERT_DESCRIPTION_UNEXPECTED_MESSAGE: int
306
+ ALERT_DESCRIPTION_BAD_RECORD_MAC: int
307
+ ALERT_DESCRIPTION_RECORD_OVERFLOW: int
308
+ ALERT_DESCRIPTION_DECOMPRESSION_FAILURE: int
309
+ ALERT_DESCRIPTION_HANDSHAKE_FAILURE: int
310
+ ALERT_DESCRIPTION_BAD_CERTIFICATE: int
311
+ ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE: int
312
+ ALERT_DESCRIPTION_CERTIFICATE_REVOKED: int
313
+ ALERT_DESCRIPTION_CERTIFICATE_EXPIRED: int
314
+ ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN: int
315
+ ALERT_DESCRIPTION_ILLEGAL_PARAMETER: int
316
+ ALERT_DESCRIPTION_UNKNOWN_CA: int
317
+ ALERT_DESCRIPTION_ACCESS_DENIED: int
318
+ ALERT_DESCRIPTION_DECODE_ERROR: int
319
+ ALERT_DESCRIPTION_DECRYPT_ERROR: int
320
+ ALERT_DESCRIPTION_PROTOCOL_VERSION: int
321
+ ALERT_DESCRIPTION_INSUFFICIENT_SECURITY: int
322
+ ALERT_DESCRIPTION_INTERNAL_ERROR: int
323
+ ALERT_DESCRIPTION_USER_CANCELLED: int
324
+ ALERT_DESCRIPTION_NO_RENEGOTIATION: int
325
+ ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION: int
326
+ ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE: int
327
+ ALERT_DESCRIPTION_UNRECOGNIZED_NAME: int
328
+ ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE: int
329
+ ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE: int
330
+ ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY: int
331
+
332
+ # protocol versions
333
+ PROTOCOL_SSLv23: int
334
+ PROTOCOL_TLS: int
335
+ PROTOCOL_TLS_CLIENT: int
336
+ PROTOCOL_TLS_SERVER: int
337
+ PROTOCOL_TLSv1: int
338
+ PROTOCOL_TLSv1_1: int
339
+ PROTOCOL_TLSv1_2: int
340
+
341
+ # protocol options
342
+ OP_ALL: int
343
+ OP_NO_SSLv2: int
344
+ OP_NO_SSLv3: int
345
+ OP_NO_TLSv1: int
346
+ OP_NO_TLSv1_1: int
347
+ OP_NO_TLSv1_2: int
348
+ OP_NO_TLSv1_3: int
349
+ OP_CIPHER_SERVER_PREFERENCE: int
350
+ OP_SINGLE_DH_USE: int
351
+ OP_NO_TICKET: int
352
+ OP_SINGLE_ECDH_USE: int
353
+ OP_NO_COMPRESSION: int
354
+ OP_ENABLE_MIDDLEBOX_COMPAT: int
355
+ OP_NO_RENEGOTIATION: int
356
+ if sys.version_info >= (3, 11):
357
+ OP_IGNORE_UNEXPECTED_EOF: int
358
+ elif sys.version_info >= (3, 8) and sys.platform == "linux":
359
+ OP_IGNORE_UNEXPECTED_EOF: int
360
+ if sys.version_info >= (3, 12):
361
+ OP_LEGACY_SERVER_CONNECT: int
362
+ OP_ENABLE_KTLS: int
363
+
364
+ # host flags
365
+ HOSTFLAG_ALWAYS_CHECK_SUBJECT: int
366
+ HOSTFLAG_NEVER_CHECK_SUBJECT: int
367
+ HOSTFLAG_NO_WILDCARDS: int
368
+ HOSTFLAG_NO_PARTIAL_WILDCARDS: int
369
+ HOSTFLAG_MULTI_LABEL_WILDCARDS: int
370
+ HOSTFLAG_SINGLE_LABEL_SUBDOMAINS: int
371
+
372
+ if sys.version_info >= (3, 10):
373
+ # certificate file types
374
+ # Typed as Literal so the overload on Certificate.public_bytes can work properly.
375
+ ENCODING_PEM: Literal[1]
376
+ ENCODING_DER: Literal[2]
377
+
378
+ # protocol versions
379
+ PROTO_MINIMUM_SUPPORTED: int
380
+ PROTO_MAXIMUM_SUPPORTED: int
381
+ PROTO_SSLv3: int
382
+ PROTO_TLSv1: int
383
+ PROTO_TLSv1_1: int
384
+ PROTO_TLSv1_2: int
385
+ PROTO_TLSv1_3: int
386
+
387
+ # feature support
388
+ HAS_SNI: bool
389
+ HAS_TLS_UNIQUE: bool
390
+ HAS_ECDH: bool
391
+ HAS_NPN: bool
392
+ if sys.version_info >= (3, 13):
393
+ HAS_PSK: bool
394
+ HAS_ALPN: bool
395
+ HAS_SSLv2: bool
396
+ HAS_SSLv3: bool
397
+ HAS_TLSv1: bool
398
+ HAS_TLSv1_1: bool
399
+ HAS_TLSv1_2: bool
400
+ HAS_TLSv1_3: bool
401
+
402
+ # version info
403
+ OPENSSL_VERSION_NUMBER: int
404
+ OPENSSL_VERSION_INFO: tuple[int, int, int, int, int]
405
+ OPENSSL_VERSION: str
406
+ _OPENSSL_API_VERSION: tuple[int, int, int, int, int]
@@ -1,51 +1,12 @@
1
1
  """Weak-reference support module."""
2
2
 
3
- import sys
4
3
  from collections.abc import Callable
5
- from typing import Any, Generic, TypeVar, final, overload
6
- from typing_extensions import Self
7
-
8
- if sys.version_info >= (3, 9):
9
- from types import GenericAlias
4
+ from typing import Any, TypeVar, overload
5
+ from weakref import CallableProxyType as CallableProxyType, ProxyType as ProxyType, ReferenceType as ReferenceType, ref as ref
10
6
 
11
7
  _C = TypeVar("_C", bound=Callable[..., Any])
12
8
  _T = TypeVar("_T")
13
9
 
14
- @final
15
- class CallableProxyType(Generic[_C]): # "weakcallableproxy"
16
- def __eq__(self, value: object, /) -> bool:
17
- """Return self==value."""
18
- ...
19
- def __getattr__(self, attr: str) -> Any: ...
20
- __call__: _C
21
-
22
- @final
23
- class ProxyType(Generic[_T]): # "weakproxy"
24
- def __eq__(self, value: object, /) -> bool:
25
- """Return self==value."""
26
- ...
27
- def __getattr__(self, attr: str) -> Any: ...
28
-
29
- class ReferenceType(Generic[_T]):
30
- __callback__: Callable[[Self], Any]
31
- def __new__(cls, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> Self: ...
32
- def __init__(self, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> None: ...
33
- def __call__(self) -> _T | None:
34
- """Call self as a function."""
35
- ...
36
- def __eq__(self, value: object, /) -> bool:
37
- """Return self==value."""
38
- ...
39
- def __hash__(self) -> int:
40
- """Return hash(self)."""
41
- ...
42
- if sys.version_info >= (3, 9):
43
- def __class_getitem__(cls, item: Any, /) -> GenericAlias:
44
- """See PEP 585"""
45
- ...
46
-
47
- ref = ReferenceType
48
-
49
10
  def getweakrefcount(object: Any, /) -> int:
50
11
  """Return the number of weak references to 'object'."""
51
12
  ...