basedpyright 1.1.389 → 1.1.392

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 (679) hide show
  1. package/README.md +3 -3
  2. package/dist/pyright-langserver.js +1 -1
  3. package/dist/pyright-langserver.js.LICENSE.txt +42 -0
  4. package/dist/pyright-langserver.js.map +1 -1
  5. package/dist/pyright.js +1 -1
  6. package/dist/pyright.js.map +1 -1
  7. package/dist/typeshed-fallback/commit.txt +1 -1
  8. package/dist/typeshed-fallback/stdlib/VERSIONS +9 -0
  9. package/dist/typeshed-fallback/stdlib/__future__.pyi +36 -36
  10. package/dist/typeshed-fallback/stdlib/__main__.pyi +3 -3
  11. package/dist/typeshed-fallback/stdlib/_ast.pyi +149 -149
  12. package/dist/typeshed-fallback/stdlib/_asyncio.pyi +320 -342
  13. package/dist/typeshed-fallback/stdlib/_bisect.pyi +189 -229
  14. package/dist/typeshed-fallback/stdlib/_blake2.pyi +137 -137
  15. package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
  16. package/dist/typeshed-fallback/stdlib/_bz2.pyi +71 -71
  17. package/dist/typeshed-fallback/stdlib/_codecs.pyi +247 -244
  18. package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +124 -115
  19. package/dist/typeshed-fallback/stdlib/_compat_pickle.pyi +8 -8
  20. package/dist/typeshed-fallback/stdlib/_compression.pyi +25 -25
  21. package/dist/typeshed-fallback/stdlib/_contextvars.pyi +146 -146
  22. package/dist/typeshed-fallback/stdlib/_csv.pyi +232 -172
  23. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +435 -304
  24. package/dist/typeshed-fallback/stdlib/_curses.pyi +2 -6
  25. package/dist/typeshed-fallback/stdlib/_curses_panel.pyi +67 -0
  26. package/dist/typeshed-fallback/stdlib/_dbm.pyi +8 -19
  27. package/dist/typeshed-fallback/stdlib/_decimal.pyi +80 -94
  28. package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
  29. package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +164 -180
  30. package/dist/typeshed-fallback/stdlib/_frozen_importlib.pyi +114 -114
  31. package/dist/typeshed-fallback/stdlib/_frozen_importlib_external.pyi +178 -178
  32. package/dist/typeshed-fallback/stdlib/_gdbm.pyi +2 -65
  33. package/dist/typeshed-fallback/stdlib/_hashlib.pyi +232 -0
  34. package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
  35. package/dist/typeshed-fallback/stdlib/_imp.pyi +81 -83
  36. package/dist/typeshed-fallback/stdlib/_io.pyi +719 -719
  37. package/dist/typeshed-fallback/stdlib/_json.pyi +99 -92
  38. package/dist/typeshed-fallback/stdlib/_locale.pyi +155 -155
  39. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +94 -94
  40. package/dist/typeshed-fallback/stdlib/_lzma.pyi +158 -158
  41. package/dist/typeshed-fallback/stdlib/_markupbase.pyi +16 -16
  42. package/dist/typeshed-fallback/stdlib/_msi.pyi +92 -94
  43. package/dist/typeshed-fallback/stdlib/_multibytecodec.pyi +44 -0
  44. package/dist/typeshed-fallback/stdlib/_operator.pyi +261 -261
  45. package/dist/typeshed-fallback/stdlib/_osx_support.pyi +34 -34
  46. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +0 -1
  47. package/dist/typeshed-fallback/stdlib/_py_abc.pyi +14 -14
  48. package/dist/typeshed-fallback/stdlib/_pydecimal.pyi +43 -43
  49. package/dist/typeshed-fallback/stdlib/_queue.pyi +67 -67
  50. package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
  51. package/dist/typeshed-fallback/stdlib/_sitebuiltins.pyi +16 -16
  52. package/dist/typeshed-fallback/stdlib/_socket.pyi +1367 -1317
  53. package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +360 -402
  54. package/dist/typeshed-fallback/stdlib/_ssl.pyi +399 -406
  55. package/dist/typeshed-fallback/stdlib/_stat.pyi +257 -257
  56. package/dist/typeshed-fallback/stdlib/_struct.pyi +147 -147
  57. package/dist/typeshed-fallback/stdlib/_thread.pyi +266 -257
  58. package/dist/typeshed-fallback/stdlib/_threading_local.pyi +22 -18
  59. package/dist/typeshed-fallback/stdlib/_tkinter.pyi +165 -165
  60. package/dist/typeshed-fallback/stdlib/_tracemalloc.pyi +78 -78
  61. package/dist/typeshed-fallback/stdlib/_warnings.pyi +98 -102
  62. package/dist/typeshed-fallback/stdlib/_weakref.pyi +35 -35
  63. package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +57 -57
  64. package/dist/typeshed-fallback/stdlib/abc.pyi +59 -59
  65. package/dist/typeshed-fallback/stdlib/argparse.pyi +769 -769
  66. package/dist/typeshed-fallback/stdlib/array.pyi +267 -281
  67. package/dist/typeshed-fallback/stdlib/ast.pyi +2049 -2049
  68. package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
  69. package/dist/typeshed-fallback/stdlib/asyncio/__init__.pyi +41 -41
  70. package/dist/typeshed-fallback/stdlib/asyncio/base_events.pyi +488 -488
  71. package/dist/typeshed-fallback/stdlib/asyncio/base_futures.pyi +19 -19
  72. package/dist/typeshed-fallback/stdlib/asyncio/base_subprocess.pyi +63 -63
  73. package/dist/typeshed-fallback/stdlib/asyncio/base_tasks.pyi +9 -9
  74. package/dist/typeshed-fallback/stdlib/asyncio/constants.pyi +20 -20
  75. package/dist/typeshed-fallback/stdlib/asyncio/coroutines.pyi +26 -26
  76. package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +653 -653
  77. package/dist/typeshed-fallback/stdlib/asyncio/exceptions.pyi +43 -43
  78. package/dist/typeshed-fallback/stdlib/asyncio/format_helpers.pyi +31 -31
  79. package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +16 -16
  80. package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +127 -127
  81. package/dist/typeshed-fallback/stdlib/asyncio/log.pyi +3 -3
  82. package/dist/typeshed-fallback/stdlib/asyncio/mixins.pyi +9 -9
  83. package/dist/typeshed-fallback/stdlib/asyncio/proactor_events.pyi +64 -64
  84. package/dist/typeshed-fallback/stdlib/asyncio/protocols.pyi +34 -34
  85. package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +64 -64
  86. package/dist/typeshed-fallback/stdlib/asyncio/runners.pyi +32 -32
  87. package/dist/typeshed-fallback/stdlib/asyncio/selector_events.pyi +8 -8
  88. package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +165 -184
  89. package/dist/typeshed-fallback/stdlib/asyncio/staggered.pyi +10 -10
  90. package/dist/typeshed-fallback/stdlib/asyncio/streams.pyi +157 -157
  91. package/dist/typeshed-fallback/stdlib/asyncio/subprocess.pyi +229 -229
  92. package/dist/typeshed-fallback/stdlib/asyncio/taskgroups.pyi +25 -25
  93. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +459 -459
  94. package/dist/typeshed-fallback/stdlib/asyncio/threads.pyi +9 -9
  95. package/dist/typeshed-fallback/stdlib/asyncio/timeouts.pyi +19 -19
  96. package/dist/typeshed-fallback/stdlib/asyncio/transports.pyi +47 -47
  97. package/dist/typeshed-fallback/stdlib/asyncio/trsock.pyi +94 -94
  98. package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
  99. package/dist/typeshed-fallback/stdlib/atexit.pyi +46 -46
  100. package/dist/typeshed-fallback/stdlib/audioop.pyi +26 -78
  101. package/dist/typeshed-fallback/stdlib/base64.pyi +65 -65
  102. package/dist/typeshed-fallback/stdlib/bdb.pyi +114 -114
  103. package/dist/typeshed-fallback/stdlib/binascii.pyi +113 -123
  104. package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
  105. package/dist/typeshed-fallback/stdlib/bisect.pyi +4 -4
  106. package/dist/typeshed-fallback/stdlib/builtins.pyi +6481 -6560
  107. package/dist/typeshed-fallback/stdlib/bz2.pyi +132 -131
  108. package/dist/typeshed-fallback/stdlib/cProfile.pyi +31 -31
  109. package/dist/typeshed-fallback/stdlib/calendar.pyi +208 -208
  110. package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
  111. package/dist/typeshed-fallback/stdlib/cmd.pyi +46 -46
  112. package/dist/typeshed-fallback/stdlib/code.pyi +56 -56
  113. package/dist/typeshed-fallback/stdlib/codecs.pyi +301 -297
  114. package/dist/typeshed-fallback/stdlib/codeop.pyi +13 -13
  115. package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +650 -650
  116. package/dist/typeshed-fallback/stdlib/collections/abc.pyi +2 -2
  117. package/dist/typeshed-fallback/stdlib/colorsys.pyi +13 -13
  118. package/dist/typeshed-fallback/stdlib/compileall.pyi +111 -111
  119. package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +51 -51
  120. package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +132 -132
  121. package/dist/typeshed-fallback/stdlib/concurrent/futures/process.pyi +234 -234
  122. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +86 -86
  123. package/dist/typeshed-fallback/stdlib/configparser.pyi +412 -404
  124. package/dist/typeshed-fallback/stdlib/contextlib.pyi +219 -213
  125. package/dist/typeshed-fallback/stdlib/contextvars.pyi +3 -3
  126. package/dist/typeshed-fallback/stdlib/copy.pyi +27 -27
  127. package/dist/typeshed-fallback/stdlib/copyreg.pyi +21 -21
  128. package/dist/typeshed-fallback/stdlib/crypt.pyi +9 -2
  129. package/dist/typeshed-fallback/stdlib/csv.pyi +169 -167
  130. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +218 -198
  131. package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +16 -16
  132. package/dist/typeshed-fallback/stdlib/ctypes/macholib/__init__.pyi +1 -0
  133. package/dist/typeshed-fallback/stdlib/ctypes/macholib/dyld.pyi +8 -0
  134. package/dist/typeshed-fallback/stdlib/ctypes/macholib/dylib.pyi +14 -0
  135. package/dist/typeshed-fallback/stdlib/ctypes/macholib/framework.pyi +14 -0
  136. package/dist/typeshed-fallback/stdlib/ctypes/util.pyi +8 -6
  137. package/dist/typeshed-fallback/stdlib/ctypes/wintypes.pyi +304 -298
  138. package/dist/typeshed-fallback/stdlib/curses/__init__.pyi +19 -1
  139. package/dist/typeshed-fallback/stdlib/curses/panel.pyi +1 -34
  140. package/dist/typeshed-fallback/stdlib/dataclasses.pyi +322 -322
  141. package/dist/typeshed-fallback/stdlib/datetime.pyi +576 -575
  142. package/dist/typeshed-fallback/stdlib/dbm/__init__.pyi +104 -102
  143. package/dist/typeshed-fallback/stdlib/dbm/dumb.pyi +37 -37
  144. package/dist/typeshed-fallback/stdlib/decimal.pyi +849 -840
  145. package/dist/typeshed-fallback/stdlib/difflib.pyi +146 -146
  146. package/dist/typeshed-fallback/stdlib/dis.pyi +248 -248
  147. package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
  148. package/dist/typeshed-fallback/stdlib/distutils/_msvccompiler.pyi +13 -13
  149. package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
  150. package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
  151. package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +176 -176
  152. package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +229 -229
  153. package/dist/typeshed-fallback/stdlib/distutils/command/__init__.pyi +48 -48
  154. package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +27 -27
  155. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +22 -22
  156. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +46 -46
  157. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +53 -53
  158. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
  159. package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +34 -34
  160. package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +29 -29
  161. package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +52 -52
  162. package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +45 -45
  163. package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +25 -25
  164. package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +40 -40
  165. package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +18 -18
  166. package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
  167. package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +71 -71
  168. package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +20 -20
  169. package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +19 -19
  170. package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +17 -17
  171. package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +26 -26
  172. package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +19 -19
  173. package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +21 -21
  174. package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +45 -45
  175. package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +18 -18
  176. package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
  177. package/dist/typeshed-fallback/stdlib/distutils/core.pyi +58 -58
  178. package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
  179. package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +3 -3
  180. package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
  181. package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
  182. package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +317 -317
  183. package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
  184. package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
  185. package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
  186. package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
  187. package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
  188. package/dist/typeshed-fallback/stdlib/distutils/log.pyi +26 -26
  189. package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
  190. package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +10 -6
  191. package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
  192. package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
  193. package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
  194. package/dist/typeshed-fallback/stdlib/distutils/util.pyi +53 -53
  195. package/dist/typeshed-fallback/stdlib/distutils/version.pyi +36 -38
  196. package/dist/typeshed-fallback/stdlib/doctest.pyi +262 -264
  197. package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
  198. package/dist/typeshed-fallback/stdlib/email/__init__.pyi +37 -29
  199. package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +398 -398
  200. package/dist/typeshed-fallback/stdlib/email/_policybase.pyi +77 -75
  201. package/dist/typeshed-fallback/stdlib/email/base64mime.pyi +13 -13
  202. package/dist/typeshed-fallback/stdlib/email/charset.pyi +36 -36
  203. package/dist/typeshed-fallback/stdlib/email/contentmanager.pyi +11 -11
  204. package/dist/typeshed-fallback/stdlib/email/encoders.pyi +8 -8
  205. package/dist/typeshed-fallback/stdlib/email/errors.pyi +42 -42
  206. package/dist/typeshed-fallback/stdlib/email/feedparser.pyi +23 -23
  207. package/dist/typeshed-fallback/stdlib/email/generator.pyi +77 -77
  208. package/dist/typeshed-fallback/stdlib/email/header.pyi +33 -33
  209. package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +183 -183
  210. package/dist/typeshed-fallback/stdlib/email/iterators.pyi +12 -12
  211. package/dist/typeshed-fallback/stdlib/email/message.pyi +172 -172
  212. package/dist/typeshed-fallback/stdlib/email/mime/application.pyi +17 -17
  213. package/dist/typeshed-fallback/stdlib/email/mime/audio.pyi +17 -17
  214. package/dist/typeshed-fallback/stdlib/email/mime/base.pyi +8 -8
  215. package/dist/typeshed-fallback/stdlib/email/mime/image.pyi +17 -17
  216. package/dist/typeshed-fallback/stdlib/email/mime/message.pyi +8 -8
  217. package/dist/typeshed-fallback/stdlib/email/mime/multipart.pyi +18 -18
  218. package/dist/typeshed-fallback/stdlib/email/mime/nonmultipart.pyi +5 -5
  219. package/dist/typeshed-fallback/stdlib/email/mime/text.pyi +9 -9
  220. package/dist/typeshed-fallback/stdlib/email/parser.pyi +38 -38
  221. package/dist/typeshed-fallback/stdlib/email/policy.pyi +77 -77
  222. package/dist/typeshed-fallback/stdlib/email/quoprimime.pyi +28 -28
  223. package/dist/typeshed-fallback/stdlib/email/utils.pyi +78 -78
  224. package/dist/typeshed-fallback/stdlib/encodings/__init__.pyi +10 -10
  225. package/dist/typeshed-fallback/stdlib/encodings/aliases.pyi +1 -0
  226. package/dist/typeshed-fallback/stdlib/encodings/ascii.pyi +30 -0
  227. package/dist/typeshed-fallback/stdlib/encodings/base64_codec.pyi +26 -0
  228. package/dist/typeshed-fallback/stdlib/encodings/big5.pyi +23 -0
  229. package/dist/typeshed-fallback/stdlib/encodings/big5hkscs.pyi +23 -0
  230. package/dist/typeshed-fallback/stdlib/encodings/bz2_codec.pyi +26 -0
  231. package/dist/typeshed-fallback/stdlib/encodings/charmap.pyi +33 -0
  232. package/dist/typeshed-fallback/stdlib/encodings/cp037.pyi +21 -0
  233. package/dist/typeshed-fallback/stdlib/encodings/cp1006.pyi +21 -0
  234. package/dist/typeshed-fallback/stdlib/encodings/cp1026.pyi +21 -0
  235. package/dist/typeshed-fallback/stdlib/encodings/cp1125.pyi +21 -0
  236. package/dist/typeshed-fallback/stdlib/encodings/cp1140.pyi +21 -0
  237. package/dist/typeshed-fallback/stdlib/encodings/cp1250.pyi +21 -0
  238. package/dist/typeshed-fallback/stdlib/encodings/cp1251.pyi +21 -0
  239. package/dist/typeshed-fallback/stdlib/encodings/cp1252.pyi +21 -0
  240. package/dist/typeshed-fallback/stdlib/encodings/cp1253.pyi +21 -0
  241. package/dist/typeshed-fallback/stdlib/encodings/cp1254.pyi +21 -0
  242. package/dist/typeshed-fallback/stdlib/encodings/cp1255.pyi +21 -0
  243. package/dist/typeshed-fallback/stdlib/encodings/cp1256.pyi +21 -0
  244. package/dist/typeshed-fallback/stdlib/encodings/cp1257.pyi +21 -0
  245. package/dist/typeshed-fallback/stdlib/encodings/cp1258.pyi +21 -0
  246. package/dist/typeshed-fallback/stdlib/encodings/cp273.pyi +21 -0
  247. package/dist/typeshed-fallback/stdlib/encodings/cp424.pyi +21 -0
  248. package/dist/typeshed-fallback/stdlib/encodings/cp437.pyi +21 -0
  249. package/dist/typeshed-fallback/stdlib/encodings/cp500.pyi +21 -0
  250. package/dist/typeshed-fallback/stdlib/encodings/cp720.pyi +21 -0
  251. package/dist/typeshed-fallback/stdlib/encodings/cp737.pyi +21 -0
  252. package/dist/typeshed-fallback/stdlib/encodings/cp775.pyi +21 -0
  253. package/dist/typeshed-fallback/stdlib/encodings/cp850.pyi +21 -0
  254. package/dist/typeshed-fallback/stdlib/encodings/cp852.pyi +21 -0
  255. package/dist/typeshed-fallback/stdlib/encodings/cp855.pyi +21 -0
  256. package/dist/typeshed-fallback/stdlib/encodings/cp856.pyi +21 -0
  257. package/dist/typeshed-fallback/stdlib/encodings/cp857.pyi +21 -0
  258. package/dist/typeshed-fallback/stdlib/encodings/cp858.pyi +21 -0
  259. package/dist/typeshed-fallback/stdlib/encodings/cp860.pyi +21 -0
  260. package/dist/typeshed-fallback/stdlib/encodings/cp861.pyi +21 -0
  261. package/dist/typeshed-fallback/stdlib/encodings/cp862.pyi +21 -0
  262. package/dist/typeshed-fallback/stdlib/encodings/cp863.pyi +21 -0
  263. package/dist/typeshed-fallback/stdlib/encodings/cp864.pyi +21 -0
  264. package/dist/typeshed-fallback/stdlib/encodings/cp865.pyi +21 -0
  265. package/dist/typeshed-fallback/stdlib/encodings/cp866.pyi +21 -0
  266. package/dist/typeshed-fallback/stdlib/encodings/cp869.pyi +21 -0
  267. package/dist/typeshed-fallback/stdlib/encodings/cp874.pyi +21 -0
  268. package/dist/typeshed-fallback/stdlib/encodings/cp875.pyi +21 -0
  269. package/dist/typeshed-fallback/stdlib/encodings/cp932.pyi +23 -0
  270. package/dist/typeshed-fallback/stdlib/encodings/cp949.pyi +23 -0
  271. package/dist/typeshed-fallback/stdlib/encodings/cp950.pyi +23 -0
  272. package/dist/typeshed-fallback/stdlib/encodings/euc_jis_2004.pyi +23 -0
  273. package/dist/typeshed-fallback/stdlib/encodings/euc_jisx0213.pyi +23 -0
  274. package/dist/typeshed-fallback/stdlib/encodings/euc_jp.pyi +23 -0
  275. package/dist/typeshed-fallback/stdlib/encodings/euc_kr.pyi +23 -0
  276. package/dist/typeshed-fallback/stdlib/encodings/gb18030.pyi +23 -0
  277. package/dist/typeshed-fallback/stdlib/encodings/gb2312.pyi +23 -0
  278. package/dist/typeshed-fallback/stdlib/encodings/gbk.pyi +23 -0
  279. package/dist/typeshed-fallback/stdlib/encodings/hex_codec.pyi +26 -0
  280. package/dist/typeshed-fallback/stdlib/encodings/hp_roman8.pyi +21 -0
  281. package/dist/typeshed-fallback/stdlib/encodings/hz.pyi +23 -0
  282. package/dist/typeshed-fallback/stdlib/encodings/idna.pyi +26 -0
  283. package/dist/typeshed-fallback/stdlib/encodings/iso2022_jp.pyi +23 -0
  284. package/dist/typeshed-fallback/stdlib/encodings/iso2022_jp_1.pyi +23 -0
  285. package/dist/typeshed-fallback/stdlib/encodings/iso2022_jp_2.pyi +23 -0
  286. package/dist/typeshed-fallback/stdlib/encodings/iso2022_jp_2004.pyi +23 -0
  287. package/dist/typeshed-fallback/stdlib/encodings/iso2022_jp_3.pyi +23 -0
  288. package/dist/typeshed-fallback/stdlib/encodings/iso2022_jp_ext.pyi +23 -0
  289. package/dist/typeshed-fallback/stdlib/encodings/iso2022_kr.pyi +23 -0
  290. package/dist/typeshed-fallback/stdlib/encodings/iso8859_1.pyi +21 -0
  291. package/dist/typeshed-fallback/stdlib/encodings/iso8859_10.pyi +21 -0
  292. package/dist/typeshed-fallback/stdlib/encodings/iso8859_11.pyi +21 -0
  293. package/dist/typeshed-fallback/stdlib/encodings/iso8859_13.pyi +21 -0
  294. package/dist/typeshed-fallback/stdlib/encodings/iso8859_14.pyi +21 -0
  295. package/dist/typeshed-fallback/stdlib/encodings/iso8859_15.pyi +21 -0
  296. package/dist/typeshed-fallback/stdlib/encodings/iso8859_16.pyi +21 -0
  297. package/dist/typeshed-fallback/stdlib/encodings/iso8859_2.pyi +21 -0
  298. package/dist/typeshed-fallback/stdlib/encodings/iso8859_3.pyi +21 -0
  299. package/dist/typeshed-fallback/stdlib/encodings/iso8859_4.pyi +21 -0
  300. package/dist/typeshed-fallback/stdlib/encodings/iso8859_5.pyi +21 -0
  301. package/dist/typeshed-fallback/stdlib/encodings/iso8859_6.pyi +21 -0
  302. package/dist/typeshed-fallback/stdlib/encodings/iso8859_7.pyi +21 -0
  303. package/dist/typeshed-fallback/stdlib/encodings/iso8859_8.pyi +21 -0
  304. package/dist/typeshed-fallback/stdlib/encodings/iso8859_9.pyi +21 -0
  305. package/dist/typeshed-fallback/stdlib/encodings/johab.pyi +23 -0
  306. package/dist/typeshed-fallback/stdlib/encodings/koi8_r.pyi +21 -0
  307. package/dist/typeshed-fallback/stdlib/encodings/koi8_t.pyi +21 -0
  308. package/dist/typeshed-fallback/stdlib/encodings/koi8_u.pyi +21 -0
  309. package/dist/typeshed-fallback/stdlib/encodings/kz1048.pyi +21 -0
  310. package/dist/typeshed-fallback/stdlib/encodings/latin_1.pyi +30 -0
  311. package/dist/typeshed-fallback/stdlib/encodings/mac_arabic.pyi +21 -0
  312. package/dist/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi +21 -0
  313. package/dist/typeshed-fallback/stdlib/encodings/mac_croatian.pyi +21 -0
  314. package/dist/typeshed-fallback/stdlib/encodings/mac_cyrillic.pyi +21 -0
  315. package/dist/typeshed-fallback/stdlib/encodings/mac_farsi.pyi +21 -0
  316. package/dist/typeshed-fallback/stdlib/encodings/mac_greek.pyi +21 -0
  317. package/dist/typeshed-fallback/stdlib/encodings/mac_iceland.pyi +21 -0
  318. package/dist/typeshed-fallback/stdlib/encodings/mac_latin2.pyi +21 -0
  319. package/dist/typeshed-fallback/stdlib/encodings/mac_roman.pyi +21 -0
  320. package/dist/typeshed-fallback/stdlib/encodings/mac_romanian.pyi +21 -0
  321. package/dist/typeshed-fallback/stdlib/encodings/mac_turkish.pyi +21 -0
  322. package/dist/typeshed-fallback/stdlib/encodings/mbcs.pyi +28 -0
  323. package/dist/typeshed-fallback/stdlib/encodings/oem.pyi +28 -0
  324. package/dist/typeshed-fallback/stdlib/encodings/palmos.pyi +21 -0
  325. package/dist/typeshed-fallback/stdlib/encodings/ptcp154.pyi +21 -0
  326. package/dist/typeshed-fallback/stdlib/encodings/punycode.pyi +33 -0
  327. package/dist/typeshed-fallback/stdlib/encodings/quopri_codec.pyi +26 -0
  328. package/dist/typeshed-fallback/stdlib/encodings/raw_unicode_escape.pyi +34 -0
  329. package/dist/typeshed-fallback/stdlib/encodings/rot_13.pyi +23 -0
  330. package/dist/typeshed-fallback/stdlib/encodings/shift_jis.pyi +23 -0
  331. package/dist/typeshed-fallback/stdlib/encodings/shift_jis_2004.pyi +23 -0
  332. package/dist/typeshed-fallback/stdlib/encodings/shift_jisx0213.pyi +23 -0
  333. package/dist/typeshed-fallback/stdlib/encodings/tis_620.pyi +21 -0
  334. package/dist/typeshed-fallback/stdlib/encodings/undefined.pyi +20 -0
  335. package/dist/typeshed-fallback/stdlib/encodings/unicode_escape.pyi +34 -0
  336. package/dist/typeshed-fallback/stdlib/encodings/utf_16.pyi +20 -0
  337. package/dist/typeshed-fallback/stdlib/encodings/utf_16_be.pyi +26 -0
  338. package/dist/typeshed-fallback/stdlib/encodings/utf_16_le.pyi +26 -0
  339. package/dist/typeshed-fallback/stdlib/encodings/utf_32.pyi +20 -0
  340. package/dist/typeshed-fallback/stdlib/encodings/utf_32_be.pyi +26 -0
  341. package/dist/typeshed-fallback/stdlib/encodings/utf_32_le.pyi +26 -0
  342. package/dist/typeshed-fallback/stdlib/encodings/utf_7.pyi +26 -0
  343. package/dist/typeshed-fallback/stdlib/encodings/utf_8.pyi +26 -21
  344. package/dist/typeshed-fallback/stdlib/encodings/utf_8_sig.pyi +22 -22
  345. package/dist/typeshed-fallback/stdlib/encodings/uu_codec.pyi +28 -0
  346. package/dist/typeshed-fallback/stdlib/encodings/zlib_codec.pyi +26 -0
  347. package/dist/typeshed-fallback/stdlib/ensurepip/__init__.pyi +12 -12
  348. package/dist/typeshed-fallback/stdlib/enum.pyi +348 -348
  349. package/dist/typeshed-fallback/stdlib/errno.pyi +237 -237
  350. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +34 -34
  351. package/dist/typeshed-fallback/stdlib/fcntl.pyi +3 -1
  352. package/dist/typeshed-fallback/stdlib/filecmp.pyi +74 -74
  353. package/dist/typeshed-fallback/stdlib/fileinput.pyi +219 -219
  354. package/dist/typeshed-fallback/stdlib/fnmatch.pyi +9 -9
  355. package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
  356. package/dist/typeshed-fallback/stdlib/fractions.pyi +162 -162
  357. package/dist/typeshed-fallback/stdlib/ftplib.pyi +178 -178
  358. package/dist/typeshed-fallback/stdlib/functools.pyi +270 -270
  359. package/dist/typeshed-fallback/stdlib/gc.pyi +144 -144
  360. package/dist/typeshed-fallback/stdlib/genericpath.pyi +59 -59
  361. package/dist/typeshed-fallback/stdlib/getopt.pyi +15 -15
  362. package/dist/typeshed-fallback/stdlib/getpass.pyi +8 -8
  363. package/dist/typeshed-fallback/stdlib/gettext.pyi +171 -169
  364. package/dist/typeshed-fallback/stdlib/glob.pyi +50 -50
  365. package/dist/typeshed-fallback/stdlib/graphlib.pyi +34 -34
  366. package/dist/typeshed-fallback/stdlib/gzip.pyi +162 -162
  367. package/dist/typeshed-fallback/stdlib/hashlib.pyi +104 -163
  368. package/dist/typeshed-fallback/stdlib/heapq.pyi +19 -19
  369. package/dist/typeshed-fallback/stdlib/hmac.pyi +42 -65
  370. package/dist/typeshed-fallback/stdlib/html/__init__.pyi +6 -6
  371. package/dist/typeshed-fallback/stdlib/html/entities.pyi +6 -6
  372. package/dist/typeshed-fallback/stdlib/html/parser.pyi +34 -34
  373. package/dist/typeshed-fallback/stdlib/http/__init__.pyi +112 -112
  374. package/dist/typeshed-fallback/stdlib/http/client.pyi +246 -246
  375. package/dist/typeshed-fallback/stdlib/http/cookiejar.pyi +159 -159
  376. package/dist/typeshed-fallback/stdlib/http/cookies.pyi +66 -66
  377. package/dist/typeshed-fallback/stdlib/http/server.pyi +83 -83
  378. package/dist/typeshed-fallback/stdlib/imaplib.pyi +168 -168
  379. package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
  380. package/dist/typeshed-fallback/stdlib/importlib/__init__.pyi +15 -15
  381. package/dist/typeshed-fallback/stdlib/importlib/_abc.pyi +15 -15
  382. package/dist/typeshed-fallback/stdlib/importlib/_bootstrap.pyi +2 -2
  383. package/dist/typeshed-fallback/stdlib/importlib/_bootstrap_external.pyi +2 -2
  384. package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +175 -175
  385. package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +20 -20
  386. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +342 -371
  387. package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +65 -65
  388. package/dist/typeshed-fallback/stdlib/importlib/readers.pyi +68 -68
  389. package/dist/typeshed-fallback/stdlib/importlib/resources/__init__.pyi +70 -70
  390. package/dist/typeshed-fallback/stdlib/importlib/resources/_common.pyi +42 -42
  391. package/dist/typeshed-fallback/stdlib/importlib/resources/abc.pyi +14 -12
  392. package/dist/typeshed-fallback/stdlib/importlib/resources/readers.pyi +14 -14
  393. package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +58 -58
  394. package/dist/typeshed-fallback/stdlib/importlib/simple.pyi +11 -11
  395. package/dist/typeshed-fallback/stdlib/importlib/util.pyi +33 -33
  396. package/dist/typeshed-fallback/stdlib/inspect.pyi +642 -642
  397. package/dist/typeshed-fallback/stdlib/io.pyi +60 -60
  398. package/dist/typeshed-fallback/stdlib/ipaddress.pyi +509 -355
  399. package/dist/typeshed-fallback/stdlib/itertools.pyi +574 -574
  400. package/dist/typeshed-fallback/stdlib/json/__init__.pyi +61 -61
  401. package/dist/typeshed-fallback/stdlib/json/decoder.pyi +32 -32
  402. package/dist/typeshed-fallback/stdlib/json/encoder.pyi +52 -52
  403. package/dist/typeshed-fallback/stdlib/json/scanner.pyi +3 -0
  404. package/dist/typeshed-fallback/stdlib/json/tool.pyi +1 -1
  405. package/dist/typeshed-fallback/stdlib/keyword.pyi +25 -25
  406. package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +2 -12
  407. package/dist/typeshed-fallback/stdlib/linecache.pyi +23 -23
  408. package/dist/typeshed-fallback/stdlib/locale.pyi +156 -156
  409. package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +698 -698
  410. package/dist/typeshed-fallback/stdlib/logging/config.pyi +134 -134
  411. package/dist/typeshed-fallback/stdlib/logging/handlers.pyi +277 -277
  412. package/dist/typeshed-fallback/stdlib/lzma.pyi +174 -174
  413. package/dist/typeshed-fallback/stdlib/mailbox.pyi +276 -276
  414. package/dist/typeshed-fallback/stdlib/marshal.pyi +128 -176
  415. package/dist/typeshed-fallback/stdlib/math.pyi +438 -442
  416. package/dist/typeshed-fallback/stdlib/mimetypes.pyi +56 -56
  417. package/dist/typeshed-fallback/stdlib/mmap.pyi +185 -185
  418. package/dist/typeshed-fallback/stdlib/modulefinder.pyi +68 -66
  419. package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
  420. package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
  421. package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
  422. package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
  423. package/dist/typeshed-fallback/stdlib/multiprocessing/__init__.pyi +90 -90
  424. package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +89 -89
  425. package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +216 -215
  426. package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +79 -79
  427. package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/connection.pyi +39 -39
  428. package/dist/typeshed-fallback/stdlib/multiprocessing/forkserver.pyi +31 -31
  429. package/dist/typeshed-fallback/stdlib/multiprocessing/heap.pyi +36 -36
  430. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +266 -266
  431. package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +109 -109
  432. package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +50 -50
  433. package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +53 -53
  434. package/dist/typeshed-fallback/stdlib/multiprocessing/reduction.pyi +87 -87
  435. package/dist/typeshed-fallback/stdlib/multiprocessing/resource_sharer.pyi +20 -20
  436. package/dist/typeshed-fallback/stdlib/multiprocessing/resource_tracker.pyi +18 -18
  437. package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +58 -58
  438. package/dist/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi +129 -128
  439. package/dist/typeshed-fallback/stdlib/multiprocessing/spawn.pyi +32 -32
  440. package/dist/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi +59 -55
  441. package/dist/typeshed-fallback/stdlib/multiprocessing/util.pyi +98 -98
  442. package/dist/typeshed-fallback/stdlib/netrc.pyi +23 -23
  443. package/dist/typeshed-fallback/stdlib/nis.pyi +4 -31
  444. package/dist/typeshed-fallback/stdlib/ntpath.pyi +126 -126
  445. package/dist/typeshed-fallback/stdlib/nturl2path.pyi +2 -2
  446. package/dist/typeshed-fallback/stdlib/numbers.pyi +229 -229
  447. package/dist/typeshed-fallback/stdlib/opcode.pyi +65 -65
  448. package/dist/typeshed-fallback/stdlib/operator.pyi +221 -221
  449. package/dist/typeshed-fallback/stdlib/optparse.pyi +257 -257
  450. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +2946 -2491
  451. package/dist/typeshed-fallback/stdlib/os/path.pyi +8 -8
  452. package/dist/typeshed-fallback/stdlib/parser.pyi +24 -55
  453. package/dist/typeshed-fallback/stdlib/pathlib.pyi +329 -329
  454. package/dist/typeshed-fallback/stdlib/pdb.pyi +206 -206
  455. package/dist/typeshed-fallback/stdlib/pickle.pyi +459 -459
  456. package/dist/typeshed-fallback/stdlib/pickletools.pyi +167 -167
  457. package/dist/typeshed-fallback/stdlib/pkgutil.pyi +53 -53
  458. package/dist/typeshed-fallback/stdlib/platform.pyi +97 -67
  459. package/dist/typeshed-fallback/stdlib/plistlib.pyi +113 -113
  460. package/dist/typeshed-fallback/stdlib/poplib.pyi +72 -72
  461. package/dist/typeshed-fallback/stdlib/posix.pyi +30 -10
  462. package/dist/typeshed-fallback/stdlib/posixpath.pyi +182 -182
  463. package/dist/typeshed-fallback/stdlib/pprint.pyi +112 -112
  464. package/dist/typeshed-fallback/stdlib/profile.pyi +31 -31
  465. package/dist/typeshed-fallback/stdlib/pstats.pyi +98 -80
  466. package/dist/typeshed-fallback/stdlib/py_compile.pyi +34 -34
  467. package/dist/typeshed-fallback/stdlib/pyclbr.pyi +74 -74
  468. package/dist/typeshed-fallback/stdlib/pydoc.pyi +333 -333
  469. package/dist/typeshed-fallback/stdlib/pydoc_data/topics.pyi +1 -1
  470. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +131 -129
  471. package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +53 -53
  472. package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +15 -15
  473. package/dist/typeshed-fallback/stdlib/queue.pyi +63 -63
  474. package/dist/typeshed-fallback/stdlib/quopri.pyi +11 -11
  475. package/dist/typeshed-fallback/stdlib/random.pyi +141 -141
  476. package/dist/typeshed-fallback/stdlib/re.pyi +476 -476
  477. package/dist/typeshed-fallback/stdlib/readline.pyi +1 -7
  478. package/dist/typeshed-fallback/stdlib/reprlib.pyi +65 -65
  479. package/dist/typeshed-fallback/stdlib/rlcompleter.pyi +9 -9
  480. package/dist/typeshed-fallback/stdlib/runpy.pyi +24 -24
  481. package/dist/typeshed-fallback/stdlib/sched.pyi +52 -49
  482. package/dist/typeshed-fallback/stdlib/secrets.pyi +15 -15
  483. package/dist/typeshed-fallback/stdlib/select.pyi +247 -247
  484. package/dist/typeshed-fallback/stdlib/selectors.pyi +67 -67
  485. package/dist/typeshed-fallback/stdlib/shelve.pyi +59 -59
  486. package/dist/typeshed-fallback/stdlib/shlex.pyi +63 -63
  487. package/dist/typeshed-fallback/stdlib/shutil.pyi +230 -230
  488. package/dist/typeshed-fallback/stdlib/signal.pyi +263 -263
  489. package/dist/typeshed-fallback/stdlib/site.pyi +36 -36
  490. package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
  491. package/dist/typeshed-fallback/stdlib/smtplib.pyi +204 -204
  492. package/dist/typeshed-fallback/stdlib/socket.pyi +1413 -856
  493. package/dist/typeshed-fallback/stdlib/socketserver.pyi +169 -169
  494. package/dist/typeshed-fallback/stdlib/spwd.pyi +13 -66
  495. package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +785 -787
  496. package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +241 -241
  497. package/dist/typeshed-fallback/stdlib/sqlite3/dump.pyi +2 -0
  498. package/dist/typeshed-fallback/stdlib/sre_compile.pyi +11 -11
  499. package/dist/typeshed-fallback/stdlib/sre_constants.pyi +124 -124
  500. package/dist/typeshed-fallback/stdlib/sre_parse.pyi +104 -104
  501. package/dist/typeshed-fallback/stdlib/ssl.pyi +558 -560
  502. package/dist/typeshed-fallback/stdlib/stat.pyi +7 -7
  503. package/dist/typeshed-fallback/stdlib/statistics.pyi +176 -176
  504. package/dist/typeshed-fallback/stdlib/string.pyi +83 -83
  505. package/dist/typeshed-fallback/stdlib/stringprep.pyi +27 -27
  506. package/dist/typeshed-fallback/stdlib/struct.pyi +5 -5
  507. package/dist/typeshed-fallback/stdlib/subprocess.pyi +2640 -2640
  508. package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
  509. package/dist/typeshed-fallback/stdlib/symtable.pyi +90 -90
  510. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +773 -707
  511. package/dist/typeshed-fallback/stdlib/sysconfig.pyi +48 -48
  512. package/dist/typeshed-fallback/stdlib/tabnanny.pyi +16 -16
  513. package/dist/typeshed-fallback/stdlib/tarfile.pyi +593 -593
  514. package/dist/typeshed-fallback/stdlib/tempfile.pyi +497 -497
  515. package/dist/typeshed-fallback/stdlib/termios.pyi +108 -72
  516. package/dist/typeshed-fallback/stdlib/textwrap.pyi +103 -103
  517. package/dist/typeshed-fallback/stdlib/threading.pyi +279 -279
  518. package/dist/typeshed-fallback/stdlib/time.pyi +380 -380
  519. package/dist/typeshed-fallback/stdlib/timeit.pyi +32 -32
  520. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3900 -3847
  521. package/dist/typeshed-fallback/stdlib/tkinter/colorchooser.pyi +20 -20
  522. package/dist/typeshed-fallback/stdlib/tkinter/commondialog.pyi +14 -14
  523. package/dist/typeshed-fallback/stdlib/tkinter/constants.pyi +80 -80
  524. package/dist/typeshed-fallback/stdlib/tkinter/dialog.pyi +16 -16
  525. package/dist/typeshed-fallback/stdlib/tkinter/dnd.pyi +20 -20
  526. package/dist/typeshed-fallback/stdlib/tkinter/filedialog.pyi +151 -151
  527. package/dist/typeshed-fallback/stdlib/tkinter/font.pyi +118 -116
  528. package/dist/typeshed-fallback/stdlib/tkinter/messagebox.pyi +44 -44
  529. package/dist/typeshed-fallback/stdlib/tkinter/scrolledtext.pyi +9 -9
  530. package/dist/typeshed-fallback/stdlib/tkinter/simpledialog.pyi +54 -54
  531. package/dist/typeshed-fallback/stdlib/tkinter/ttk.pyi +1207 -1207
  532. package/dist/typeshed-fallback/stdlib/token.pyi +160 -160
  533. package/dist/typeshed-fallback/stdlib/tokenize.pyi +186 -184
  534. package/dist/typeshed-fallback/stdlib/tomllib.pyi +10 -10
  535. package/dist/typeshed-fallback/stdlib/trace.pyi +90 -90
  536. package/dist/typeshed-fallback/stdlib/traceback.pyi +300 -300
  537. package/dist/typeshed-fallback/stdlib/tracemalloc.pyi +124 -124
  538. package/dist/typeshed-fallback/stdlib/turtle.pyi +732 -721
  539. package/dist/typeshed-fallback/stdlib/types.pyi +909 -913
  540. package/dist/typeshed-fallback/stdlib/typing.pyi +1145 -1147
  541. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +19 -47
  542. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +303 -303
  543. package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +63 -68
  544. package/dist/typeshed-fallback/stdlib/unittest/_log.pyi +27 -27
  545. package/dist/typeshed-fallback/stdlib/unittest/async_case.pyi +25 -25
  546. package/dist/typeshed-fallback/stdlib/unittest/case.pyi +361 -361
  547. package/dist/typeshed-fallback/stdlib/unittest/loader.pyi +55 -55
  548. package/dist/typeshed-fallback/stdlib/unittest/main.pyi +73 -73
  549. package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +468 -468
  550. package/dist/typeshed-fallback/stdlib/unittest/result.pyi +47 -47
  551. package/dist/typeshed-fallback/stdlib/unittest/runner.pyi +92 -92
  552. package/dist/typeshed-fallback/stdlib/unittest/signals.pyi +15 -15
  553. package/dist/typeshed-fallback/stdlib/unittest/suite.pyi +22 -22
  554. package/dist/typeshed-fallback/stdlib/unittest/util.pyi +23 -23
  555. package/dist/typeshed-fallback/stdlib/urllib/error.pyi +23 -23
  556. package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +258 -258
  557. package/dist/typeshed-fallback/stdlib/urllib/request.pyi +408 -408
  558. package/dist/typeshed-fallback/stdlib/urllib/response.pyi +43 -43
  559. package/dist/typeshed-fallback/stdlib/urllib/robotparser.pyi +20 -20
  560. package/dist/typeshed-fallback/stdlib/uuid.pyi +100 -100
  561. package/dist/typeshed-fallback/stdlib/venv/__init__.pyi +107 -107
  562. package/dist/typeshed-fallback/stdlib/warnings.pyi +127 -127
  563. package/dist/typeshed-fallback/stdlib/wave.pyi +85 -85
  564. package/dist/typeshed-fallback/stdlib/weakref.pyi +198 -198
  565. package/dist/typeshed-fallback/stdlib/webbrowser.pyi +78 -77
  566. package/dist/typeshed-fallback/stdlib/wsgiref/handlers.pyi +91 -91
  567. package/dist/typeshed-fallback/stdlib/wsgiref/headers.pyi +26 -26
  568. package/dist/typeshed-fallback/stdlib/wsgiref/simple_server.pyi +37 -37
  569. package/dist/typeshed-fallback/stdlib/wsgiref/types.pyi +32 -32
  570. package/dist/typeshed-fallback/stdlib/wsgiref/util.pyi +26 -26
  571. package/dist/typeshed-fallback/stdlib/wsgiref/validate.pyi +50 -50
  572. package/dist/typeshed-fallback/stdlib/xml/__init__.pyi +3 -1
  573. package/dist/typeshed-fallback/stdlib/xml/dom/NodeFilter.pyi +19 -19
  574. package/dist/typeshed-fallback/stdlib/xml/dom/__init__.pyi +69 -69
  575. package/dist/typeshed-fallback/stdlib/xml/dom/domreg.pyi +8 -8
  576. package/dist/typeshed-fallback/stdlib/xml/dom/expatbuilder.pyi +100 -100
  577. package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +26 -26
  578. package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +426 -426
  579. package/dist/typeshed-fallback/stdlib/xml/dom/pulldom.pyi +94 -94
  580. package/dist/typeshed-fallback/stdlib/xml/dom/xmlbuilder.pyi +108 -108
  581. package/dist/typeshed-fallback/stdlib/xml/etree/ElementInclude.pyi +29 -29
  582. package/dist/typeshed-fallback/stdlib/xml/etree/ElementPath.pyi +34 -34
  583. package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +347 -347
  584. package/dist/typeshed-fallback/stdlib/xml/etree/cElementTree.pyi +1 -1
  585. package/dist/typeshed-fallback/stdlib/xml/parsers/__init__.pyi +1 -1
  586. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/__init__.pyi +7 -7
  587. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +3 -3
  588. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +3 -3
  589. package/dist/typeshed-fallback/stdlib/xml/sax/__init__.pyi +25 -25
  590. package/dist/typeshed-fallback/stdlib/xml/sax/_exceptions.pyi +19 -19
  591. package/dist/typeshed-fallback/stdlib/xml/sax/handler.pyi +55 -55
  592. package/dist/typeshed-fallback/stdlib/xml/sax/saxutils.pyi +60 -60
  593. package/dist/typeshed-fallback/stdlib/xml/sax/xmlreader.pyi +87 -87
  594. package/dist/typeshed-fallback/stdlib/xmlrpc/client.pyi +296 -296
  595. package/dist/typeshed-fallback/stdlib/xmlrpc/server.pyi +144 -144
  596. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +1 -3
  597. package/dist/typeshed-fallback/stdlib/zipapp.pyi +20 -20
  598. package/dist/typeshed-fallback/stdlib/zipfile/__init__.pyi +384 -384
  599. package/dist/typeshed-fallback/stdlib/zipfile/_path.pyi +103 -101
  600. package/dist/typeshed-fallback/stdlib/zipimport.pyi +41 -70
  601. package/dist/typeshed-fallback/stdlib/zlib.pyi +162 -157
  602. package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +41 -47
  603. package/dist/typeshed-fallback/stdlib/zoneinfo/_common.pyi +13 -13
  604. package/dist/typeshed-fallback/stdlib/zoneinfo/_tzpath.pyi +13 -13
  605. package/dist/typeshed-fallback/stubs/Deprecated/METADATA.toml +1 -1
  606. package/dist/typeshed-fallback/stubs/Deprecated/deprecated/classic.pyi +6 -1
  607. package/dist/typeshed-fallback/stubs/Deprecated/deprecated/sphinx.pyi +1 -0
  608. package/dist/typeshed-fallback/stubs/bleach/METADATA.toml +1 -1
  609. package/dist/typeshed-fallback/stubs/docutils/docutils/core.pyi +216 -1
  610. package/dist/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi +60 -2
  611. package/dist/typeshed-fallback/stubs/gevent/METADATA.toml +1 -1
  612. package/dist/typeshed-fallback/stubs/gevent/gevent/events.pyi +3 -1
  613. package/dist/typeshed-fallback/stubs/icalendar/METADATA.toml +6 -2
  614. package/dist/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi +14 -0
  615. package/dist/typeshed-fallback/stubs/icalendar/icalendar/alarms.pyi +54 -0
  616. package/dist/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi +137 -11
  617. package/dist/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi +8 -7
  618. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi +3 -2
  619. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids.pyi +15 -0
  620. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids_result.pyi +6 -0
  621. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzid.pyi +8 -0
  622. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi +2 -2
  623. package/dist/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi +12 -1
  624. package/dist/typeshed-fallback/stubs/networkx/METADATA.toml +1 -1
  625. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi +0 -2
  626. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/branchings.pyi +0 -31
  627. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/operations.pyi +1 -1
  628. package/dist/typeshed-fallback/stubs/networkx/networkx/classes/reportviews.pyi +3 -1
  629. package/dist/typeshed-fallback/stubs/networkx/networkx/drawing/layout.pyi +4 -0
  630. package/dist/typeshed-fallback/stubs/networkx/networkx/generators/trees.pyi +0 -4
  631. package/dist/typeshed-fallback/stubs/networkx/networkx/readwrite/json_graph/node_link.pyi +12 -2
  632. package/dist/typeshed-fallback/stubs/networkx/networkx/readwrite/text.pyi +1 -4
  633. package/dist/typeshed-fallback/stubs/networkx/networkx/utils/configs.pyi +20 -2
  634. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/__init__.pyi +2 -1
  635. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/cell/__init__.pyi +2 -0
  636. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/cell/_writer.pyi +4 -2
  637. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/cell/cell.pyi +2 -2
  638. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi +2 -1
  639. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/workbook.pyi +2 -2
  640. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi +5 -14
  641. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_reader.pyi +2 -3
  642. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_writer.pyi +4 -3
  643. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/merge.pyi +2 -1
  644. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi +30 -19
  645. package/dist/typeshed-fallback/stubs/peewee/METADATA.toml +1 -1
  646. package/dist/typeshed-fallback/stubs/peewee/peewee.pyi +3 -1
  647. package/dist/typeshed-fallback/stubs/pynput/pynput/_util.pyi +2 -2
  648. package/dist/typeshed-fallback/stubs/pysftp/pysftp/__init__.pyi +2 -2
  649. package/dist/typeshed-fallback/stubs/pywin32/isapi/install.pyi +98 -0
  650. package/dist/typeshed-fallback/stubs/pywin32/win32/win32clipboard.pyi +26 -24
  651. package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
  652. package/dist/typeshed-fallback/stubs/setuptools/distutils/spawn.pyi +1 -0
  653. package/dist/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi +6 -7
  654. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +2 -2
  655. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +2 -2
  656. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/spawn.pyi +7 -0
  657. package/dist/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi +4 -2
  658. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi +9 -8
  659. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi +3 -5
  660. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi +2 -1
  661. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi +6 -7
  662. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi +12 -17
  663. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/editable_wheel.pyi +1 -1
  664. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi +1 -1
  665. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/install_egg_info.pyi +1 -1
  666. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/sdist.pyi +2 -1
  667. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/test.pyi +2 -2
  668. package/dist/typeshed-fallback/stubs/setuptools/setuptools/config/__init__.pyi +1 -14
  669. package/dist/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi +1 -1
  670. package/dist/typeshed-fallback/stubs/setuptools/setuptools/config/setupcfg.pyi +7 -5
  671. package/dist/typeshed-fallback/stubs/setuptools/setuptools/depends.pyi +8 -4
  672. package/dist/typeshed-fallback/stubs/setuptools/setuptools/dist.pyi +1 -1
  673. package/dist/typeshed-fallback/stubs/setuptools/setuptools/msvc.pyi +7 -8
  674. package/dist/typeshed-fallback/stubs/setuptools/setuptools/package_index.pyi +7 -3
  675. package/dist/typeshed-fallback/stubs/setuptools/setuptools/sandbox.pyi +2 -4
  676. package/dist/typeshed-fallback/stubs/tqdm/METADATA.toml +2 -1
  677. package/dist/typeshed-fallback/stubs/tqdm/tqdm/contrib/discord.pyi +14 -3
  678. package/dist/typeshed-fallback/stubs/waitress/waitress/runner.pyi +1 -5
  679. package/package.json +5 -3
@@ -1,1317 +1,1367 @@
1
- """
2
- Implementation module for socket operations.
3
-
4
- See the socket module for documentation.
5
- """
6
-
7
- import sys
8
- from _typeshed import ReadableBuffer, WriteableBuffer
9
- from collections.abc import Iterable
10
- from socket import error as error, gaierror as gaierror, herror as herror, timeout as timeout
11
- from typing import Any, SupportsIndex, overload
12
- from typing_extensions import TypeAlias
13
-
14
- _CMSG: TypeAlias = tuple[int, int, bytes]
15
- _CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
16
-
17
- # Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
18
- # AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX).
19
- # See getsockaddrarg() in socketmodule.c.
20
- _Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
21
- _RetAddress: TypeAlias = Any
22
-
23
- # ===== Constants =====
24
- # This matches the order in the CPython documentation
25
- # https://docs.python.org/3/library/socket.html#constants
26
-
27
- if sys.platform != "win32":
28
- AF_UNIX: int
29
-
30
- AF_INET: int
31
- AF_INET6: int
32
-
33
- AF_UNSPEC: int
34
-
35
- SOCK_STREAM: int
36
- SOCK_DGRAM: int
37
- SOCK_RAW: int
38
- SOCK_RDM: int
39
- SOCK_SEQPACKET: int
40
-
41
- if sys.platform == "linux":
42
- # Availability: Linux >= 2.6.27
43
- SOCK_CLOEXEC: int
44
- SOCK_NONBLOCK: int
45
-
46
- # --------------------
47
- # Many constants of these forms, documented in the Unix documentation on
48
- # sockets and/or the IP protocol, are also defined in the socket module.
49
- # SO_*
50
- # socket.SOMAXCONN
51
- # MSG_*
52
- # SOL_*
53
- # SCM_*
54
- # IPPROTO_*
55
- # IPPORT_*
56
- # INADDR_*
57
- # IP_*
58
- # IPV6_*
59
- # EAI_*
60
- # AI_*
61
- # NI_*
62
- # TCP_*
63
- # --------------------
64
-
65
- SO_ACCEPTCONN: int
66
- SO_BROADCAST: int
67
- SO_DEBUG: int
68
- SO_DONTROUTE: int
69
- SO_ERROR: int
70
- SO_KEEPALIVE: int
71
- SO_LINGER: int
72
- SO_OOBINLINE: int
73
- SO_RCVBUF: int
74
- SO_RCVLOWAT: int
75
- SO_RCVTIMEO: int
76
- SO_REUSEADDR: int
77
- SO_SNDBUF: int
78
- SO_SNDLOWAT: int
79
- SO_SNDTIMEO: int
80
- SO_TYPE: int
81
- SO_USELOOPBACK: int
82
- if sys.platform == "win32":
83
- SO_EXCLUSIVEADDRUSE: int
84
- if sys.platform != "win32":
85
- SO_REUSEPORT: int
86
- if sys.platform != "win32" and sys.platform != "darwin":
87
- SO_BINDTODEVICE: int
88
- SO_DOMAIN: int
89
- SO_MARK: int
90
- SO_PASSCRED: int
91
- SO_PASSSEC: int
92
- SO_PEERCRED: int
93
- SO_PEERSEC: int
94
- SO_PRIORITY: int
95
- SO_PROTOCOL: int
96
- SO_SETFIB: int
97
-
98
- SOMAXCONN: int
99
-
100
- MSG_CTRUNC: int
101
- MSG_DONTROUTE: int
102
- MSG_OOB: int
103
- MSG_PEEK: int
104
- MSG_TRUNC: int
105
- MSG_WAITALL: int
106
- if sys.platform != "win32":
107
- MSG_DONTWAIT: int
108
- MSG_EOF: int
109
- MSG_EOR: int
110
- MSG_NOSIGNAL: int # Sometimes this exists on darwin, sometimes not
111
- if sys.platform != "darwin":
112
- MSG_BCAST: int
113
- MSG_ERRQUEUE: int
114
- MSG_MCAST: int
115
- if sys.platform != "win32" and sys.platform != "darwin":
116
- MSG_BTAG: int
117
- MSG_CMSG_CLOEXEC: int
118
- MSG_CONFIRM: int
119
- MSG_ETAG: int
120
- MSG_FASTOPEN: int
121
- MSG_MORE: int
122
- MSG_NOTIFICATION: int
123
-
124
- SOL_IP: int
125
- SOL_SOCKET: int
126
- SOL_TCP: int
127
- SOL_UDP: int
128
- if sys.platform != "win32" and sys.platform != "darwin":
129
- SOL_ATALK: int
130
- SOL_AX25: int
131
- SOL_HCI: int
132
- SOL_IPX: int
133
- SOL_NETROM: int
134
- SOL_ROSE: int
135
-
136
- if sys.platform != "win32":
137
- SCM_CREDS: int
138
- SCM_RIGHTS: int
139
- if sys.platform != "win32" and sys.platform != "darwin":
140
- SCM_CREDENTIALS: int
141
-
142
- IPPROTO_ICMP: int
143
- IPPROTO_IP: int
144
- IPPROTO_RAW: int
145
- IPPROTO_TCP: int
146
- IPPROTO_UDP: int
147
- IPPROTO_AH: int
148
- IPPROTO_DSTOPTS: int
149
- IPPROTO_EGP: int
150
- IPPROTO_ESP: int
151
- IPPROTO_FRAGMENT: int
152
- IPPROTO_GGP: int
153
- IPPROTO_HOPOPTS: int
154
- IPPROTO_ICMPV6: int
155
- IPPROTO_IDP: int
156
- IPPROTO_IGMP: int
157
- IPPROTO_IPV4: int
158
- IPPROTO_IPV6: int
159
- IPPROTO_MAX: int
160
- IPPROTO_ND: int
161
- IPPROTO_NONE: int
162
- IPPROTO_PIM: int
163
- IPPROTO_PUP: int
164
- IPPROTO_ROUTING: int
165
- IPPROTO_SCTP: int
166
- if sys.platform != "darwin":
167
- IPPROTO_CBT: int
168
- IPPROTO_ICLFXBM: int
169
- IPPROTO_IGP: int
170
- IPPROTO_L2TP: int
171
- IPPROTO_PGM: int
172
- IPPROTO_RDP: int
173
- IPPROTO_ST: int
174
- if sys.platform != "win32":
175
- IPPROTO_EON: int
176
- IPPROTO_GRE: int
177
- IPPROTO_HELLO: int
178
- IPPROTO_IPCOMP: int
179
- IPPROTO_IPIP: int
180
- IPPROTO_RSVP: int
181
- IPPROTO_TP: int
182
- IPPROTO_XTP: int
183
- if sys.platform != "win32" and sys.platform != "darwin":
184
- IPPROTO_BIP: int
185
- IPPROTO_MOBILE: int
186
- IPPROTO_VRRP: int
187
- if sys.version_info >= (3, 9) and sys.platform == "linux":
188
- # Availability: Linux >= 2.6.20, FreeBSD >= 10.1
189
- IPPROTO_UDPLITE: int
190
- if sys.version_info >= (3, 10) and sys.platform == "linux":
191
- IPPROTO_MPTCP: int
192
-
193
- IPPORT_RESERVED: int
194
- IPPORT_USERRESERVED: int
195
-
196
- INADDR_ALLHOSTS_GROUP: int
197
- INADDR_ANY: int
198
- INADDR_BROADCAST: int
199
- INADDR_LOOPBACK: int
200
- INADDR_MAX_LOCAL_GROUP: int
201
- INADDR_NONE: int
202
- INADDR_UNSPEC_GROUP: int
203
-
204
- IP_ADD_MEMBERSHIP: int
205
- IP_DROP_MEMBERSHIP: int
206
- IP_HDRINCL: int
207
- IP_MULTICAST_IF: int
208
- IP_MULTICAST_LOOP: int
209
- IP_MULTICAST_TTL: int
210
- IP_OPTIONS: int
211
- IP_RECVDSTADDR: int
212
- if sys.version_info >= (3, 10):
213
- IP_RECVTOS: int
214
- elif sys.platform != "win32" and sys.platform != "darwin":
215
- IP_RECVTOS: int
216
- IP_TOS: int
217
- IP_TTL: int
218
- if sys.platform != "win32":
219
- IP_DEFAULT_MULTICAST_LOOP: int
220
- IP_DEFAULT_MULTICAST_TTL: int
221
- IP_MAX_MEMBERSHIPS: int
222
- IP_RECVOPTS: int
223
- IP_RECVRETOPTS: int
224
- IP_RETOPTS: int
225
- if sys.platform != "win32" and sys.platform != "darwin":
226
- IP_TRANSPARENT: int
227
- IP_BIND_ADDRESS_NO_PORT: int
228
- if sys.version_info >= (3, 12):
229
- IP_ADD_SOURCE_MEMBERSHIP: int
230
- IP_BLOCK_SOURCE: int
231
- IP_DROP_SOURCE_MEMBERSHIP: int
232
- IP_PKTINFO: int
233
- IP_UNBLOCK_SOURCE: int
234
-
235
- IPV6_CHECKSUM: int
236
- IPV6_JOIN_GROUP: int
237
- IPV6_LEAVE_GROUP: int
238
- IPV6_MULTICAST_HOPS: int
239
- IPV6_MULTICAST_IF: int
240
- IPV6_MULTICAST_LOOP: int
241
- IPV6_RECVTCLASS: int
242
- IPV6_TCLASS: int
243
- IPV6_UNICAST_HOPS: int
244
- IPV6_V6ONLY: int
245
- if sys.version_info >= (3, 9) or sys.platform != "darwin":
246
- IPV6_DONTFRAG: int
247
- IPV6_HOPLIMIT: int
248
- IPV6_HOPOPTS: int
249
- IPV6_PKTINFO: int
250
- IPV6_RECVRTHDR: int
251
- IPV6_RTHDR: int
252
- if sys.platform != "win32":
253
- IPV6_RTHDR_TYPE_0: int
254
- if sys.version_info >= (3, 9) or sys.platform != "darwin":
255
- IPV6_DSTOPTS: int
256
- IPV6_NEXTHOP: int
257
- IPV6_PATHMTU: int
258
- IPV6_RECVDSTOPTS: int
259
- IPV6_RECVHOPLIMIT: int
260
- IPV6_RECVHOPOPTS: int
261
- IPV6_RECVPATHMTU: int
262
- IPV6_RECVPKTINFO: int
263
- IPV6_RTHDRDSTOPTS: int
264
- IPV6_USE_MIN_MTU: int
265
-
266
- EAI_AGAIN: int
267
- EAI_BADFLAGS: int
268
- EAI_FAIL: int
269
- EAI_FAMILY: int
270
- EAI_MEMORY: int
271
- EAI_NODATA: int
272
- EAI_NONAME: int
273
- EAI_SERVICE: int
274
- EAI_SOCKTYPE: int
275
- if sys.platform != "win32":
276
- EAI_ADDRFAMILY: int
277
- EAI_BADHINTS: int
278
- EAI_MAX: int
279
- EAI_OVERFLOW: int
280
- EAI_PROTOCOL: int
281
- EAI_SYSTEM: int
282
-
283
- AI_ADDRCONFIG: int
284
- AI_ALL: int
285
- AI_CANONNAME: int
286
- AI_NUMERICHOST: int
287
- AI_NUMERICSERV: int
288
- AI_PASSIVE: int
289
- AI_V4MAPPED: int
290
- if sys.platform != "win32":
291
- AI_DEFAULT: int
292
- AI_MASK: int
293
- AI_V4MAPPED_CFG: int
294
-
295
- NI_DGRAM: int
296
- NI_MAXHOST: int
297
- NI_MAXSERV: int
298
- NI_NAMEREQD: int
299
- NI_NOFQDN: int
300
- NI_NUMERICHOST: int
301
- NI_NUMERICSERV: int
302
-
303
- TCP_FASTOPEN: int
304
- TCP_KEEPCNT: int
305
- TCP_KEEPINTVL: int
306
- TCP_MAXSEG: int
307
- TCP_NODELAY: int
308
- if sys.platform != "win32":
309
- TCP_NOTSENT_LOWAT: int
310
- if sys.platform != "darwin":
311
- TCP_KEEPIDLE: int
312
- if sys.version_info >= (3, 10) and sys.platform == "darwin":
313
- TCP_KEEPALIVE: int
314
- if sys.version_info >= (3, 11) and sys.platform == "darwin":
315
- TCP_CONNECTION_INFO: int
316
-
317
- if sys.platform != "win32" and sys.platform != "darwin":
318
- TCP_CONGESTION: int
319
- TCP_CORK: int
320
- TCP_DEFER_ACCEPT: int
321
- TCP_INFO: int
322
- TCP_LINGER2: int
323
- TCP_QUICKACK: int
324
- TCP_SYNCNT: int
325
- TCP_USER_TIMEOUT: int
326
- TCP_WINDOW_CLAMP: int
327
-
328
- # --------------------
329
- # Specifically documented constants
330
- # --------------------
331
-
332
- if sys.platform == "linux":
333
- # Availability: Linux >= 2.6.25, NetBSD >= 8
334
- AF_CAN: int
335
- PF_CAN: int
336
- SOL_CAN_BASE: int
337
- SOL_CAN_RAW: int
338
- CAN_EFF_FLAG: int
339
- CAN_EFF_MASK: int
340
- CAN_ERR_FLAG: int
341
- CAN_ERR_MASK: int
342
- CAN_RAW: int
343
- CAN_RAW_ERR_FILTER: int
344
- CAN_RAW_FILTER: int
345
- CAN_RAW_LOOPBACK: int
346
- CAN_RAW_RECV_OWN_MSGS: int
347
- CAN_RTR_FLAG: int
348
- CAN_SFF_MASK: int
349
-
350
- if sys.platform == "linux":
351
- # Availability: Linux >= 2.6.25
352
- CAN_BCM: int
353
- CAN_BCM_TX_SETUP: int
354
- CAN_BCM_TX_DELETE: int
355
- CAN_BCM_TX_READ: int
356
- CAN_BCM_TX_SEND: int
357
- CAN_BCM_RX_SETUP: int
358
- CAN_BCM_RX_DELETE: int
359
- CAN_BCM_RX_READ: int
360
- CAN_BCM_TX_STATUS: int
361
- CAN_BCM_TX_EXPIRED: int
362
- CAN_BCM_RX_STATUS: int
363
- CAN_BCM_RX_TIMEOUT: int
364
- CAN_BCM_RX_CHANGED: int
365
- CAN_BCM_SETTIMER: int
366
- CAN_BCM_STARTTIMER: int
367
- CAN_BCM_TX_COUNTEVT: int
368
- CAN_BCM_TX_ANNOUNCE: int
369
- CAN_BCM_TX_CP_CAN_ID: int
370
- CAN_BCM_RX_FILTER_ID: int
371
- CAN_BCM_RX_CHECK_DLC: int
372
- CAN_BCM_RX_NO_AUTOTIMER: int
373
- CAN_BCM_RX_ANNOUNCE_RESUME: int
374
- CAN_BCM_TX_RESET_MULTI_IDX: int
375
- CAN_BCM_RX_RTR_FRAME: int
376
- CAN_BCM_CAN_FD_FRAME: int
377
-
378
- if sys.platform == "linux":
379
- # Availability: Linux >= 3.6
380
- CAN_RAW_FD_FRAMES: int
381
-
382
- if sys.platform == "linux" and sys.version_info >= (3, 9):
383
- # Availability: Linux >= 4.1
384
- CAN_RAW_JOIN_FILTERS: int
385
-
386
- if sys.platform == "linux":
387
- # Availability: Linux >= 2.6.25
388
- CAN_ISOTP: int
389
-
390
- if sys.platform == "linux" and sys.version_info >= (3, 9):
391
- # Availability: Linux >= 5.4
392
- CAN_J1939: int
393
-
394
- J1939_MAX_UNICAST_ADDR: int
395
- J1939_IDLE_ADDR: int
396
- J1939_NO_ADDR: int
397
- J1939_NO_NAME: int
398
- J1939_PGN_REQUEST: int
399
- J1939_PGN_ADDRESS_CLAIMED: int
400
- J1939_PGN_ADDRESS_COMMANDED: int
401
- J1939_PGN_PDU1_MAX: int
402
- J1939_PGN_MAX: int
403
- J1939_NO_PGN: int
404
-
405
- SO_J1939_FILTER: int
406
- SO_J1939_PROMISC: int
407
- SO_J1939_SEND_PRIO: int
408
- SO_J1939_ERRQUEUE: int
409
-
410
- SCM_J1939_DEST_ADDR: int
411
- SCM_J1939_DEST_NAME: int
412
- SCM_J1939_PRIO: int
413
- SCM_J1939_ERRQUEUE: int
414
-
415
- J1939_NLA_PAD: int
416
- J1939_NLA_BYTES_ACKED: int
417
- J1939_EE_INFO_NONE: int
418
- J1939_EE_INFO_TX_ABORT: int
419
- J1939_FILTER_MAX: int
420
-
421
- if sys.version_info >= (3, 12) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
422
- # Availability: FreeBSD >= 14.0
423
- AF_DIVERT: int
424
- PF_DIVERT: int
425
-
426
- if sys.platform == "linux":
427
- # Availability: Linux >= 2.2
428
- AF_PACKET: int
429
- PF_PACKET: int
430
- PACKET_BROADCAST: int
431
- PACKET_FASTROUTE: int
432
- PACKET_HOST: int
433
- PACKET_LOOPBACK: int
434
- PACKET_MULTICAST: int
435
- PACKET_OTHERHOST: int
436
- PACKET_OUTGOING: int
437
-
438
- if sys.version_info >= (3, 12) and sys.platform == "linux":
439
- ETH_P_ALL: int
440
-
441
- if sys.platform == "linux":
442
- # Availability: Linux >= 2.6.30
443
- AF_RDS: int
444
- PF_RDS: int
445
- SOL_RDS: int
446
- RDS_CANCEL_SENT_TO: int
447
- RDS_CMSG_RDMA_ARGS: int
448
- RDS_CMSG_RDMA_DEST: int
449
- RDS_CMSG_RDMA_MAP: int
450
- RDS_CMSG_RDMA_STATUS: int
451
- RDS_CMSG_RDMA_UPDATE: int
452
- RDS_CONG_MONITOR: int
453
- RDS_FREE_MR: int
454
- RDS_GET_MR: int
455
- RDS_GET_MR_FOR_DEST: int
456
- RDS_RDMA_DONTWAIT: int
457
- RDS_RDMA_FENCE: int
458
- RDS_RDMA_INVALIDATE: int
459
- RDS_RDMA_NOTIFY_ME: int
460
- RDS_RDMA_READWRITE: int
461
- RDS_RDMA_SILENT: int
462
- RDS_RDMA_USE_ONCE: int
463
- RDS_RECVERR: int
464
-
465
- if sys.platform == "win32":
466
- SIO_RCVALL: int
467
- SIO_KEEPALIVE_VALS: int
468
- SIO_LOOPBACK_FAST_PATH: int
469
- RCVALL_MAX: int
470
- RCVALL_OFF: int
471
- RCVALL_ON: int
472
- RCVALL_SOCKETLEVELONLY: int
473
-
474
- if sys.platform == "linux":
475
- AF_TIPC: int
476
- SOL_TIPC: int
477
- TIPC_ADDR_ID: int
478
- TIPC_ADDR_NAME: int
479
- TIPC_ADDR_NAMESEQ: int
480
- TIPC_CFG_SRV: int
481
- TIPC_CLUSTER_SCOPE: int
482
- TIPC_CONN_TIMEOUT: int
483
- TIPC_CRITICAL_IMPORTANCE: int
484
- TIPC_DEST_DROPPABLE: int
485
- TIPC_HIGH_IMPORTANCE: int
486
- TIPC_IMPORTANCE: int
487
- TIPC_LOW_IMPORTANCE: int
488
- TIPC_MEDIUM_IMPORTANCE: int
489
- TIPC_NODE_SCOPE: int
490
- TIPC_PUBLISHED: int
491
- TIPC_SRC_DROPPABLE: int
492
- TIPC_SUBSCR_TIMEOUT: int
493
- TIPC_SUB_CANCEL: int
494
- TIPC_SUB_PORTS: int
495
- TIPC_SUB_SERVICE: int
496
- TIPC_TOP_SRV: int
497
- TIPC_WAIT_FOREVER: int
498
- TIPC_WITHDRAWN: int
499
- TIPC_ZONE_SCOPE: int
500
-
501
- if sys.platform == "linux":
502
- # Availability: Linux >= 2.6.38
503
- AF_ALG: int
504
- SOL_ALG: int
505
- ALG_OP_DECRYPT: int
506
- ALG_OP_ENCRYPT: int
507
- ALG_OP_SIGN: int
508
- ALG_OP_VERIFY: int
509
- ALG_SET_AEAD_ASSOCLEN: int
510
- ALG_SET_AEAD_AUTHSIZE: int
511
- ALG_SET_IV: int
512
- ALG_SET_KEY: int
513
- ALG_SET_OP: int
514
- ALG_SET_PUBKEY: int
515
-
516
- if sys.platform == "linux":
517
- # Availability: Linux >= 4.8 (or maybe 3.9, CPython docs are confusing)
518
- AF_VSOCK: int
519
- IOCTL_VM_SOCKETS_GET_LOCAL_CID: int
520
- VMADDR_CID_ANY: int
521
- VMADDR_CID_HOST: int
522
- VMADDR_PORT_ANY: int
523
- SO_VM_SOCKETS_BUFFER_MAX_SIZE: int
524
- SO_VM_SOCKETS_BUFFER_SIZE: int
525
- SO_VM_SOCKETS_BUFFER_MIN_SIZE: int
526
- VM_SOCKETS_INVALID_VERSION: int # undocumented
527
-
528
- if sys.platform != "win32" or sys.version_info >= (3, 9):
529
- # Documented as only available on BSD, macOS, but empirically sometimes
530
- # available on Windows
531
- AF_LINK: int
532
-
533
- has_ipv6: bool
534
-
535
- if sys.platform != "darwin":
536
- if sys.platform != "win32" or sys.version_info >= (3, 9):
537
- BDADDR_ANY: str
538
- BDADDR_LOCAL: str
539
-
540
- if sys.platform != "win32" and sys.platform != "darwin":
541
- HCI_FILTER: int # not in NetBSD or DragonFlyBSD
542
- HCI_TIME_STAMP: int # not in FreeBSD, NetBSD, or DragonFlyBSD
543
- HCI_DATA_DIR: int # not in FreeBSD, NetBSD, or DragonFlyBSD
544
-
545
- if sys.platform == "linux":
546
- AF_QIPCRTR: int # Availability: Linux >= 4.7
547
-
548
- if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
549
- # FreeBSD
550
- SCM_CREDS2: int
551
- LOCAL_CREDS: int
552
- LOCAL_CREDS_PERSISTENT: int
553
-
554
- if sys.version_info >= (3, 11) and sys.platform == "linux":
555
- SO_INCOMING_CPU: int # Availability: Linux >= 3.9
556
-
557
- if sys.version_info >= (3, 12) and sys.platform == "win32":
558
- # Availability: Windows
559
- AF_HYPERV: int
560
- HV_PROTOCOL_RAW: int
561
- HVSOCKET_CONNECT_TIMEOUT: int
562
- HVSOCKET_CONNECT_TIMEOUT_MAX: int
563
- HVSOCKET_CONNECTED_SUSPEND: int
564
- HVSOCKET_ADDRESS_FLAG_PASSTHRU: int
565
- HV_GUID_ZERO: str
566
- HV_GUID_WILDCARD: str
567
- HV_GUID_BROADCAST: str
568
- HV_GUID_CHILDREN: str
569
- HV_GUID_LOOPBACK: str
570
- HV_GUID_PARENT: str
571
-
572
- if sys.version_info >= (3, 12):
573
- if sys.platform != "win32":
574
- # Availability: Linux, FreeBSD, macOS
575
- ETHERTYPE_ARP: int
576
- ETHERTYPE_IP: int
577
- ETHERTYPE_IPV6: int
578
- ETHERTYPE_VLAN: int
579
-
580
- # --------------------
581
- # Semi-documented constants
582
- # These are alluded to under the "Socket families" section in the docs
583
- # https://docs.python.org/3/library/socket.html#socket-families
584
- # --------------------
585
-
586
- if sys.platform == "linux":
587
- # Netlink is defined by Linux
588
- AF_NETLINK: int
589
- NETLINK_ARPD: int
590
- NETLINK_CRYPTO: int
591
- NETLINK_DNRTMSG: int
592
- NETLINK_FIREWALL: int
593
- NETLINK_IP6_FW: int
594
- NETLINK_NFLOG: int
595
- NETLINK_ROUTE6: int
596
- NETLINK_ROUTE: int
597
- NETLINK_SKIP: int
598
- NETLINK_TAPBASE: int
599
- NETLINK_TCPDIAG: int
600
- NETLINK_USERSOCK: int
601
- NETLINK_W1: int
602
- NETLINK_XFRM: int
603
-
604
- if sys.platform == "darwin":
605
- PF_SYSTEM: int
606
- SYSPROTO_CONTROL: int
607
-
608
- if sys.platform != "darwin":
609
- if sys.version_info >= (3, 9) or sys.platform != "win32":
610
- AF_BLUETOOTH: int
611
-
612
- if sys.platform != "win32" and sys.platform != "darwin":
613
- # Linux and some BSD support is explicit in the docs
614
- # Windows and macOS do not support in practice
615
- BTPROTO_HCI: int
616
- BTPROTO_L2CAP: int
617
- BTPROTO_SCO: int # not in FreeBSD
618
- if sys.platform != "darwin":
619
- if sys.version_info >= (3, 9) or sys.platform != "win32":
620
- BTPROTO_RFCOMM: int
621
-
622
- if sys.version_info >= (3, 9) and sys.platform == "linux":
623
- UDPLITE_RECV_CSCOV: int
624
- UDPLITE_SEND_CSCOV: int
625
-
626
- # --------------------
627
- # Documented under socket.shutdown
628
- # --------------------
629
- SHUT_RD: int
630
- SHUT_RDWR: int
631
- SHUT_WR: int
632
-
633
- # --------------------
634
- # Undocumented constants
635
- # --------------------
636
-
637
- # Undocumented address families
638
- AF_APPLETALK: int
639
- AF_DECnet: int
640
- AF_IPX: int
641
- AF_SNA: int
642
-
643
- if sys.platform != "win32":
644
- AF_ROUTE: int
645
- AF_SYSTEM: int
646
-
647
- if sys.platform != "darwin":
648
- AF_IRDA: int
649
-
650
- if sys.platform != "win32" and sys.platform != "darwin":
651
- AF_AAL5: int
652
- AF_ASH: int
653
- AF_ATMPVC: int
654
- AF_ATMSVC: int
655
- AF_AX25: int
656
- AF_BRIDGE: int
657
- AF_ECONET: int
658
- AF_KEY: int
659
- AF_LLC: int
660
- AF_NETBEUI: int
661
- AF_NETROM: int
662
- AF_PPPOX: int
663
- AF_ROSE: int
664
- AF_SECURITY: int
665
- AF_WANPIPE: int
666
- AF_X25: int
667
-
668
- # Miscellaneous undocumented
669
-
670
- if sys.platform != "win32":
671
- LOCAL_PEERCRED: int
672
-
673
- if sys.platform != "win32" and sys.platform != "darwin":
674
- IPX_TYPE: int
675
-
676
- # ===== Classes =====
677
-
678
- class socket:
679
- """
680
- socket(family=AF_INET, type=SOCK_STREAM, proto=0) -> socket object
681
- socket(family=-1, type=-1, proto=-1, fileno=None) -> socket object
682
-
683
- Open a socket of the given type. The family argument specifies the
684
- address family; it defaults to AF_INET. The type argument specifies
685
- whether this is a stream (SOCK_STREAM, this is the default)
686
- or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0,
687
- specifying the default protocol. Keyword arguments are accepted.
688
- The socket is created as non-inheritable.
689
-
690
- When a fileno is passed in, family, type and proto are auto-detected,
691
- unless they are explicitly set.
692
-
693
- A socket object represents one endpoint of a network connection.
694
-
695
- Methods of socket objects (keyword arguments not allowed):
696
-
697
- _accept() -- accept connection, returning new socket fd and client address
698
- bind(addr) -- bind the socket to a local address
699
- close() -- close the socket
700
- connect(addr) -- connect the socket to a remote address
701
- connect_ex(addr) -- connect, return an error code instead of an exception
702
- dup() -- return a new socket fd duplicated from fileno()
703
- fileno() -- return underlying file descriptor
704
- getpeername() -- return remote address [*]
705
- getsockname() -- return local address
706
- getsockopt(level, optname[, buflen]) -- get socket options
707
- gettimeout() -- return timeout or None
708
- listen([n]) -- start listening for incoming connections
709
- recv(buflen[, flags]) -- receive data
710
- recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)
711
- recvfrom(buflen[, flags]) -- receive data and sender's address
712
- recvfrom_into(buffer[, nbytes, [, flags])
713
- -- receive data and sender's address (into a buffer)
714
- sendall(data[, flags]) -- send all data
715
- send(data[, flags]) -- send data, may not send all of it
716
- sendto(data[, flags], addr) -- send data to a given address
717
- setblocking(bool) -- set or clear the blocking I/O flag
718
- getblocking() -- return True if socket is blocking, False if non-blocking
719
- setsockopt(level, optname, value[, optlen]) -- set socket options
720
- settimeout(None | float) -- set or clear the timeout
721
- shutdown(how) -- shut down traffic in one or both directions
722
-
723
- [*] not available on all platforms!
724
- """
725
- @property
726
- def family(self) -> int:
727
- """the socket family"""
728
- ...
729
- @property
730
- def type(self) -> int:
731
- """the socket type"""
732
- ...
733
- @property
734
- def proto(self) -> int:
735
- """the socket protocol"""
736
- ...
737
- # F811: "Redefinition of unused `timeout`"
738
- @property
739
- def timeout(self) -> float | None:
740
- """the socket timeout"""
741
- ...
742
- if sys.platform == "win32":
743
- def __init__(
744
- self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | bytes | None = ...
745
- ) -> None: ...
746
- else:
747
- def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | None = ...) -> None: ...
748
-
749
- def bind(self, address: _Address, /) -> None:
750
- """
751
- bind(address)
752
-
753
- Bind the socket to a local address. For IP sockets, the address is a
754
- pair (host, port); the host must refer to the local host. For raw packet
755
- sockets the address is a tuple (ifname, proto [,pkttype [,hatype [,addr]]])
756
- """
757
- ...
758
- def close(self) -> None:
759
- """
760
- close()
761
-
762
- Close the socket. It cannot be used after this call.
763
- """
764
- ...
765
- def connect(self, address: _Address, /) -> None:
766
- """
767
- connect(address)
768
-
769
- Connect the socket to a remote address. For IP sockets, the address
770
- is a pair (host, port).
771
- """
772
- ...
773
- def connect_ex(self, address: _Address, /) -> int:
774
- """
775
- connect_ex(address) -> errno
776
-
777
- This is like connect(address), but returns an error code (the errno value)
778
- instead of raising an exception when an error occurs.
779
- """
780
- ...
781
- def detach(self) -> int:
782
- """
783
- detach()
784
-
785
- Close the socket object without closing the underlying file descriptor.
786
- The object cannot be used after this call, but the file descriptor
787
- can be reused for other purposes. The file descriptor is returned.
788
- """
789
- ...
790
- def fileno(self) -> int:
791
- """
792
- fileno() -> integer
793
-
794
- Return the integer file descriptor of the socket.
795
- """
796
- ...
797
- def getpeername(self) -> _RetAddress:
798
- """
799
- getpeername() -> address info
800
-
801
- Return the address of the remote endpoint. For IP sockets, the address
802
- info is a pair (hostaddr, port).
803
- """
804
- ...
805
- def getsockname(self) -> _RetAddress:
806
- """
807
- getsockname() -> address info
808
-
809
- Return the address of the local endpoint. The format depends on the
810
- address family. For IPv4 sockets, the address info is a pair
811
- (hostaddr, port). For IPv6 sockets, the address info is a 4-tuple
812
- (hostaddr, port, flowinfo, scope_id).
813
- """
814
- ...
815
- @overload
816
- def getsockopt(self, level: int, optname: int, /) -> int:
817
- """
818
- getsockopt(level, option[, buffersize]) -> value
819
-
820
- Get a socket option. See the Unix manual for level and option.
821
- If a nonzero buffersize argument is given, the return value is a
822
- string of that length; otherwise it is an integer.
823
- """
824
- ...
825
- @overload
826
- def getsockopt(self, level: int, optname: int, buflen: int, /) -> bytes:
827
- """
828
- getsockopt(level, option[, buffersize]) -> value
829
-
830
- Get a socket option. See the Unix manual for level and option.
831
- If a nonzero buffersize argument is given, the return value is a
832
- string of that length; otherwise it is an integer.
833
- """
834
- ...
835
- def getblocking(self) -> bool:
836
- """
837
- getblocking()
838
-
839
- Returns True if socket is in blocking mode, or False if it
840
- is in non-blocking mode.
841
- """
842
- ...
843
- def gettimeout(self) -> float | None:
844
- """
845
- gettimeout() -> timeout
846
-
847
- Returns the timeout in seconds (float) associated with socket
848
- operations. A timeout of None indicates that timeouts on socket
849
- operations are disabled.
850
- """
851
- ...
852
- if sys.platform == "win32":
853
- def ioctl(self, control: int, option: int | tuple[int, int, int] | bool, /) -> None: ...
854
-
855
- def listen(self, backlog: int = ..., /) -> None:
856
- """
857
- listen([backlog])
858
-
859
- Enable a server to accept connections. If backlog is specified, it must be
860
- at least 0 (if it is lower, it is set to 0); it specifies the number of
861
- unaccepted connections that the system will allow before refusing new
862
- connections. If not specified, a default reasonable value is chosen.
863
- """
864
- ...
865
- def recv(self, bufsize: int, flags: int = ..., /) -> bytes:
866
- """
867
- recv(buffersize[, flags]) -> data
868
-
869
- Receive up to buffersize bytes from the socket. For the optional flags
870
- argument, see the Unix manual. When no data is available, block until
871
- at least one byte is available or until the remote end is closed. When
872
- the remote end is closed and all data is read, return the empty string.
873
- """
874
- ...
875
- def recvfrom(self, bufsize: int, flags: int = ..., /) -> tuple[bytes, _RetAddress]:
876
- """
877
- recvfrom(buffersize[, flags]) -> (data, address info)
878
-
879
- Like recv(buffersize, flags) but also return the sender's address info.
880
- """
881
- ...
882
- if sys.platform != "win32":
883
- def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]:
884
- """
885
- recvmsg(bufsize[, ancbufsize[, flags]]) -> (data, ancdata, msg_flags, address)
886
-
887
- Receive normal data (up to bufsize bytes) and ancillary data from the
888
- socket. The ancbufsize argument sets the size in bytes of the
889
- internal buffer used to receive the ancillary data; it defaults to 0,
890
- meaning that no ancillary data will be received. Appropriate buffer
891
- sizes for ancillary data can be calculated using CMSG_SPACE() or
892
- CMSG_LEN(), and items which do not fit into the buffer might be
893
- truncated or discarded. The flags argument defaults to 0 and has the
894
- same meaning as for recv().
895
-
896
- The return value is a 4-tuple: (data, ancdata, msg_flags, address).
897
- The data item is a bytes object holding the non-ancillary data
898
- received. The ancdata item is a list of zero or more tuples
899
- (cmsg_level, cmsg_type, cmsg_data) representing the ancillary data
900
- (control messages) received: cmsg_level and cmsg_type are integers
901
- specifying the protocol level and protocol-specific type respectively,
902
- and cmsg_data is a bytes object holding the associated data. The
903
- msg_flags item is the bitwise OR of various flags indicating
904
- conditions on the received message; see your system documentation for
905
- details. If the receiving socket is unconnected, address is the
906
- address of the sending socket, if available; otherwise, its value is
907
- unspecified.
908
-
909
- If recvmsg() raises an exception after the system call returns, it
910
- will first attempt to close any file descriptors received via the
911
- SCM_RIGHTS mechanism.
912
- """
913
- ...
914
- def recvmsg_into(
915
- self, buffers: Iterable[WriteableBuffer], ancbufsize: int = ..., flags: int = ..., /
916
- ) -> tuple[int, list[_CMSG], int, Any]:
917
- """
918
- recvmsg_into(buffers[, ancbufsize[, flags]]) -> (nbytes, ancdata, msg_flags, address)
919
-
920
- Receive normal data and ancillary data from the socket, scattering the
921
- non-ancillary data into a series of buffers. The buffers argument
922
- must be an iterable of objects that export writable buffers
923
- (e.g. bytearray objects); these will be filled with successive chunks
924
- of the non-ancillary data until it has all been written or there are
925
- no more buffers. The ancbufsize argument sets the size in bytes of
926
- the internal buffer used to receive the ancillary data; it defaults to
927
- 0, meaning that no ancillary data will be received. Appropriate
928
- buffer sizes for ancillary data can be calculated using CMSG_SPACE()
929
- or CMSG_LEN(), and items which do not fit into the buffer might be
930
- truncated or discarded. The flags argument defaults to 0 and has the
931
- same meaning as for recv().
932
-
933
- The return value is a 4-tuple: (nbytes, ancdata, msg_flags, address).
934
- The nbytes item is the total number of bytes of non-ancillary data
935
- written into the buffers. The ancdata item is a list of zero or more
936
- tuples (cmsg_level, cmsg_type, cmsg_data) representing the ancillary
937
- data (control messages) received: cmsg_level and cmsg_type are
938
- integers specifying the protocol level and protocol-specific type
939
- respectively, and cmsg_data is a bytes object holding the associated
940
- data. The msg_flags item is the bitwise OR of various flags
941
- indicating conditions on the received message; see your system
942
- documentation for details. If the receiving socket is unconnected,
943
- address is the address of the sending socket, if available; otherwise,
944
- its value is unspecified.
945
-
946
- If recvmsg_into() raises an exception after the system call returns,
947
- it will first attempt to close any file descriptors received via the
948
- SCM_RIGHTS mechanism.
949
- """
950
- ...
951
-
952
- def recvfrom_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]:
953
- """
954
- recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
955
-
956
- Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
957
- """
958
- ...
959
- def recv_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> int:
960
- """
961
- recv_into(buffer, [nbytes[, flags]]) -> nbytes_read
962
-
963
- A version of recv() that stores its data into a buffer rather than creating
964
- a new string. Receive up to buffersize bytes from the socket. If buffersize
965
- is not specified (or 0), receive up to the size available in the given buffer.
966
-
967
- See recv() for documentation about the flags.
968
- """
969
- ...
970
- def send(self, data: ReadableBuffer, flags: int = ..., /) -> int:
971
- """
972
- send(data[, flags]) -> count
973
-
974
- Send a data string to the socket. For the optional flags
975
- argument, see the Unix manual. Return the number of bytes
976
- sent; this may be less than len(data) if the network is busy.
977
- """
978
- ...
979
- def sendall(self, data: ReadableBuffer, flags: int = ..., /) -> None:
980
- """
981
- sendall(data[, flags])
982
-
983
- Send a data string to the socket. For the optional flags
984
- argument, see the Unix manual. This calls send() repeatedly
985
- until all data is sent. If an error occurs, it's impossible
986
- to tell how much data has been sent.
987
- """
988
- ...
989
- @overload
990
- def sendto(self, data: ReadableBuffer, address: _Address, /) -> int:
991
- """
992
- sendto(data[, flags], address) -> count
993
-
994
- Like send(data, flags) but allows specifying the destination address.
995
- For IP sockets, the address is a pair (hostaddr, port).
996
- """
997
- ...
998
- @overload
999
- def sendto(self, data: ReadableBuffer, flags: int, address: _Address, /) -> int:
1000
- """
1001
- sendto(data[, flags], address) -> count
1002
-
1003
- Like send(data, flags) but allows specifying the destination address.
1004
- For IP sockets, the address is a pair (hostaddr, port).
1005
- """
1006
- ...
1007
- if sys.platform != "win32":
1008
- def sendmsg(
1009
- self,
1010
- buffers: Iterable[ReadableBuffer],
1011
- ancdata: Iterable[_CMSGArg] = ...,
1012
- flags: int = ...,
1013
- address: _Address | None = ...,
1014
- /,
1015
- ) -> int:
1016
- """
1017
- sendmsg(buffers[, ancdata[, flags[, address]]]) -> count
1018
-
1019
- Send normal and ancillary data to the socket, gathering the
1020
- non-ancillary data from a series of buffers and concatenating it into
1021
- a single message. The buffers argument specifies the non-ancillary
1022
- data as an iterable of bytes-like objects (e.g. bytes objects).
1023
- The ancdata argument specifies the ancillary data (control messages)
1024
- as an iterable of zero or more tuples (cmsg_level, cmsg_type,
1025
- cmsg_data), where cmsg_level and cmsg_type are integers specifying the
1026
- protocol level and protocol-specific type respectively, and cmsg_data
1027
- is a bytes-like object holding the associated data. The flags
1028
- argument defaults to 0 and has the same meaning as for send(). If
1029
- address is supplied and not None, it sets a destination address for
1030
- the message. The return value is the number of bytes of non-ancillary
1031
- data sent.
1032
- """
1033
- ...
1034
- if sys.platform == "linux":
1035
- def sendmsg_afalg(
1036
- self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
1037
- ) -> int: ...
1038
-
1039
- def setblocking(self, flag: bool, /) -> None:
1040
- """
1041
- setblocking(flag)
1042
-
1043
- Set the socket to blocking (flag is true) or non-blocking (false).
1044
- setblocking(True) is equivalent to settimeout(None);
1045
- setblocking(False) is equivalent to settimeout(0.0).
1046
- """
1047
- ...
1048
- def settimeout(self, value: float | None, /) -> None:
1049
- """
1050
- settimeout(timeout)
1051
-
1052
- Set a timeout on socket operations. 'timeout' can be a float,
1053
- giving in seconds, or None. Setting a timeout of None disables
1054
- the timeout feature and is equivalent to setblocking(1).
1055
- Setting a timeout of zero is the same as setblocking(0).
1056
- """
1057
- ...
1058
- @overload
1059
- def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer, /) -> None:
1060
- """
1061
- setsockopt(level, option, value: int)
1062
- setsockopt(level, option, value: buffer)
1063
- setsockopt(level, option, None, optlen: int)
1064
-
1065
- Set a socket option. See the Unix manual for level and option.
1066
- The value argument can either be an integer, a string buffer, or
1067
- None, optlen.
1068
- """
1069
- ...
1070
- @overload
1071
- def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None:
1072
- """
1073
- setsockopt(level, option, value: int)
1074
- setsockopt(level, option, value: buffer)
1075
- setsockopt(level, option, None, optlen: int)
1076
-
1077
- Set a socket option. See the Unix manual for level and option.
1078
- The value argument can either be an integer, a string buffer, or
1079
- None, optlen.
1080
- """
1081
- ...
1082
- if sys.platform == "win32":
1083
- def share(self, process_id: int, /) -> bytes: ...
1084
-
1085
- def shutdown(self, how: int, /) -> None:
1086
- """
1087
- shutdown(flag)
1088
-
1089
- Shut down the reading side of the socket (flag == SHUT_RD), the writing side
1090
- of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
1091
- """
1092
- ...
1093
-
1094
- SocketType = socket
1095
-
1096
- # ===== Functions =====
1097
-
1098
- def close(fd: SupportsIndex, /) -> None:
1099
- """
1100
- close(integer) -> None
1101
-
1102
- Close an integer socket file descriptor. This is like os.close(), but for
1103
- sockets; on some platforms os.close() won't work for socket file descriptors.
1104
- """
1105
- ...
1106
- def dup(fd: SupportsIndex, /) -> int:
1107
- """
1108
- dup(integer) -> integer
1109
-
1110
- Duplicate an integer socket file descriptor. This is like os.dup(), but for
1111
- sockets; on some platforms os.dup() won't work for socket file descriptors.
1112
- """
1113
- ...
1114
-
1115
- # the 5th tuple item is an address
1116
- def getaddrinfo(
1117
- host: bytes | str | None,
1118
- port: bytes | str | int | None,
1119
- family: int = ...,
1120
- type: int = ...,
1121
- proto: int = ...,
1122
- flags: int = ...,
1123
- ) -> list[tuple[int, int, int, str, tuple[str, int] | tuple[str, int, int, int]]]:
1124
- """
1125
- getaddrinfo(host, port [, family, type, proto, flags])
1126
- -> list of (family, type, proto, canonname, sockaddr)
1127
-
1128
- Resolve host and port into addrinfo struct.
1129
- """
1130
- ...
1131
- def gethostbyname(hostname: str, /) -> str:
1132
- """
1133
- gethostbyname(host) -> address
1134
-
1135
- Return the IP address (a string of the form '255.255.255.255') for a host.
1136
- """
1137
- ...
1138
- def gethostbyname_ex(hostname: str, /) -> tuple[str, list[str], list[str]]:
1139
- """
1140
- gethostbyname_ex(host) -> (name, aliaslist, addresslist)
1141
-
1142
- Return the true host name, a list of aliases, and a list of IP addresses,
1143
- for a host. The host argument is a string giving a host name or IP number.
1144
- """
1145
- ...
1146
- def gethostname() -> str:
1147
- """
1148
- gethostname() -> string
1149
-
1150
- Return the current host name.
1151
- """
1152
- ...
1153
- def gethostbyaddr(ip_address: str, /) -> tuple[str, list[str], list[str]]:
1154
- """
1155
- gethostbyaddr(host) -> (name, aliaslist, addresslist)
1156
-
1157
- Return the true host name, a list of aliases, and a list of IP addresses,
1158
- for a host. The host argument is a string giving a host name or IP number.
1159
- """
1160
- ...
1161
- def getnameinfo(sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int, /) -> tuple[str, str]:
1162
- """
1163
- getnameinfo(sockaddr, flags) --> (host, port)
1164
-
1165
- Get host and port for a sockaddr.
1166
- """
1167
- ...
1168
- def getprotobyname(protocolname: str, /) -> int:
1169
- """
1170
- getprotobyname(name) -> integer
1171
-
1172
- Return the protocol number for the named protocol. (Rarely used.)
1173
- """
1174
- ...
1175
- def getservbyname(servicename: str, protocolname: str = ..., /) -> int:
1176
- """
1177
- getservbyname(servicename[, protocolname]) -> integer
1178
-
1179
- Return a port number from a service name and protocol name.
1180
- The optional protocol name, if given, should be 'tcp' or 'udp',
1181
- otherwise any protocol will match.
1182
- """
1183
- ...
1184
- def getservbyport(port: int, protocolname: str = ..., /) -> str:
1185
- """
1186
- getservbyport(port[, protocolname]) -> string
1187
-
1188
- Return the service name from a port number and protocol name.
1189
- The optional protocol name, if given, should be 'tcp' or 'udp',
1190
- otherwise any protocol will match.
1191
- """
1192
- ...
1193
- def ntohl(x: int, /) -> int:
1194
- """
1195
- ntohl(integer) -> integer
1196
-
1197
- Convert a 32-bit integer from network to host byte order.
1198
- """
1199
- ...
1200
- def ntohs(x: int, /) -> int:
1201
- """Convert a 16-bit unsigned integer from network to host byte order."""
1202
- ...
1203
- def htonl(x: int, /) -> int:
1204
- """
1205
- htonl(integer) -> integer
1206
-
1207
- Convert a 32-bit integer from host to network byte order.
1208
- """
1209
- ...
1210
- def htons(x: int, /) -> int:
1211
- """Convert a 16-bit unsigned integer from host to network byte order."""
1212
- ...
1213
- def inet_aton(ip_addr: str, /) -> bytes:
1214
- """Convert an IP address in string format (123.45.67.89) to the 32-bit packed binary format used in low-level network functions."""
1215
- ...
1216
- def inet_ntoa(packed_ip: ReadableBuffer, /) -> str:
1217
- """Convert an IP address from 32-bit packed binary format to string format."""
1218
- ...
1219
- def inet_pton(address_family: int, ip_string: str, /) -> bytes:
1220
- """
1221
- inet_pton(af, ip) -> packed IP address string
1222
-
1223
- Convert an IP address from string format to a packed string suitable
1224
- for use with low-level network functions.
1225
- """
1226
- ...
1227
- def inet_ntop(address_family: int, packed_ip: ReadableBuffer, /) -> str:
1228
- """
1229
- inet_ntop(af, packed_ip) -> string formatted IP address
1230
-
1231
- Convert a packed IP address of the given family to string format.
1232
- """
1233
- ...
1234
- def getdefaulttimeout() -> float | None:
1235
- """
1236
- getdefaulttimeout() -> timeout
1237
-
1238
- Returns the default timeout in seconds (float) for new socket objects.
1239
- A value of None indicates that new socket objects have no timeout.
1240
- When the socket module is first imported, the default is None.
1241
- """
1242
- ...
1243
-
1244
- # F811: "Redefinition of unused `timeout`"
1245
- def setdefaulttimeout(timeout: float | None, /) -> None:
1246
- """
1247
- setdefaulttimeout(timeout)
1248
-
1249
- Set the default timeout in seconds (float) for new socket objects.
1250
- A value of None indicates that new socket objects have no timeout.
1251
- When the socket module is first imported, the default is None.
1252
- """
1253
- ...
1254
-
1255
- if sys.platform != "win32":
1256
- def sethostname(name: str, /) -> None:
1257
- """
1258
- sethostname(name)
1259
-
1260
- Sets the hostname to name.
1261
- """
1262
- ...
1263
- def CMSG_LEN(length: int, /) -> int:
1264
- """
1265
- CMSG_LEN(length) -> control message length
1266
-
1267
- Return the total length, without trailing padding, of an ancillary
1268
- data item with associated data of the given length. This value can
1269
- often be used as the buffer size for recvmsg() to receive a single
1270
- item of ancillary data, but RFC 3542 requires portable applications to
1271
- use CMSG_SPACE() and thus include space for padding, even when the
1272
- item will be the last in the buffer. Raises OverflowError if length
1273
- is outside the permissible range of values.
1274
- """
1275
- ...
1276
- def CMSG_SPACE(length: int, /) -> int:
1277
- """
1278
- CMSG_SPACE(length) -> buffer size
1279
-
1280
- Return the buffer size needed for recvmsg() to receive an ancillary
1281
- data item with associated data of the given length, along with any
1282
- trailing padding. The buffer space needed to receive multiple items
1283
- is the sum of the CMSG_SPACE() values for their associated data
1284
- lengths. Raises OverflowError if length is outside the permissible
1285
- range of values.
1286
- """
1287
- ...
1288
- def socketpair(family: int = ..., type: int = ..., proto: int = ..., /) -> tuple[socket, socket]:
1289
- """
1290
- socketpair([family[, type [, proto]]]) -> (socket object, socket object)
1291
-
1292
- Create a pair of socket objects from the sockets returned by the platform
1293
- socketpair() function.
1294
- The arguments are the same as for socket() except the default family is
1295
- AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
1296
- """
1297
- ...
1298
-
1299
- def if_nameindex() -> list[tuple[int, str]]:
1300
- """
1301
- if_nameindex()
1302
-
1303
- Returns a list of network interface information (index, name) tuples.
1304
- """
1305
- ...
1306
- def if_nametoindex(oname: str, /) -> int:
1307
- """Returns the interface index corresponding to the interface name if_name."""
1308
- ...
1309
- def if_indextoname(index: int, /) -> str:
1310
- """
1311
- if_indextoname(if_index)
1312
-
1313
- Returns the interface name corresponding to the interface index if_index.
1314
- """
1315
- ...
1316
-
1317
- CAPI: object
1
+ """
2
+ Implementation module for socket operations.
3
+
4
+ See the socket module for documentation.
5
+ """
6
+
7
+ import sys
8
+ from _typeshed import ReadableBuffer, WriteableBuffer
9
+ from collections.abc import Iterable
10
+ from socket import error as error, gaierror as gaierror, herror as herror, timeout as timeout
11
+ from typing import Any, SupportsIndex, overload
12
+ from typing_extensions import CapsuleType, TypeAlias
13
+
14
+ _CMSG: TypeAlias = tuple[int, int, bytes]
15
+ _CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
16
+
17
+ # Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
18
+ # AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX).
19
+ # See getsockaddrarg() in socketmodule.c.
20
+ _Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
21
+ _RetAddress: TypeAlias = Any
22
+
23
+ # ===== Constants =====
24
+ # This matches the order in the CPython documentation
25
+ # https://docs.python.org/3/library/socket.html#constants
26
+
27
+ if sys.platform != "win32":
28
+ AF_UNIX: int
29
+
30
+ AF_INET: int
31
+ AF_INET6: int
32
+
33
+ AF_UNSPEC: int
34
+
35
+ SOCK_STREAM: int
36
+ SOCK_DGRAM: int
37
+ SOCK_RAW: int
38
+ SOCK_RDM: int
39
+ SOCK_SEQPACKET: int
40
+
41
+ if sys.platform == "linux":
42
+ # Availability: Linux >= 2.6.27
43
+ SOCK_CLOEXEC: int
44
+ SOCK_NONBLOCK: int
45
+
46
+ # --------------------
47
+ # Many constants of these forms, documented in the Unix documentation on
48
+ # sockets and/or the IP protocol, are also defined in the socket module.
49
+ # SO_*
50
+ # socket.SOMAXCONN
51
+ # MSG_*
52
+ # SOL_*
53
+ # SCM_*
54
+ # IPPROTO_*
55
+ # IPPORT_*
56
+ # INADDR_*
57
+ # IP_*
58
+ # IPV6_*
59
+ # EAI_*
60
+ # AI_*
61
+ # NI_*
62
+ # TCP_*
63
+ # --------------------
64
+
65
+ SO_ACCEPTCONN: int
66
+ SO_BROADCAST: int
67
+ SO_DEBUG: int
68
+ SO_DONTROUTE: int
69
+ SO_ERROR: int
70
+ SO_KEEPALIVE: int
71
+ SO_LINGER: int
72
+ SO_OOBINLINE: int
73
+ SO_RCVBUF: int
74
+ SO_RCVLOWAT: int
75
+ SO_RCVTIMEO: int
76
+ SO_REUSEADDR: int
77
+ SO_SNDBUF: int
78
+ SO_SNDLOWAT: int
79
+ SO_SNDTIMEO: int
80
+ SO_TYPE: int
81
+ if sys.platform != "linux":
82
+ SO_USELOOPBACK: int
83
+ if sys.platform == "win32":
84
+ SO_EXCLUSIVEADDRUSE: int
85
+ if sys.platform != "win32":
86
+ SO_REUSEPORT: int
87
+ if sys.platform != "win32" and sys.platform != "darwin":
88
+ SO_BINDTODEVICE: int
89
+ SO_DOMAIN: int
90
+ SO_MARK: int
91
+ SO_PASSCRED: int
92
+ SO_PASSSEC: int
93
+ SO_PEERCRED: int
94
+ SO_PEERSEC: int
95
+ SO_PRIORITY: int
96
+ SO_PROTOCOL: int
97
+ if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
98
+ SO_SETFIB: int
99
+ if sys.platform == "linux" and sys.version_info >= (3, 13):
100
+ SO_BINDTOIFINDEX: int
101
+
102
+ SOMAXCONN: int
103
+
104
+ MSG_CTRUNC: int
105
+ MSG_DONTROUTE: int
106
+ MSG_OOB: int
107
+ MSG_PEEK: int
108
+ MSG_TRUNC: int
109
+ MSG_WAITALL: int
110
+ if sys.platform != "win32":
111
+ MSG_DONTWAIT: int
112
+ MSG_EOR: int
113
+ MSG_NOSIGNAL: int # Sometimes this exists on darwin, sometimes not
114
+ if sys.platform != "darwin":
115
+ MSG_ERRQUEUE: int
116
+ if sys.platform == "win32":
117
+ MSG_BCAST: int
118
+ MSG_MCAST: int
119
+ if sys.platform != "win32" and sys.platform != "darwin":
120
+ MSG_CMSG_CLOEXEC: int
121
+ MSG_CONFIRM: int
122
+ MSG_FASTOPEN: int
123
+ MSG_MORE: int
124
+ if sys.platform != "win32" and sys.platform != "linux":
125
+ MSG_EOF: int
126
+ if sys.platform != "win32" and sys.platform != "linux" and sys.platform != "darwin":
127
+ MSG_NOTIFICATION: int
128
+ MSG_BTAG: int # Not FreeBSD either
129
+ MSG_ETAG: int # Not FreeBSD either
130
+
131
+ SOL_IP: int
132
+ SOL_SOCKET: int
133
+ SOL_TCP: int
134
+ SOL_UDP: int
135
+ if sys.platform != "win32" and sys.platform != "darwin":
136
+ # Defined in socket.h for Linux, but these aren't always present for
137
+ # some reason.
138
+ SOL_ATALK: int
139
+ SOL_AX25: int
140
+ SOL_HCI: int
141
+ SOL_IPX: int
142
+ SOL_NETROM: int
143
+ SOL_ROSE: int
144
+
145
+ if sys.platform != "win32":
146
+ SCM_RIGHTS: int
147
+ if sys.platform != "win32" and sys.platform != "darwin":
148
+ SCM_CREDENTIALS: int
149
+ if sys.platform != "win32" and sys.platform != "linux":
150
+ SCM_CREDS: int
151
+
152
+ IPPROTO_ICMP: int
153
+ IPPROTO_IP: int
154
+ IPPROTO_RAW: int
155
+ IPPROTO_TCP: int
156
+ IPPROTO_UDP: int
157
+ IPPROTO_AH: int
158
+ IPPROTO_DSTOPTS: int
159
+ IPPROTO_EGP: int
160
+ IPPROTO_ESP: int
161
+ IPPROTO_FRAGMENT: int
162
+ IPPROTO_HOPOPTS: int
163
+ IPPROTO_ICMPV6: int
164
+ IPPROTO_IDP: int
165
+ IPPROTO_IGMP: int
166
+ IPPROTO_IPV6: int
167
+ IPPROTO_NONE: int
168
+ IPPROTO_PIM: int
169
+ IPPROTO_PUP: int
170
+ IPPROTO_ROUTING: int
171
+ IPPROTO_SCTP: int
172
+ if sys.platform != "linux":
173
+ IPPROTO_GGP: int
174
+ IPPROTO_IPV4: int
175
+ IPPROTO_MAX: int
176
+ IPPROTO_ND: int
177
+ if sys.platform == "win32":
178
+ IPPROTO_CBT: int
179
+ IPPROTO_ICLFXBM: int
180
+ IPPROTO_IGP: int
181
+ IPPROTO_L2TP: int
182
+ IPPROTO_PGM: int
183
+ IPPROTO_RDP: int
184
+ IPPROTO_ST: int
185
+ if sys.platform != "win32":
186
+ IPPROTO_GRE: int
187
+ IPPROTO_IPIP: int
188
+ IPPROTO_RSVP: int
189
+ IPPROTO_TP: int
190
+ if sys.platform != "win32" and sys.platform != "linux":
191
+ IPPROTO_EON: int
192
+ IPPROTO_HELLO: int
193
+ IPPROTO_IPCOMP: int
194
+ IPPROTO_XTP: int
195
+ if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
196
+ IPPROTO_BIP: int # Not FreeBSD either
197
+ IPPROTO_MOBILE: int # Not FreeBSD either
198
+ IPPROTO_VRRP: int # Not FreeBSD either
199
+ if sys.version_info >= (3, 9) and sys.platform == "linux":
200
+ # Availability: Linux >= 2.6.20, FreeBSD >= 10.1
201
+ IPPROTO_UDPLITE: int
202
+ if sys.version_info >= (3, 10) and sys.platform == "linux":
203
+ IPPROTO_MPTCP: int
204
+
205
+ IPPORT_RESERVED: int
206
+ IPPORT_USERRESERVED: int
207
+
208
+ INADDR_ALLHOSTS_GROUP: int
209
+ INADDR_ANY: int
210
+ INADDR_BROADCAST: int
211
+ INADDR_LOOPBACK: int
212
+ INADDR_MAX_LOCAL_GROUP: int
213
+ INADDR_NONE: int
214
+ INADDR_UNSPEC_GROUP: int
215
+
216
+ IP_ADD_MEMBERSHIP: int
217
+ IP_DROP_MEMBERSHIP: int
218
+ IP_HDRINCL: int
219
+ IP_MULTICAST_IF: int
220
+ IP_MULTICAST_LOOP: int
221
+ IP_MULTICAST_TTL: int
222
+ IP_OPTIONS: int
223
+ if sys.platform != "linux":
224
+ IP_RECVDSTADDR: int
225
+ if sys.version_info >= (3, 10):
226
+ IP_RECVTOS: int
227
+ IP_TOS: int
228
+ IP_TTL: int
229
+ if sys.platform != "win32":
230
+ IP_DEFAULT_MULTICAST_LOOP: int
231
+ IP_DEFAULT_MULTICAST_TTL: int
232
+ IP_MAX_MEMBERSHIPS: int
233
+ IP_RECVOPTS: int
234
+ IP_RECVRETOPTS: int
235
+ IP_RETOPTS: int
236
+ if sys.platform != "win32" and sys.platform != "darwin":
237
+ IP_TRANSPARENT: int
238
+ if sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 11):
239
+ IP_BIND_ADDRESS_NO_PORT: int
240
+ if sys.version_info >= (3, 12):
241
+ IP_ADD_SOURCE_MEMBERSHIP: int
242
+ IP_BLOCK_SOURCE: int
243
+ IP_DROP_SOURCE_MEMBERSHIP: int
244
+ IP_PKTINFO: int
245
+ IP_UNBLOCK_SOURCE: int
246
+
247
+ IPV6_CHECKSUM: int
248
+ IPV6_JOIN_GROUP: int
249
+ IPV6_LEAVE_GROUP: int
250
+ IPV6_MULTICAST_HOPS: int
251
+ IPV6_MULTICAST_IF: int
252
+ IPV6_MULTICAST_LOOP: int
253
+ IPV6_RECVTCLASS: int
254
+ IPV6_TCLASS: int
255
+ IPV6_UNICAST_HOPS: int
256
+ IPV6_V6ONLY: int
257
+ if sys.version_info >= (3, 9) or sys.platform != "darwin":
258
+ IPV6_DONTFRAG: int
259
+ IPV6_HOPLIMIT: int
260
+ IPV6_HOPOPTS: int
261
+ IPV6_PKTINFO: int
262
+ IPV6_RECVRTHDR: int
263
+ IPV6_RTHDR: int
264
+ if sys.platform != "win32":
265
+ IPV6_RTHDR_TYPE_0: int
266
+ if sys.version_info >= (3, 9) or sys.platform != "darwin":
267
+ IPV6_DSTOPTS: int
268
+ IPV6_NEXTHOP: int
269
+ IPV6_PATHMTU: int
270
+ IPV6_RECVDSTOPTS: int
271
+ IPV6_RECVHOPLIMIT: int
272
+ IPV6_RECVHOPOPTS: int
273
+ IPV6_RECVPATHMTU: int
274
+ IPV6_RECVPKTINFO: int
275
+ IPV6_RTHDRDSTOPTS: int
276
+
277
+ if sys.platform != "win32" and sys.platform != "linux":
278
+ if sys.version_info >= (3, 9) or sys.platform != "darwin":
279
+ IPV6_USE_MIN_MTU: int
280
+
281
+ EAI_AGAIN: int
282
+ EAI_BADFLAGS: int
283
+ EAI_FAIL: int
284
+ EAI_FAMILY: int
285
+ EAI_MEMORY: int
286
+ EAI_NODATA: int
287
+ EAI_NONAME: int
288
+ EAI_SERVICE: int
289
+ EAI_SOCKTYPE: int
290
+ if sys.platform != "win32":
291
+ EAI_ADDRFAMILY: int
292
+ EAI_OVERFLOW: int
293
+ EAI_SYSTEM: int
294
+ if sys.platform != "win32" and sys.platform != "linux":
295
+ EAI_BADHINTS: int
296
+ EAI_MAX: int
297
+ EAI_PROTOCOL: int
298
+
299
+ AI_ADDRCONFIG: int
300
+ AI_ALL: int
301
+ AI_CANONNAME: int
302
+ AI_NUMERICHOST: int
303
+ AI_NUMERICSERV: int
304
+ AI_PASSIVE: int
305
+ AI_V4MAPPED: int
306
+ if sys.platform != "win32" and sys.platform != "linux":
307
+ AI_DEFAULT: int
308
+ AI_MASK: int
309
+ AI_V4MAPPED_CFG: int
310
+
311
+ NI_DGRAM: int
312
+ NI_MAXHOST: int
313
+ NI_MAXSERV: int
314
+ NI_NAMEREQD: int
315
+ NI_NOFQDN: int
316
+ NI_NUMERICHOST: int
317
+ NI_NUMERICSERV: int
318
+ if sys.platform == "linux" and sys.version_info >= (3, 13):
319
+ NI_IDN: int
320
+
321
+ TCP_FASTOPEN: int
322
+ TCP_KEEPCNT: int
323
+ TCP_KEEPINTVL: int
324
+ TCP_MAXSEG: int
325
+ TCP_NODELAY: int
326
+ if sys.platform != "win32":
327
+ TCP_NOTSENT_LOWAT: int
328
+ if sys.platform != "darwin":
329
+ TCP_KEEPIDLE: int
330
+ if sys.version_info >= (3, 10) and sys.platform == "darwin":
331
+ TCP_KEEPALIVE: int
332
+ if sys.version_info >= (3, 11) and sys.platform == "darwin":
333
+ TCP_CONNECTION_INFO: int
334
+
335
+ if sys.platform != "win32" and sys.platform != "darwin":
336
+ TCP_CONGESTION: int
337
+ TCP_CORK: int
338
+ TCP_DEFER_ACCEPT: int
339
+ TCP_INFO: int
340
+ TCP_LINGER2: int
341
+ TCP_QUICKACK: int
342
+ TCP_SYNCNT: int
343
+ TCP_USER_TIMEOUT: int
344
+ TCP_WINDOW_CLAMP: int
345
+ if sys.platform == "linux" and sys.version_info >= (3, 12):
346
+ TCP_CC_INFO: int
347
+ TCP_FASTOPEN_CONNECT: int
348
+ TCP_FASTOPEN_KEY: int
349
+ TCP_FASTOPEN_NO_COOKIE: int
350
+ TCP_INQ: int
351
+ TCP_MD5SIG: int
352
+ TCP_MD5SIG_EXT: int
353
+ TCP_QUEUE_SEQ: int
354
+ TCP_REPAIR: int
355
+ TCP_REPAIR_OPTIONS: int
356
+ TCP_REPAIR_QUEUE: int
357
+ TCP_REPAIR_WINDOW: int
358
+ TCP_SAVED_SYN: int
359
+ TCP_SAVE_SYN: int
360
+ TCP_THIN_DUPACK: int
361
+ TCP_THIN_LINEAR_TIMEOUTS: int
362
+ TCP_TIMESTAMP: int
363
+ TCP_TX_DELAY: int
364
+ TCP_ULP: int
365
+ TCP_ZEROCOPY_RECEIVE: int
366
+
367
+ # --------------------
368
+ # Specifically documented constants
369
+ # --------------------
370
+
371
+ if sys.platform == "linux":
372
+ # Availability: Linux >= 2.6.25, NetBSD >= 8
373
+ AF_CAN: int
374
+ PF_CAN: int
375
+ SOL_CAN_BASE: int
376
+ SOL_CAN_RAW: int
377
+ CAN_EFF_FLAG: int
378
+ CAN_EFF_MASK: int
379
+ CAN_ERR_FLAG: int
380
+ CAN_ERR_MASK: int
381
+ CAN_RAW: int
382
+ CAN_RAW_FILTER: int
383
+ CAN_RAW_LOOPBACK: int
384
+ CAN_RAW_RECV_OWN_MSGS: int
385
+ CAN_RTR_FLAG: int
386
+ CAN_SFF_MASK: int
387
+ if sys.version_info < (3, 11):
388
+ CAN_RAW_ERR_FILTER: int
389
+
390
+ if sys.platform == "linux":
391
+ # Availability: Linux >= 2.6.25
392
+ CAN_BCM: int
393
+ CAN_BCM_TX_SETUP: int
394
+ CAN_BCM_TX_DELETE: int
395
+ CAN_BCM_TX_READ: int
396
+ CAN_BCM_TX_SEND: int
397
+ CAN_BCM_RX_SETUP: int
398
+ CAN_BCM_RX_DELETE: int
399
+ CAN_BCM_RX_READ: int
400
+ CAN_BCM_TX_STATUS: int
401
+ CAN_BCM_TX_EXPIRED: int
402
+ CAN_BCM_RX_STATUS: int
403
+ CAN_BCM_RX_TIMEOUT: int
404
+ CAN_BCM_RX_CHANGED: int
405
+ CAN_BCM_SETTIMER: int
406
+ CAN_BCM_STARTTIMER: int
407
+ CAN_BCM_TX_COUNTEVT: int
408
+ CAN_BCM_TX_ANNOUNCE: int
409
+ CAN_BCM_TX_CP_CAN_ID: int
410
+ CAN_BCM_RX_FILTER_ID: int
411
+ CAN_BCM_RX_CHECK_DLC: int
412
+ CAN_BCM_RX_NO_AUTOTIMER: int
413
+ CAN_BCM_RX_ANNOUNCE_RESUME: int
414
+ CAN_BCM_TX_RESET_MULTI_IDX: int
415
+ CAN_BCM_RX_RTR_FRAME: int
416
+ CAN_BCM_CAN_FD_FRAME: int
417
+
418
+ if sys.platform == "linux":
419
+ # Availability: Linux >= 3.6
420
+ CAN_RAW_FD_FRAMES: int
421
+
422
+ if sys.platform == "linux" and sys.version_info >= (3, 9):
423
+ # Availability: Linux >= 4.1
424
+ CAN_RAW_JOIN_FILTERS: int
425
+
426
+ if sys.platform == "linux":
427
+ # Availability: Linux >= 2.6.25
428
+ CAN_ISOTP: int
429
+
430
+ if sys.platform == "linux" and sys.version_info >= (3, 9):
431
+ # Availability: Linux >= 5.4
432
+ CAN_J1939: int
433
+
434
+ J1939_MAX_UNICAST_ADDR: int
435
+ J1939_IDLE_ADDR: int
436
+ J1939_NO_ADDR: int
437
+ J1939_NO_NAME: int
438
+ J1939_PGN_REQUEST: int
439
+ J1939_PGN_ADDRESS_CLAIMED: int
440
+ J1939_PGN_ADDRESS_COMMANDED: int
441
+ J1939_PGN_PDU1_MAX: int
442
+ J1939_PGN_MAX: int
443
+ J1939_NO_PGN: int
444
+
445
+ SO_J1939_FILTER: int
446
+ SO_J1939_PROMISC: int
447
+ SO_J1939_SEND_PRIO: int
448
+ SO_J1939_ERRQUEUE: int
449
+
450
+ SCM_J1939_DEST_ADDR: int
451
+ SCM_J1939_DEST_NAME: int
452
+ SCM_J1939_PRIO: int
453
+ SCM_J1939_ERRQUEUE: int
454
+
455
+ J1939_NLA_PAD: int
456
+ J1939_NLA_BYTES_ACKED: int
457
+ J1939_EE_INFO_NONE: int
458
+ J1939_EE_INFO_TX_ABORT: int
459
+ J1939_FILTER_MAX: int
460
+
461
+ if sys.version_info >= (3, 12) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
462
+ # Availability: FreeBSD >= 14.0
463
+ AF_DIVERT: int
464
+ PF_DIVERT: int
465
+
466
+ if sys.platform == "linux":
467
+ # Availability: Linux >= 2.2
468
+ AF_PACKET: int
469
+ PF_PACKET: int
470
+ PACKET_BROADCAST: int
471
+ PACKET_FASTROUTE: int
472
+ PACKET_HOST: int
473
+ PACKET_LOOPBACK: int
474
+ PACKET_MULTICAST: int
475
+ PACKET_OTHERHOST: int
476
+ PACKET_OUTGOING: int
477
+
478
+ if sys.version_info >= (3, 12) and sys.platform == "linux":
479
+ ETH_P_ALL: int
480
+
481
+ if sys.platform == "linux":
482
+ # Availability: Linux >= 2.6.30
483
+ AF_RDS: int
484
+ PF_RDS: int
485
+ SOL_RDS: int
486
+ # These are present in include/linux/rds.h but don't always show up
487
+ # here.
488
+ RDS_CANCEL_SENT_TO: int
489
+ RDS_CMSG_RDMA_ARGS: int
490
+ RDS_CMSG_RDMA_DEST: int
491
+ RDS_CMSG_RDMA_MAP: int
492
+ RDS_CMSG_RDMA_STATUS: int
493
+ RDS_CONG_MONITOR: int
494
+ RDS_FREE_MR: int
495
+ RDS_GET_MR: int
496
+ RDS_GET_MR_FOR_DEST: int
497
+ RDS_RDMA_DONTWAIT: int
498
+ RDS_RDMA_FENCE: int
499
+ RDS_RDMA_INVALIDATE: int
500
+ RDS_RDMA_NOTIFY_ME: int
501
+ RDS_RDMA_READWRITE: int
502
+ RDS_RDMA_SILENT: int
503
+ RDS_RDMA_USE_ONCE: int
504
+ RDS_RECVERR: int
505
+
506
+ # This is supported by CPython but doesn't seem to be a real thing.
507
+ # The closest existing constant in rds.h is RDS_CMSG_CONG_UPDATE
508
+ # RDS_CMSG_RDMA_UPDATE: int
509
+
510
+ if sys.platform == "win32":
511
+ SIO_RCVALL: int
512
+ SIO_KEEPALIVE_VALS: int
513
+ SIO_LOOPBACK_FAST_PATH: int
514
+ RCVALL_MAX: int
515
+ RCVALL_OFF: int
516
+ RCVALL_ON: int
517
+ RCVALL_SOCKETLEVELONLY: int
518
+
519
+ if sys.platform == "linux":
520
+ AF_TIPC: int
521
+ SOL_TIPC: int
522
+ TIPC_ADDR_ID: int
523
+ TIPC_ADDR_NAME: int
524
+ TIPC_ADDR_NAMESEQ: int
525
+ TIPC_CFG_SRV: int
526
+ TIPC_CLUSTER_SCOPE: int
527
+ TIPC_CONN_TIMEOUT: int
528
+ TIPC_CRITICAL_IMPORTANCE: int
529
+ TIPC_DEST_DROPPABLE: int
530
+ TIPC_HIGH_IMPORTANCE: int
531
+ TIPC_IMPORTANCE: int
532
+ TIPC_LOW_IMPORTANCE: int
533
+ TIPC_MEDIUM_IMPORTANCE: int
534
+ TIPC_NODE_SCOPE: int
535
+ TIPC_PUBLISHED: int
536
+ TIPC_SRC_DROPPABLE: int
537
+ TIPC_SUBSCR_TIMEOUT: int
538
+ TIPC_SUB_CANCEL: int
539
+ TIPC_SUB_PORTS: int
540
+ TIPC_SUB_SERVICE: int
541
+ TIPC_TOP_SRV: int
542
+ TIPC_WAIT_FOREVER: int
543
+ TIPC_WITHDRAWN: int
544
+ TIPC_ZONE_SCOPE: int
545
+
546
+ if sys.platform == "linux":
547
+ # Availability: Linux >= 2.6.38
548
+ AF_ALG: int
549
+ SOL_ALG: int
550
+ ALG_OP_DECRYPT: int
551
+ ALG_OP_ENCRYPT: int
552
+ ALG_OP_SIGN: int
553
+ ALG_OP_VERIFY: int
554
+ ALG_SET_AEAD_ASSOCLEN: int
555
+ ALG_SET_AEAD_AUTHSIZE: int
556
+ ALG_SET_IV: int
557
+ ALG_SET_KEY: int
558
+ ALG_SET_OP: int
559
+ ALG_SET_PUBKEY: int
560
+
561
+ if sys.platform == "linux":
562
+ # Availability: Linux >= 4.8 (or maybe 3.9, CPython docs are confusing)
563
+ AF_VSOCK: int
564
+ IOCTL_VM_SOCKETS_GET_LOCAL_CID: int
565
+ VMADDR_CID_ANY: int
566
+ VMADDR_CID_HOST: int
567
+ VMADDR_PORT_ANY: int
568
+ SO_VM_SOCKETS_BUFFER_MAX_SIZE: int
569
+ SO_VM_SOCKETS_BUFFER_SIZE: int
570
+ SO_VM_SOCKETS_BUFFER_MIN_SIZE: int
571
+ VM_SOCKETS_INVALID_VERSION: int # undocumented
572
+
573
+ if sys.platform != "win32" or sys.version_info >= (3, 9):
574
+ # Documented as only available on BSD, macOS, but empirically sometimes
575
+ # available on Windows
576
+ if sys.platform != "linux":
577
+ AF_LINK: int
578
+
579
+ has_ipv6: bool
580
+
581
+ if sys.platform != "darwin" and sys.platform != "linux":
582
+ if sys.platform != "win32" or sys.version_info >= (3, 9):
583
+ BDADDR_ANY: str
584
+ BDADDR_LOCAL: str
585
+
586
+ if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
587
+ HCI_FILTER: int # not in NetBSD or DragonFlyBSD
588
+ HCI_TIME_STAMP: int # not in FreeBSD, NetBSD, or DragonFlyBSD
589
+ HCI_DATA_DIR: int # not in FreeBSD, NetBSD, or DragonFlyBSD
590
+
591
+ if sys.platform == "linux":
592
+ AF_QIPCRTR: int # Availability: Linux >= 4.7
593
+
594
+ if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
595
+ # FreeBSD
596
+ SCM_CREDS2: int
597
+ LOCAL_CREDS: int
598
+ LOCAL_CREDS_PERSISTENT: int
599
+
600
+ if sys.version_info >= (3, 11) and sys.platform == "linux":
601
+ SO_INCOMING_CPU: int # Availability: Linux >= 3.9
602
+
603
+ if sys.version_info >= (3, 12) and sys.platform == "win32":
604
+ # Availability: Windows
605
+ AF_HYPERV: int
606
+ HV_PROTOCOL_RAW: int
607
+ HVSOCKET_CONNECT_TIMEOUT: int
608
+ HVSOCKET_CONNECT_TIMEOUT_MAX: int
609
+ HVSOCKET_CONNECTED_SUSPEND: int
610
+ HVSOCKET_ADDRESS_FLAG_PASSTHRU: int
611
+ HV_GUID_ZERO: str
612
+ HV_GUID_WILDCARD: str
613
+ HV_GUID_BROADCAST: str
614
+ HV_GUID_CHILDREN: str
615
+ HV_GUID_LOOPBACK: str
616
+ HV_GUID_PARENT: str
617
+
618
+ if sys.version_info >= (3, 12):
619
+ if sys.platform != "win32":
620
+ # Availability: Linux, FreeBSD, macOS
621
+ ETHERTYPE_ARP: int
622
+ ETHERTYPE_IP: int
623
+ ETHERTYPE_IPV6: int
624
+ ETHERTYPE_VLAN: int
625
+
626
+ # --------------------
627
+ # Semi-documented constants
628
+ # These are alluded to under the "Socket families" section in the docs
629
+ # https://docs.python.org/3/library/socket.html#socket-families
630
+ # --------------------
631
+
632
+ if sys.platform == "linux":
633
+ # Netlink is defined by Linux
634
+ AF_NETLINK: int
635
+ NETLINK_CRYPTO: int
636
+ NETLINK_DNRTMSG: int
637
+ NETLINK_FIREWALL: int
638
+ NETLINK_IP6_FW: int
639
+ NETLINK_NFLOG: int
640
+ NETLINK_ROUTE: int
641
+ NETLINK_USERSOCK: int
642
+ NETLINK_XFRM: int
643
+ # Technically still supported by CPython
644
+ # NETLINK_ARPD: int # linux 2.0 to 2.6.12 (EOL August 2005)
645
+ # NETLINK_ROUTE6: int # linux 2.2 to 2.6.12 (EOL August 2005)
646
+ # NETLINK_SKIP: int # linux 2.0 to 2.6.12 (EOL August 2005)
647
+ # NETLINK_TAPBASE: int # linux 2.2 to 2.6.12 (EOL August 2005)
648
+ # NETLINK_TCPDIAG: int # linux 2.6.0 to 2.6.13 (EOL December 2005)
649
+ # NETLINK_W1: int # linux 2.6.13 to 2.6.17 (EOL October 2006)
650
+
651
+ if sys.platform == "darwin":
652
+ PF_SYSTEM: int
653
+ SYSPROTO_CONTROL: int
654
+
655
+ if sys.platform != "darwin" and sys.platform != "linux":
656
+ if sys.version_info >= (3, 9) or sys.platform != "win32":
657
+ AF_BLUETOOTH: int
658
+
659
+ if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
660
+ # Linux and some BSD support is explicit in the docs
661
+ # Windows and macOS do not support in practice
662
+ BTPROTO_HCI: int
663
+ BTPROTO_L2CAP: int
664
+ BTPROTO_SCO: int # not in FreeBSD
665
+ if sys.platform != "darwin" and sys.platform != "linux":
666
+ if sys.version_info >= (3, 9) or sys.platform != "win32":
667
+ BTPROTO_RFCOMM: int
668
+
669
+ if sys.version_info >= (3, 9) and sys.platform == "linux":
670
+ UDPLITE_RECV_CSCOV: int
671
+ UDPLITE_SEND_CSCOV: int
672
+
673
+ # --------------------
674
+ # Documented under socket.shutdown
675
+ # --------------------
676
+ SHUT_RD: int
677
+ SHUT_RDWR: int
678
+ SHUT_WR: int
679
+
680
+ # --------------------
681
+ # Undocumented constants
682
+ # --------------------
683
+
684
+ # Undocumented address families
685
+ AF_APPLETALK: int
686
+ AF_DECnet: int
687
+ AF_IPX: int
688
+ AF_SNA: int
689
+
690
+ if sys.platform != "win32":
691
+ AF_ROUTE: int
692
+
693
+ if sys.platform == "darwin":
694
+ AF_SYSTEM: int
695
+
696
+ if sys.platform != "darwin":
697
+ AF_IRDA: int
698
+
699
+ if sys.platform != "win32" and sys.platform != "darwin":
700
+ AF_ASH: int
701
+ AF_ATMPVC: int
702
+ AF_ATMSVC: int
703
+ AF_AX25: int
704
+ AF_BRIDGE: int
705
+ AF_ECONET: int
706
+ AF_KEY: int
707
+ AF_LLC: int
708
+ AF_NETBEUI: int
709
+ AF_NETROM: int
710
+ AF_PPPOX: int
711
+ AF_ROSE: int
712
+ AF_SECURITY: int
713
+ AF_WANPIPE: int
714
+ AF_X25: int
715
+
716
+ # Miscellaneous undocumented
717
+
718
+ if sys.platform != "win32" and sys.platform != "linux":
719
+ LOCAL_PEERCRED: int
720
+
721
+ if sys.platform != "win32" and sys.platform != "darwin":
722
+ # Defined in linux socket.h, but this isn't always present for
723
+ # some reason.
724
+ IPX_TYPE: int
725
+
726
+ # ===== Classes =====
727
+
728
+ class socket:
729
+ """
730
+ socket(family=AF_INET, type=SOCK_STREAM, proto=0) -> socket object
731
+ socket(family=-1, type=-1, proto=-1, fileno=None) -> socket object
732
+
733
+ Open a socket of the given type. The family argument specifies the
734
+ address family; it defaults to AF_INET. The type argument specifies
735
+ whether this is a stream (SOCK_STREAM, this is the default)
736
+ or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0,
737
+ specifying the default protocol. Keyword arguments are accepted.
738
+ The socket is created as non-inheritable.
739
+
740
+ When a fileno is passed in, family, type and proto are auto-detected,
741
+ unless they are explicitly set.
742
+
743
+ A socket object represents one endpoint of a network connection.
744
+
745
+ Methods of socket objects (keyword arguments not allowed):
746
+
747
+ _accept() -- accept connection, returning new socket fd and client address
748
+ bind(addr) -- bind the socket to a local address
749
+ close() -- close the socket
750
+ connect(addr) -- connect the socket to a remote address
751
+ connect_ex(addr) -- connect, return an error code instead of an exception
752
+ dup() -- return a new socket fd duplicated from fileno()
753
+ fileno() -- return underlying file descriptor
754
+ getpeername() -- return remote address [*]
755
+ getsockname() -- return local address
756
+ getsockopt(level, optname[, buflen]) -- get socket options
757
+ gettimeout() -- return timeout or None
758
+ listen([n]) -- start listening for incoming connections
759
+ recv(buflen[, flags]) -- receive data
760
+ recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)
761
+ recvfrom(buflen[, flags]) -- receive data and sender's address
762
+ recvfrom_into(buffer[, nbytes, [, flags])
763
+ -- receive data and sender's address (into a buffer)
764
+ sendall(data[, flags]) -- send all data
765
+ send(data[, flags]) -- send data, may not send all of it
766
+ sendto(data[, flags], addr) -- send data to a given address
767
+ setblocking(bool) -- set or clear the blocking I/O flag
768
+ getblocking() -- return True if socket is blocking, False if non-blocking
769
+ setsockopt(level, optname, value[, optlen]) -- set socket options
770
+ settimeout(None | float) -- set or clear the timeout
771
+ shutdown(how) -- shut down traffic in one or both directions
772
+
773
+ [*] not available on all platforms!
774
+ """
775
+ @property
776
+ def family(self) -> int:
777
+ """the socket family"""
778
+ ...
779
+ @property
780
+ def type(self) -> int:
781
+ """the socket type"""
782
+ ...
783
+ @property
784
+ def proto(self) -> int:
785
+ """the socket protocol"""
786
+ ...
787
+ # F811: "Redefinition of unused `timeout`"
788
+ @property
789
+ def timeout(self) -> float | None:
790
+ """the socket timeout"""
791
+ ...
792
+ if sys.platform == "win32":
793
+ def __init__(
794
+ self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | bytes | None = ...
795
+ ) -> None: ...
796
+ else:
797
+ def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | None = ...) -> None: ...
798
+
799
+ def bind(self, address: _Address, /) -> None:
800
+ """
801
+ bind(address)
802
+
803
+ Bind the socket to a local address. For IP sockets, the address is a
804
+ pair (host, port); the host must refer to the local host. For raw packet
805
+ sockets the address is a tuple (ifname, proto [,pkttype [,hatype [,addr]]])
806
+ """
807
+ ...
808
+ def close(self) -> None:
809
+ """
810
+ close()
811
+
812
+ Close the socket. It cannot be used after this call.
813
+ """
814
+ ...
815
+ def connect(self, address: _Address, /) -> None:
816
+ """
817
+ connect(address)
818
+
819
+ Connect the socket to a remote address. For IP sockets, the address
820
+ is a pair (host, port).
821
+ """
822
+ ...
823
+ def connect_ex(self, address: _Address, /) -> int:
824
+ """
825
+ connect_ex(address) -> errno
826
+
827
+ This is like connect(address), but returns an error code (the errno value)
828
+ instead of raising an exception when an error occurs.
829
+ """
830
+ ...
831
+ def detach(self) -> int:
832
+ """
833
+ detach()
834
+
835
+ Close the socket object without closing the underlying file descriptor.
836
+ The object cannot be used after this call, but the file descriptor
837
+ can be reused for other purposes. The file descriptor is returned.
838
+ """
839
+ ...
840
+ def fileno(self) -> int:
841
+ """
842
+ fileno() -> integer
843
+
844
+ Return the integer file descriptor of the socket.
845
+ """
846
+ ...
847
+ def getpeername(self) -> _RetAddress:
848
+ """
849
+ getpeername() -> address info
850
+
851
+ Return the address of the remote endpoint. For IP sockets, the address
852
+ info is a pair (hostaddr, port).
853
+ """
854
+ ...
855
+ def getsockname(self) -> _RetAddress:
856
+ """
857
+ getsockname() -> address info
858
+
859
+ Return the address of the local endpoint. The format depends on the
860
+ address family. For IPv4 sockets, the address info is a pair
861
+ (hostaddr, port). For IPv6 sockets, the address info is a 4-tuple
862
+ (hostaddr, port, flowinfo, scope_id).
863
+ """
864
+ ...
865
+ @overload
866
+ def getsockopt(self, level: int, optname: int, /) -> int:
867
+ """
868
+ getsockopt(level, option[, buffersize]) -> value
869
+
870
+ Get a socket option. See the Unix manual for level and option.
871
+ If a nonzero buffersize argument is given, the return value is a
872
+ string of that length; otherwise it is an integer.
873
+ """
874
+ ...
875
+ @overload
876
+ def getsockopt(self, level: int, optname: int, buflen: int, /) -> bytes:
877
+ """
878
+ getsockopt(level, option[, buffersize]) -> value
879
+
880
+ Get a socket option. See the Unix manual for level and option.
881
+ If a nonzero buffersize argument is given, the return value is a
882
+ string of that length; otherwise it is an integer.
883
+ """
884
+ ...
885
+ def getblocking(self) -> bool:
886
+ """
887
+ getblocking()
888
+
889
+ Returns True if socket is in blocking mode, or False if it
890
+ is in non-blocking mode.
891
+ """
892
+ ...
893
+ def gettimeout(self) -> float | None:
894
+ """
895
+ gettimeout() -> timeout
896
+
897
+ Returns the timeout in seconds (float) associated with socket
898
+ operations. A timeout of None indicates that timeouts on socket
899
+ operations are disabled.
900
+ """
901
+ ...
902
+ if sys.platform == "win32":
903
+ def ioctl(self, control: int, option: int | tuple[int, int, int] | bool, /) -> None: ...
904
+
905
+ def listen(self, backlog: int = ..., /) -> None:
906
+ """
907
+ listen([backlog])
908
+
909
+ Enable a server to accept connections. If backlog is specified, it must be
910
+ at least 0 (if it is lower, it is set to 0); it specifies the number of
911
+ unaccepted connections that the system will allow before refusing new
912
+ connections. If not specified, a default reasonable value is chosen.
913
+ """
914
+ ...
915
+ def recv(self, bufsize: int, flags: int = ..., /) -> bytes:
916
+ """
917
+ recv(buffersize[, flags]) -> data
918
+
919
+ Receive up to buffersize bytes from the socket. For the optional flags
920
+ argument, see the Unix manual. When no data is available, block until
921
+ at least one byte is available or until the remote end is closed. When
922
+ the remote end is closed and all data is read, return the empty string.
923
+ """
924
+ ...
925
+ def recvfrom(self, bufsize: int, flags: int = ..., /) -> tuple[bytes, _RetAddress]:
926
+ """
927
+ recvfrom(buffersize[, flags]) -> (data, address info)
928
+
929
+ Like recv(buffersize, flags) but also return the sender's address info.
930
+ """
931
+ ...
932
+ if sys.platform != "win32":
933
+ def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]:
934
+ """
935
+ recvmsg(bufsize[, ancbufsize[, flags]]) -> (data, ancdata, msg_flags, address)
936
+
937
+ Receive normal data (up to bufsize bytes) and ancillary data from the
938
+ socket. The ancbufsize argument sets the size in bytes of the
939
+ internal buffer used to receive the ancillary data; it defaults to 0,
940
+ meaning that no ancillary data will be received. Appropriate buffer
941
+ sizes for ancillary data can be calculated using CMSG_SPACE() or
942
+ CMSG_LEN(), and items which do not fit into the buffer might be
943
+ truncated or discarded. The flags argument defaults to 0 and has the
944
+ same meaning as for recv().
945
+
946
+ The return value is a 4-tuple: (data, ancdata, msg_flags, address).
947
+ The data item is a bytes object holding the non-ancillary data
948
+ received. The ancdata item is a list of zero or more tuples
949
+ (cmsg_level, cmsg_type, cmsg_data) representing the ancillary data
950
+ (control messages) received: cmsg_level and cmsg_type are integers
951
+ specifying the protocol level and protocol-specific type respectively,
952
+ and cmsg_data is a bytes object holding the associated data. The
953
+ msg_flags item is the bitwise OR of various flags indicating
954
+ conditions on the received message; see your system documentation for
955
+ details. If the receiving socket is unconnected, address is the
956
+ address of the sending socket, if available; otherwise, its value is
957
+ unspecified.
958
+
959
+ If recvmsg() raises an exception after the system call returns, it
960
+ will first attempt to close any file descriptors received via the
961
+ SCM_RIGHTS mechanism.
962
+ """
963
+ ...
964
+ def recvmsg_into(
965
+ self, buffers: Iterable[WriteableBuffer], ancbufsize: int = ..., flags: int = ..., /
966
+ ) -> tuple[int, list[_CMSG], int, Any]:
967
+ """
968
+ recvmsg_into(buffers[, ancbufsize[, flags]]) -> (nbytes, ancdata, msg_flags, address)
969
+
970
+ Receive normal data and ancillary data from the socket, scattering the
971
+ non-ancillary data into a series of buffers. The buffers argument
972
+ must be an iterable of objects that export writable buffers
973
+ (e.g. bytearray objects); these will be filled with successive chunks
974
+ of the non-ancillary data until it has all been written or there are
975
+ no more buffers. The ancbufsize argument sets the size in bytes of
976
+ the internal buffer used to receive the ancillary data; it defaults to
977
+ 0, meaning that no ancillary data will be received. Appropriate
978
+ buffer sizes for ancillary data can be calculated using CMSG_SPACE()
979
+ or CMSG_LEN(), and items which do not fit into the buffer might be
980
+ truncated or discarded. The flags argument defaults to 0 and has the
981
+ same meaning as for recv().
982
+
983
+ The return value is a 4-tuple: (nbytes, ancdata, msg_flags, address).
984
+ The nbytes item is the total number of bytes of non-ancillary data
985
+ written into the buffers. The ancdata item is a list of zero or more
986
+ tuples (cmsg_level, cmsg_type, cmsg_data) representing the ancillary
987
+ data (control messages) received: cmsg_level and cmsg_type are
988
+ integers specifying the protocol level and protocol-specific type
989
+ respectively, and cmsg_data is a bytes object holding the associated
990
+ data. The msg_flags item is the bitwise OR of various flags
991
+ indicating conditions on the received message; see your system
992
+ documentation for details. If the receiving socket is unconnected,
993
+ address is the address of the sending socket, if available; otherwise,
994
+ its value is unspecified.
995
+
996
+ If recvmsg_into() raises an exception after the system call returns,
997
+ it will first attempt to close any file descriptors received via the
998
+ SCM_RIGHTS mechanism.
999
+ """
1000
+ ...
1001
+
1002
+ def recvfrom_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]:
1003
+ """
1004
+ recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
1005
+
1006
+ Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
1007
+ """
1008
+ ...
1009
+ def recv_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> int:
1010
+ """
1011
+ recv_into(buffer, [nbytes[, flags]]) -> nbytes_read
1012
+
1013
+ A version of recv() that stores its data into a buffer rather than creating
1014
+ a new string. Receive up to buffersize bytes from the socket. If buffersize
1015
+ is not specified (or 0), receive up to the size available in the given buffer.
1016
+
1017
+ See recv() for documentation about the flags.
1018
+ """
1019
+ ...
1020
+ def send(self, data: ReadableBuffer, flags: int = ..., /) -> int:
1021
+ """
1022
+ send(data[, flags]) -> count
1023
+
1024
+ Send a data string to the socket. For the optional flags
1025
+ argument, see the Unix manual. Return the number of bytes
1026
+ sent; this may be less than len(data) if the network is busy.
1027
+ """
1028
+ ...
1029
+ def sendall(self, data: ReadableBuffer, flags: int = ..., /) -> None:
1030
+ """
1031
+ sendall(data[, flags])
1032
+
1033
+ Send a data string to the socket. For the optional flags
1034
+ argument, see the Unix manual. This calls send() repeatedly
1035
+ until all data is sent. If an error occurs, it's impossible
1036
+ to tell how much data has been sent.
1037
+ """
1038
+ ...
1039
+ @overload
1040
+ def sendto(self, data: ReadableBuffer, address: _Address, /) -> int:
1041
+ """
1042
+ sendto(data[, flags], address) -> count
1043
+
1044
+ Like send(data, flags) but allows specifying the destination address.
1045
+ For IP sockets, the address is a pair (hostaddr, port).
1046
+ """
1047
+ ...
1048
+ @overload
1049
+ def sendto(self, data: ReadableBuffer, flags: int, address: _Address, /) -> int:
1050
+ """
1051
+ sendto(data[, flags], address) -> count
1052
+
1053
+ Like send(data, flags) but allows specifying the destination address.
1054
+ For IP sockets, the address is a pair (hostaddr, port).
1055
+ """
1056
+ ...
1057
+ if sys.platform != "win32":
1058
+ def sendmsg(
1059
+ self,
1060
+ buffers: Iterable[ReadableBuffer],
1061
+ ancdata: Iterable[_CMSGArg] = ...,
1062
+ flags: int = ...,
1063
+ address: _Address | None = ...,
1064
+ /,
1065
+ ) -> int:
1066
+ """
1067
+ sendmsg(buffers[, ancdata[, flags[, address]]]) -> count
1068
+
1069
+ Send normal and ancillary data to the socket, gathering the
1070
+ non-ancillary data from a series of buffers and concatenating it into
1071
+ a single message. The buffers argument specifies the non-ancillary
1072
+ data as an iterable of bytes-like objects (e.g. bytes objects).
1073
+ The ancdata argument specifies the ancillary data (control messages)
1074
+ as an iterable of zero or more tuples (cmsg_level, cmsg_type,
1075
+ cmsg_data), where cmsg_level and cmsg_type are integers specifying the
1076
+ protocol level and protocol-specific type respectively, and cmsg_data
1077
+ is a bytes-like object holding the associated data. The flags
1078
+ argument defaults to 0 and has the same meaning as for send(). If
1079
+ address is supplied and not None, it sets a destination address for
1080
+ the message. The return value is the number of bytes of non-ancillary
1081
+ data sent.
1082
+ """
1083
+ ...
1084
+ if sys.platform == "linux":
1085
+ def sendmsg_afalg(
1086
+ self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
1087
+ ) -> int: ...
1088
+
1089
+ def setblocking(self, flag: bool, /) -> None:
1090
+ """
1091
+ setblocking(flag)
1092
+
1093
+ Set the socket to blocking (flag is true) or non-blocking (false).
1094
+ setblocking(True) is equivalent to settimeout(None);
1095
+ setblocking(False) is equivalent to settimeout(0.0).
1096
+ """
1097
+ ...
1098
+ def settimeout(self, value: float | None, /) -> None:
1099
+ """
1100
+ settimeout(timeout)
1101
+
1102
+ Set a timeout on socket operations. 'timeout' can be a float,
1103
+ giving in seconds, or None. Setting a timeout of None disables
1104
+ the timeout feature and is equivalent to setblocking(1).
1105
+ Setting a timeout of zero is the same as setblocking(0).
1106
+ """
1107
+ ...
1108
+ @overload
1109
+ def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer, /) -> None:
1110
+ """
1111
+ setsockopt(level, option, value: int)
1112
+ setsockopt(level, option, value: buffer)
1113
+ setsockopt(level, option, None, optlen: int)
1114
+
1115
+ Set a socket option. See the Unix manual for level and option.
1116
+ The value argument can either be an integer, a string buffer, or
1117
+ None, optlen.
1118
+ """
1119
+ ...
1120
+ @overload
1121
+ def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None:
1122
+ """
1123
+ setsockopt(level, option, value: int)
1124
+ setsockopt(level, option, value: buffer)
1125
+ setsockopt(level, option, None, optlen: int)
1126
+
1127
+ Set a socket option. See the Unix manual for level and option.
1128
+ The value argument can either be an integer, a string buffer, or
1129
+ None, optlen.
1130
+ """
1131
+ ...
1132
+ if sys.platform == "win32":
1133
+ def share(self, process_id: int, /) -> bytes: ...
1134
+
1135
+ def shutdown(self, how: int, /) -> None:
1136
+ """
1137
+ shutdown(flag)
1138
+
1139
+ Shut down the reading side of the socket (flag == SHUT_RD), the writing side
1140
+ of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
1141
+ """
1142
+ ...
1143
+
1144
+ SocketType = socket
1145
+
1146
+ # ===== Functions =====
1147
+
1148
+ def close(fd: SupportsIndex, /) -> None:
1149
+ """
1150
+ close(integer) -> None
1151
+
1152
+ Close an integer socket file descriptor. This is like os.close(), but for
1153
+ sockets; on some platforms os.close() won't work for socket file descriptors.
1154
+ """
1155
+ ...
1156
+ def dup(fd: SupportsIndex, /) -> int:
1157
+ """
1158
+ dup(integer) -> integer
1159
+
1160
+ Duplicate an integer socket file descriptor. This is like os.dup(), but for
1161
+ sockets; on some platforms os.dup() won't work for socket file descriptors.
1162
+ """
1163
+ ...
1164
+
1165
+ # the 5th tuple item is an address
1166
+ def getaddrinfo(
1167
+ host: bytes | str | None,
1168
+ port: bytes | str | int | None,
1169
+ family: int = ...,
1170
+ type: int = ...,
1171
+ proto: int = ...,
1172
+ flags: int = ...,
1173
+ ) -> list[tuple[int, int, int, str, tuple[str, int] | tuple[str, int, int, int]]]:
1174
+ """
1175
+ getaddrinfo(host, port [, family, type, proto, flags])
1176
+ -> list of (family, type, proto, canonname, sockaddr)
1177
+
1178
+ Resolve host and port into addrinfo struct.
1179
+ """
1180
+ ...
1181
+ def gethostbyname(hostname: str, /) -> str:
1182
+ """
1183
+ gethostbyname(host) -> address
1184
+
1185
+ Return the IP address (a string of the form '255.255.255.255') for a host.
1186
+ """
1187
+ ...
1188
+ def gethostbyname_ex(hostname: str, /) -> tuple[str, list[str], list[str]]:
1189
+ """
1190
+ gethostbyname_ex(host) -> (name, aliaslist, addresslist)
1191
+
1192
+ Return the true host name, a list of aliases, and a list of IP addresses,
1193
+ for a host. The host argument is a string giving a host name or IP number.
1194
+ """
1195
+ ...
1196
+ def gethostname() -> str:
1197
+ """
1198
+ gethostname() -> string
1199
+
1200
+ Return the current host name.
1201
+ """
1202
+ ...
1203
+ def gethostbyaddr(ip_address: str, /) -> tuple[str, list[str], list[str]]:
1204
+ """
1205
+ gethostbyaddr(host) -> (name, aliaslist, addresslist)
1206
+
1207
+ Return the true host name, a list of aliases, and a list of IP addresses,
1208
+ for a host. The host argument is a string giving a host name or IP number.
1209
+ """
1210
+ ...
1211
+ def getnameinfo(sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int, /) -> tuple[str, str]:
1212
+ """
1213
+ getnameinfo(sockaddr, flags) --> (host, port)
1214
+
1215
+ Get host and port for a sockaddr.
1216
+ """
1217
+ ...
1218
+ def getprotobyname(protocolname: str, /) -> int:
1219
+ """
1220
+ getprotobyname(name) -> integer
1221
+
1222
+ Return the protocol number for the named protocol. (Rarely used.)
1223
+ """
1224
+ ...
1225
+ def getservbyname(servicename: str, protocolname: str = ..., /) -> int:
1226
+ """
1227
+ getservbyname(servicename[, protocolname]) -> integer
1228
+
1229
+ Return a port number from a service name and protocol name.
1230
+ The optional protocol name, if given, should be 'tcp' or 'udp',
1231
+ otherwise any protocol will match.
1232
+ """
1233
+ ...
1234
+ def getservbyport(port: int, protocolname: str = ..., /) -> str:
1235
+ """
1236
+ getservbyport(port[, protocolname]) -> string
1237
+
1238
+ Return the service name from a port number and protocol name.
1239
+ The optional protocol name, if given, should be 'tcp' or 'udp',
1240
+ otherwise any protocol will match.
1241
+ """
1242
+ ...
1243
+ def ntohl(x: int, /) -> int:
1244
+ """
1245
+ ntohl(integer) -> integer
1246
+
1247
+ Convert a 32-bit integer from network to host byte order.
1248
+ """
1249
+ ...
1250
+ def ntohs(x: int, /) -> int:
1251
+ """Convert a 16-bit unsigned integer from network to host byte order."""
1252
+ ...
1253
+ def htonl(x: int, /) -> int:
1254
+ """
1255
+ htonl(integer) -> integer
1256
+
1257
+ Convert a 32-bit integer from host to network byte order.
1258
+ """
1259
+ ...
1260
+ def htons(x: int, /) -> int:
1261
+ """Convert a 16-bit unsigned integer from host to network byte order."""
1262
+ ...
1263
+ def inet_aton(ip_addr: str, /) -> bytes:
1264
+ """Convert an IP address in string format (123.45.67.89) to the 32-bit packed binary format used in low-level network functions."""
1265
+ ...
1266
+ def inet_ntoa(packed_ip: ReadableBuffer, /) -> str:
1267
+ """Convert an IP address from 32-bit packed binary format to string format."""
1268
+ ...
1269
+ def inet_pton(address_family: int, ip_string: str, /) -> bytes:
1270
+ """
1271
+ inet_pton(af, ip) -> packed IP address string
1272
+
1273
+ Convert an IP address from string format to a packed string suitable
1274
+ for use with low-level network functions.
1275
+ """
1276
+ ...
1277
+ def inet_ntop(address_family: int, packed_ip: ReadableBuffer, /) -> str:
1278
+ """
1279
+ inet_ntop(af, packed_ip) -> string formatted IP address
1280
+
1281
+ Convert a packed IP address of the given family to string format.
1282
+ """
1283
+ ...
1284
+ def getdefaulttimeout() -> float | None:
1285
+ """
1286
+ getdefaulttimeout() -> timeout
1287
+
1288
+ Returns the default timeout in seconds (float) for new socket objects.
1289
+ A value of None indicates that new socket objects have no timeout.
1290
+ When the socket module is first imported, the default is None.
1291
+ """
1292
+ ...
1293
+
1294
+ # F811: "Redefinition of unused `timeout`"
1295
+ def setdefaulttimeout(timeout: float | None, /) -> None:
1296
+ """
1297
+ setdefaulttimeout(timeout)
1298
+
1299
+ Set the default timeout in seconds (float) for new socket objects.
1300
+ A value of None indicates that new socket objects have no timeout.
1301
+ When the socket module is first imported, the default is None.
1302
+ """
1303
+ ...
1304
+
1305
+ if sys.platform != "win32":
1306
+ def sethostname(name: str, /) -> None:
1307
+ """
1308
+ sethostname(name)
1309
+
1310
+ Sets the hostname to name.
1311
+ """
1312
+ ...
1313
+ def CMSG_LEN(length: int, /) -> int:
1314
+ """
1315
+ CMSG_LEN(length) -> control message length
1316
+
1317
+ Return the total length, without trailing padding, of an ancillary
1318
+ data item with associated data of the given length. This value can
1319
+ often be used as the buffer size for recvmsg() to receive a single
1320
+ item of ancillary data, but RFC 3542 requires portable applications to
1321
+ use CMSG_SPACE() and thus include space for padding, even when the
1322
+ item will be the last in the buffer. Raises OverflowError if length
1323
+ is outside the permissible range of values.
1324
+ """
1325
+ ...
1326
+ def CMSG_SPACE(length: int, /) -> int:
1327
+ """
1328
+ CMSG_SPACE(length) -> buffer size
1329
+
1330
+ Return the buffer size needed for recvmsg() to receive an ancillary
1331
+ data item with associated data of the given length, along with any
1332
+ trailing padding. The buffer space needed to receive multiple items
1333
+ is the sum of the CMSG_SPACE() values for their associated data
1334
+ lengths. Raises OverflowError if length is outside the permissible
1335
+ range of values.
1336
+ """
1337
+ ...
1338
+ def socketpair(family: int = ..., type: int = ..., proto: int = ..., /) -> tuple[socket, socket]:
1339
+ """
1340
+ socketpair([family[, type [, proto]]]) -> (socket object, socket object)
1341
+
1342
+ Create a pair of socket objects from the sockets returned by the platform
1343
+ socketpair() function.
1344
+ The arguments are the same as for socket() except the default family is
1345
+ AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
1346
+ """
1347
+ ...
1348
+
1349
+ def if_nameindex() -> list[tuple[int, str]]:
1350
+ """
1351
+ if_nameindex()
1352
+
1353
+ Returns a list of network interface information (index, name) tuples.
1354
+ """
1355
+ ...
1356
+ def if_nametoindex(oname: str, /) -> int:
1357
+ """Returns the interface index corresponding to the interface name if_name."""
1358
+ ...
1359
+ def if_indextoname(index: int, /) -> str:
1360
+ """
1361
+ if_indextoname(if_index)
1362
+
1363
+ Returns the interface name corresponding to the interface index if_index.
1364
+ """
1365
+ ...
1366
+
1367
+ CAPI: CapsuleType