basedpyright 1.10.3 → 1.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.map +1 -1
  3. package/dist/pyright.js +1 -1
  4. package/dist/pyright.js.map +1 -1
  5. package/dist/typeshed-fallback/commit.txt +1 -1
  6. package/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi +7 -2
  7. package/dist/typeshed-fallback/stdlib/asyncio/constants.pyi +3 -3
  8. package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +4 -4
  9. package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +9 -9
  10. package/dist/typeshed-fallback/stdlib/asyncio/streams.pyi +10 -5
  11. package/dist/typeshed-fallback/stdlib/contextlib.pyi +23 -22
  12. package/dist/typeshed-fallback/stdlib/email/message.pyi +26 -27
  13. package/dist/typeshed-fallback/stdlib/email/parser.pyi +25 -15
  14. package/dist/typeshed-fallback/stdlib/http/__init__.pyi +68 -68
  15. package/dist/typeshed-fallback/stdlib/http/client.pyi +7 -21
  16. package/dist/typeshed-fallback/stdlib/inspect.pyi +24 -24
  17. package/dist/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi +2 -2
  18. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +2 -2
  19. package/dist/typeshed-fallback/stdlib/plistlib.pyi +2 -2
  20. package/dist/typeshed-fallback/stdlib/pstats.pyi +9 -9
  21. package/dist/typeshed-fallback/stdlib/py_compile.pyi +3 -3
  22. package/dist/typeshed-fallback/stdlib/signal.pyi +46 -46
  23. package/dist/typeshed-fallback/stdlib/socket.pyi +75 -75
  24. package/dist/typeshed-fallback/stdlib/ssl.pyi +81 -81
  25. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +38 -38
  26. package/dist/typeshed-fallback/stdlib/typing.pyi +22 -14
  27. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +1 -1
  28. package/dist/typeshed-fallback/stdlib/uuid.pyi +3 -3
  29. package/dist/typeshed-fallback/stdlib/winreg.pyi +75 -46
  30. package/dist/typeshed-fallback/stubs/Pillow/METADATA.toml +1 -0
  31. package/dist/typeshed-fallback/stubs/Pillow/PIL/BlpImagePlugin.pyi +7 -7
  32. package/dist/typeshed-fallback/stubs/Pillow/PIL/ExifTags.pyi +331 -331
  33. package/dist/typeshed-fallback/stubs/Pillow/PIL/FtexImagePlugin.pyi +2 -2
  34. package/dist/typeshed-fallback/stubs/Pillow/PIL/Image.pyi +28 -28
  35. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageCms.pyi +7 -7
  36. package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFont.pyi +2 -2
  37. package/dist/typeshed-fallback/stubs/Pillow/PIL/PngImagePlugin.pyi +5 -5
  38. package/dist/typeshed-fallback/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/reservoir.pyi +3 -3
  39. package/dist/typeshed-fallback/stubs/boltons/METADATA.toml +1 -1
  40. package/dist/typeshed-fallback/stubs/boltons/boltons/ecoutils.pyi +0 -1
  41. package/dist/typeshed-fallback/stubs/boltons/boltons/funcutils.pyi +15 -0
  42. package/dist/typeshed-fallback/stubs/boltons/boltons/ioutils.pyi +0 -2
  43. package/dist/typeshed-fallback/stubs/boltons/boltons/strutils.pyi +4 -6
  44. package/dist/typeshed-fallback/stubs/boltons/boltons/urlutils.pyi +2 -0
  45. package/dist/typeshed-fallback/stubs/capturer/METADATA.toml +2 -0
  46. package/dist/typeshed-fallback/stubs/capturer/capturer.pyi +122 -0
  47. package/dist/typeshed-fallback/stubs/croniter/croniter/croniter.pyi +1 -1
  48. package/dist/typeshed-fallback/stubs/dateparser/METADATA.toml +1 -1
  49. package/dist/typeshed-fallback/stubs/dateparser/dateparser/utils/__init__.pyi +1 -0
  50. package/dist/typeshed-fallback/stubs/docker/METADATA.toml +3 -0
  51. package/dist/typeshed-fallback/stubs/docker/docker/__init__.pyi +7 -0
  52. package/dist/typeshed-fallback/stubs/docker/docker/api/__init__.pyi +1 -0
  53. package/dist/typeshed-fallback/stubs/docker/docker/api/build.pyi +55 -0
  54. package/dist/typeshed-fallback/stubs/docker/docker/api/client.pyi +55 -0
  55. package/dist/typeshed-fallback/stubs/docker/docker/api/config.pyi +7 -0
  56. package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +109 -0
  57. package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +23 -0
  58. package/dist/typeshed-fallback/stubs/docker/docker/api/exec_api.pyi +22 -0
  59. package/dist/typeshed-fallback/stubs/docker/docker/api/image.pyi +59 -0
  60. package/dist/typeshed-fallback/stubs/docker/docker/api/network.pyi +34 -0
  61. package/dist/typeshed-fallback/stubs/docker/docker/api/plugin.pyi +14 -0
  62. package/dist/typeshed-fallback/stubs/docker/docker/api/secret.pyi +7 -0
  63. package/dist/typeshed-fallback/stubs/docker/docker/api/service.pyi +47 -0
  64. package/dist/typeshed-fallback/stubs/docker/docker/api/swarm.pyi +41 -0
  65. package/dist/typeshed-fallback/stubs/docker/docker/api/volume.pyi +14 -0
  66. package/dist/typeshed-fallback/stubs/docker/docker/auth.pyi +40 -0
  67. package/dist/typeshed-fallback/stubs/docker/docker/client.pyi +49 -0
  68. package/dist/typeshed-fallback/stubs/docker/docker/constants.pyi +22 -0
  69. package/dist/typeshed-fallback/stubs/docker/docker/context/__init__.pyi +2 -0
  70. package/dist/typeshed-fallback/stubs/docker/docker/context/api.pyi +30 -0
  71. package/dist/typeshed-fallback/stubs/docker/docker/context/config.pyi +10 -0
  72. package/dist/typeshed-fallback/stubs/docker/docker/context/context.pyi +47 -0
  73. package/dist/typeshed-fallback/stubs/docker/docker/credentials/__init__.pyi +8 -0
  74. package/dist/typeshed-fallback/stubs/docker/docker/credentials/constants.pyi +4 -0
  75. package/dist/typeshed-fallback/stubs/docker/docker/credentials/errors.pyi +7 -0
  76. package/dist/typeshed-fallback/stubs/docker/docker/credentials/store.pyi +11 -0
  77. package/dist/typeshed-fallback/stubs/docker/docker/credentials/utils.pyi +1 -0
  78. package/dist/typeshed-fallback/stubs/docker/docker/errors.pyi +71 -0
  79. package/dist/typeshed-fallback/stubs/docker/docker/models/__init__.pyi +0 -0
  80. package/dist/typeshed-fallback/stubs/docker/docker/models/configs.pyi +13 -0
  81. package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +81 -0
  82. package/dist/typeshed-fallback/stubs/docker/docker/models/images.pyi +43 -0
  83. package/dist/typeshed-fallback/stubs/docker/docker/models/networks.pyi +19 -0
  84. package/dist/typeshed-fallback/stubs/docker/docker/models/nodes.pyi +13 -0
  85. package/dist/typeshed-fallback/stubs/docker/docker/models/plugins.pyi +25 -0
  86. package/dist/typeshed-fallback/stubs/docker/docker/models/resource.pyi +27 -0
  87. package/dist/typeshed-fallback/stubs/docker/docker/models/secrets.pyi +13 -0
  88. package/dist/typeshed-fallback/stubs/docker/docker/models/services.pyi +27 -0
  89. package/dist/typeshed-fallback/stubs/docker/docker/models/swarm.pyi +33 -0
  90. package/dist/typeshed-fallback/stubs/docker/docker/models/volumes.pyi +16 -0
  91. package/dist/typeshed-fallback/stubs/docker/docker/tls.pyi +10 -0
  92. package/dist/typeshed-fallback/stubs/docker/docker/transport/__init__.pyi +4 -0
  93. package/dist/typeshed-fallback/stubs/docker/docker/transport/basehttpadapter.pyi +4 -0
  94. package/dist/typeshed-fallback/stubs/docker/docker/transport/npipeconn.pyi +29 -0
  95. package/dist/typeshed-fallback/stubs/docker/docker/transport/npipesocket.pyi +49 -0
  96. package/dist/typeshed-fallback/stubs/docker/docker/transport/sshconn.pyi +49 -0
  97. package/dist/typeshed-fallback/stubs/docker/docker/transport/unixconn.pyi +31 -0
  98. package/dist/typeshed-fallback/stubs/docker/docker/types/__init__.pyi +35 -0
  99. package/dist/typeshed-fallback/stubs/docker/docker/types/base.pyi +5 -0
  100. package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +164 -0
  101. package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +6 -0
  102. package/dist/typeshed-fallback/stubs/docker/docker/types/healthcheck.pyi +24 -0
  103. package/dist/typeshed-fallback/stubs/docker/docker/types/networks.pyi +31 -0
  104. package/dist/typeshed-fallback/stubs/docker/docker/types/services.pyi +170 -0
  105. package/dist/typeshed-fallback/stubs/docker/docker/types/swarm.pyi +29 -0
  106. package/dist/typeshed-fallback/stubs/docker/docker/utils/__init__.pyi +32 -0
  107. package/dist/typeshed-fallback/stubs/docker/docker/utils/build.pyi +38 -0
  108. package/dist/typeshed-fallback/stubs/docker/docker/utils/config.pyi +10 -0
  109. package/dist/typeshed-fallback/stubs/docker/docker/utils/decorators.pyi +3 -0
  110. package/dist/typeshed-fallback/stubs/docker/docker/utils/fnmatch.pyi +5 -0
  111. package/dist/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi +10 -0
  112. package/dist/typeshed-fallback/stubs/docker/docker/utils/ports.pyi +9 -0
  113. package/dist/typeshed-fallback/stubs/docker/docker/utils/proxy.pyi +33 -0
  114. package/dist/typeshed-fallback/stubs/docker/docker/utils/socket.pyi +18 -0
  115. package/dist/typeshed-fallback/stubs/docker/docker/utils/utils.pyi +34 -0
  116. package/dist/typeshed-fallback/stubs/docker/docker/version.pyi +1 -0
  117. package/dist/typeshed-fallback/stubs/docutils/METADATA.toml +1 -1
  118. package/dist/typeshed-fallback/stubs/docutils/docutils/frontend.pyi +55 -11
  119. package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +1 -1
  120. package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/tableparser.pyi +1 -1
  121. package/dist/typeshed-fallback/stubs/docutils/docutils/statemachine.pyi +3 -2
  122. package/dist/typeshed-fallback/stubs/editdistance/METADATA.toml +1 -1
  123. package/dist/typeshed-fallback/stubs/editdistance/editdistance/__init__.pyi +2 -0
  124. package/dist/typeshed-fallback/stubs/flake8-bugbear/METADATA.toml +1 -1
  125. package/dist/typeshed-fallback/stubs/flake8-builtins/METADATA.toml +1 -1
  126. package/dist/typeshed-fallback/stubs/fpdf2/fpdf/enums.pyi +163 -163
  127. package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +5 -0
  128. package/dist/typeshed-fallback/stubs/hdbcli/hdbcli/dbapi.pyi +2 -1
  129. package/dist/typeshed-fallback/stubs/icalendar/METADATA.toml +3 -0
  130. package/dist/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi +40 -0
  131. package/dist/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi +86 -0
  132. package/dist/typeshed-fallback/stubs/icalendar/icalendar/caselessdict.pyi +43 -0
  133. package/dist/typeshed-fallback/stubs/icalendar/icalendar/parser.pyi +58 -0
  134. package/dist/typeshed-fallback/stubs/icalendar/icalendar/parser_tools.pyi +17 -0
  135. package/dist/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi +225 -0
  136. package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone_cache.pyi +0 -0
  137. package/dist/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi +10 -0
  138. package/dist/typeshed-fallback/stubs/icalendar/icalendar/windows_to_olson.pyi +3 -0
  139. package/dist/typeshed-fallback/stubs/influxdb-client/METADATA.toml +1 -1
  140. package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/flux_csv_parser.pyi +5 -5
  141. package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/write_api.pyi +3 -3
  142. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/centrality/betweenness.pyi +9 -7
  143. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/centrality/betweenness_subset.pyi +8 -3
  144. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/centrality/closeness.pyi +11 -4
  145. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/centrality/degree_alg.pyi +4 -3
  146. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/centrality/dispersion.pyi +5 -6
  147. package/dist/typeshed-fallback/stubs/networkx/networkx/convert.pyi +5 -5
  148. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi +7 -2
  149. package/dist/typeshed-fallback/stubs/paramiko/paramiko/client.pyi +4 -3
  150. package/dist/typeshed-fallback/stubs/paramiko/paramiko/config.pyi +2 -1
  151. package/dist/typeshed-fallback/stubs/paramiko/paramiko/dsskey.pyi +3 -3
  152. package/dist/typeshed-fallback/stubs/paramiko/paramiko/ecdsakey.pyi +3 -3
  153. package/dist/typeshed-fallback/stubs/paramiko/paramiko/ed25519key.pyi +2 -2
  154. package/dist/typeshed-fallback/stubs/paramiko/paramiko/hostkeys.pyi +4 -3
  155. package/dist/typeshed-fallback/stubs/paramiko/paramiko/pkey.pyi +4 -3
  156. package/dist/typeshed-fallback/stubs/paramiko/paramiko/primes.pyi +3 -1
  157. package/dist/typeshed-fallback/stubs/paramiko/paramiko/rsakey.pyi +3 -3
  158. package/dist/typeshed-fallback/stubs/paramiko/paramiko/sftp_server.pyi +2 -1
  159. package/dist/typeshed-fallback/stubs/paramiko/paramiko/transport.pyi +2 -1
  160. package/dist/typeshed-fallback/stubs/paramiko/paramiko/util.pyi +3 -3
  161. package/dist/typeshed-fallback/stubs/peewee/METADATA.toml +9 -1
  162. package/dist/typeshed-fallback/stubs/peewee/peewee.pyi +53 -22
  163. package/dist/typeshed-fallback/stubs/peewee/playhouse/__init__.pyi +0 -0
  164. package/dist/typeshed-fallback/stubs/peewee/playhouse/flask_utils.pyi +28 -0
  165. package/dist/typeshed-fallback/stubs/pika/pika/delivery_mode.pyi +2 -2
  166. package/dist/typeshed-fallback/stubs/pika/pika/exchange_type.pyi +4 -4
  167. package/dist/typeshed-fallback/stubs/protobuf/METADATA.toml +4 -2
  168. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/any_pb2.pyi +13 -8
  169. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/api_pb2.pyi +25 -19
  170. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi +51 -17
  171. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor.pyi +84 -82
  172. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +743 -161
  173. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pool.pyi +3 -7
  174. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/duration_pb2.pyi +4 -3
  175. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/empty_pb2.pyi +2 -2
  176. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/field_mask_pb2.pyi +5 -3
  177. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/internal/builder.pyi +2 -3
  178. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/internal/containers.pyi +6 -5
  179. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/internal/decoder.pyi +3 -3
  180. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/internal/well_known_types.pyi +5 -7
  181. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/json_format.pyi +19 -19
  182. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/message.pyi +3 -3
  183. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/message_factory.pyi +2 -2
  184. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/source_context_pb2.pyi +4 -3
  185. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/struct_pb2.pyi +17 -12
  186. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/text_format.pyi +94 -92
  187. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/timestamp_pb2.pyi +5 -6
  188. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/type_pb2.pyi +43 -20
  189. package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/wrappers_pb2.pyi +50 -19
  190. package/dist/typeshed-fallback/stubs/psutil/psutil/_common.pyi +5 -5
  191. package/dist/typeshed-fallback/stubs/psutil/psutil/_pslinux.pyi +4 -4
  192. package/dist/typeshed-fallback/stubs/psutil/psutil/_psutil_windows.pyi +8 -6
  193. package/dist/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi +10 -10
  194. package/dist/typeshed-fallback/stubs/psycopg2/psycopg2/_psycopg.pyi +3 -3
  195. package/dist/typeshed-fallback/stubs/psycopg2/psycopg2/pool.pyi +2 -2
  196. package/dist/typeshed-fallback/stubs/pyOpenSSL/METADATA.toml +1 -1
  197. package/dist/typeshed-fallback/stubs/pyOpenSSL/OpenSSL/SSL.pyi +2 -3
  198. package/dist/typeshed-fallback/stubs/pycurl/METADATA.toml +2 -13
  199. package/dist/typeshed-fallback/stubs/pycurl/pycurl.pyi +669 -639
  200. package/dist/typeshed-fallback/stubs/pyinstaller/METADATA.toml +1 -1
  201. package/dist/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/build_main.pyi +2 -1
  202. package/dist/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/splash.pyi +19 -1
  203. package/dist/typeshed-fallback/stubs/pynput/pynput/keyboard/_base.pyi +64 -64
  204. package/dist/typeshed-fallback/stubs/pynput/pynput/mouse/_base.pyi +33 -33
  205. package/dist/typeshed-fallback/stubs/python-crontab/crontab.pyi +4 -4
  206. package/dist/typeshed-fallback/stubs/pytz/pytz/lazy.pyi +11 -7
  207. package/dist/typeshed-fallback/stubs/pywin32/win32comext/propsys/propsys.pyi +1 -1
  208. package/dist/typeshed-fallback/stubs/qrbill/METADATA.toml +3 -0
  209. package/dist/typeshed-fallback/stubs/qrbill/qrbill/__init__.pyi +1 -0
  210. package/dist/typeshed-fallback/stubs/qrbill/qrbill/bill.pyi +180 -0
  211. package/dist/typeshed-fallback/stubs/qrcode/qrcode/constants.pyi +6 -4
  212. package/dist/typeshed-fallback/stubs/qrcode/qrcode/main.pyi +68 -18
  213. package/dist/typeshed-fallback/stubs/qrcode/qrcode/util.pyi +24 -13
  214. package/dist/typeshed-fallback/stubs/redis/redis/asyncio/client.pyi +7 -7
  215. package/dist/typeshed-fallback/stubs/redis/redis/asyncio/cluster.pyi +56 -5
  216. package/dist/typeshed-fallback/stubs/redis/redis/asyncio/connection.pyi +210 -128
  217. package/dist/typeshed-fallback/stubs/redis/redis/asyncio/sentinel.pyi +141 -48
  218. package/dist/typeshed-fallback/stubs/redis/redis/cluster.pyi +1 -1
  219. package/dist/typeshed-fallback/stubs/redis/redis/commands/cluster.pyi +1 -1
  220. package/dist/typeshed-fallback/stubs/redis/redis/typing.pyi +2 -2
  221. package/dist/typeshed-fallback/stubs/regex/METADATA.toml +1 -1
  222. package/dist/typeshed-fallback/stubs/regex/regex/_regex_core.pyi +34 -34
  223. package/dist/typeshed-fallback/stubs/requests-oauthlib/requests_oauthlib/oauth2_session.pyi +1 -3
  224. package/dist/typeshed-fallback/stubs/s2clientprotocol/METADATA.toml +3 -0
  225. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi +25 -23
  226. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi +31 -28
  227. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi +53 -48
  228. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi +1 -0
  229. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi +33 -32
  230. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi +85 -71
  231. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi +246 -197
  232. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi +31 -16
  233. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi +75 -34
  234. package/dist/typeshed-fallback/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi +61 -59
  235. package/dist/typeshed-fallback/stubs/seaborn/seaborn/_core/groupby.pyi +2 -2
  236. package/dist/typeshed-fallback/stubs/seaborn/seaborn/_core/plot.pyi +1 -1
  237. package/dist/typeshed-fallback/stubs/seaborn/seaborn/_core/scales.pyi +3 -3
  238. package/dist/typeshed-fallback/stubs/seaborn/seaborn/_core/typing.pyi +1 -1
  239. package/dist/typeshed-fallback/stubs/seaborn/seaborn/axisgrid.pyi +1 -1
  240. package/dist/typeshed-fallback/stubs/seaborn/seaborn/categorical.pyi +12 -13
  241. package/dist/typeshed-fallback/stubs/seaborn/seaborn/matrix.pyi +5 -7
  242. package/dist/typeshed-fallback/stubs/seaborn/seaborn/utils.pyi +1 -3
  243. package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
  244. package/dist/typeshed-fallback/stubs/setuptools/distutils/_modified.pyi +1 -0
  245. package/dist/typeshed-fallback/stubs/setuptools/distutils/command/bdist.pyi +1 -0
  246. package/dist/typeshed-fallback/stubs/setuptools/distutils/command/install_lib.pyi +1 -0
  247. package/dist/typeshed-fallback/stubs/setuptools/distutils/compat/__init__.pyi +1 -0
  248. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +1 -1
  249. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/bdist.pyi +25 -0
  250. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/register.pyi +13 -0
  251. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/sdist.pyi +10 -1
  252. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/upload.pyi +13 -1
  253. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/compat/__init__.pyi +1 -0
  254. package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/editable_wheel.pyi +3 -3
  255. package/dist/typeshed-fallback/stubs/tqdm/tqdm/contrib/discord.pyi +1 -6
  256. package/dist/typeshed-fallback/stubs/tqdm/tqdm/contrib/slack.pyi +3 -1
  257. package/dist/typeshed-fallback/stubs/tqdm/tqdm/contrib/telegram.pyi +3 -1
  258. package/dist/typeshed-fallback/stubs/tqdm/tqdm/rich.pyi +3 -3
  259. package/dist/typeshed-fallback/stubs/waitress/METADATA.toml +1 -4
  260. package/dist/typeshed-fallback/stubs/waitress/waitress/__init__.pyi +16 -5
  261. package/dist/typeshed-fallback/stubs/waitress/waitress/adjustments.pyi +12 -9
  262. package/dist/typeshed-fallback/stubs/waitress/waitress/buffers.pyi +8 -9
  263. package/dist/typeshed-fallback/stubs/waitress/waitress/channel.pyi +14 -11
  264. package/dist/typeshed-fallback/stubs/waitress/waitress/compat.pyi +6 -28
  265. package/dist/typeshed-fallback/stubs/waitress/waitress/parser.pyi +3 -2
  266. package/dist/typeshed-fallback/stubs/waitress/waitress/proxy_headers.pyi +12 -11
  267. package/dist/typeshed-fallback/stubs/waitress/waitress/rfc7230.pyi +27 -12
  268. package/dist/typeshed-fallback/stubs/waitress/waitress/runner.pyi +6 -5
  269. package/dist/typeshed-fallback/stubs/waitress/waitress/server.pyi +40 -37
  270. package/dist/typeshed-fallback/stubs/waitress/waitress/task.pyi +11 -10
  271. package/dist/typeshed-fallback/stubs/waitress/waitress/trigger.pyi +4 -3
  272. package/dist/typeshed-fallback/stubs/waitress/waitress/utilities.pyi +11 -11
  273. package/dist/typeshed-fallback/stubs/waitress/waitress/wasyncore.pyi +31 -34
  274. package/package.json +1 -1
  275. package/dist/typeshed-fallback/stubs/tzlocal/METADATA.toml +0 -4
  276. package/dist/typeshed-fallback/stubs/tzlocal/tzlocal/__init__.pyi +0 -8
  277. package/dist/typeshed-fallback/stubs/tzlocal/tzlocal/utils.pyi +0 -4
  278. package/dist/typeshed-fallback/stubs/tzlocal/tzlocal/windows_tz.pyi +0 -4
@@ -1 +1 @@
1
- 8d1dcdbd29e72508cb9e1c4f26d916c23ab2f478
1
+ 7ed91bc2e77ec18d28307dc6086a778ecc9c7bb3
@@ -47,10 +47,15 @@ AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True) # noqa: Y001
47
47
  # isn't possible or a type is already partially known. In cases like these,
48
48
  # use Incomplete instead of Any as a marker. For example, use
49
49
  # "Incomplete | None" instead of "Any | None".
50
- Incomplete: TypeAlias = Any
50
+ Incomplete: TypeAlias = Any # stable
51
51
 
52
52
  # To describe a function parameter that is unused and will work with anything.
53
- Unused: TypeAlias = object
53
+ Unused: TypeAlias = object # stable
54
+
55
+ # Marker for return types that include None, but where forcing the user to
56
+ # check for None can be detrimental. Sometimes called "the Any trick". See
57
+ # CONTRIBUTING.md for more information.
58
+ MaybeNone: TypeAlias = Any # stable
54
59
 
55
60
  # Used to mark arguments that default to a sentinel value. This prevents
56
61
  # stubtest from complaining about the default value not matching.
@@ -15,6 +15,6 @@ if sys.version_info >= (3, 12):
15
15
  THREAD_JOIN_TIMEOUT: Literal[300]
16
16
 
17
17
  class _SendfileMode(enum.Enum):
18
- UNSUPPORTED: int
19
- TRY_NATIVE: int
20
- FALLBACK: int
18
+ UNSUPPORTED = 1
19
+ TRY_NATIVE = 2
20
+ FALLBACK = 3
@@ -101,10 +101,10 @@ class BoundedSemaphore(Semaphore): ...
101
101
 
102
102
  if sys.version_info >= (3, 11):
103
103
  class _BarrierState(enum.Enum): # undocumented
104
- FILLING: str
105
- DRAINING: str
106
- RESETTING: str
107
- BROKEN: str
104
+ FILLING = "filling"
105
+ DRAINING = "draining"
106
+ RESETTING = "resetting"
107
+ BROKEN = "broken"
108
108
 
109
109
  class Barrier(_LoopBoundMixin):
110
110
  def __init__(self, parties: int) -> None: ...
@@ -14,17 +14,17 @@ if sys.version_info >= (3, 11):
14
14
  SSLAgainErrors: tuple[type[ssl.SSLWantReadError], type[ssl.SSLSyscallError]]
15
15
 
16
16
  class SSLProtocolState(Enum):
17
- UNWRAPPED: str
18
- DO_HANDSHAKE: str
19
- WRAPPED: str
20
- FLUSHING: str
21
- SHUTDOWN: str
17
+ UNWRAPPED = "UNWRAPPED"
18
+ DO_HANDSHAKE = "DO_HANDSHAKE"
19
+ WRAPPED = "WRAPPED"
20
+ FLUSHING = "FLUSHING"
21
+ SHUTDOWN = "SHUTDOWN"
22
22
 
23
23
  class AppProtocolState(Enum):
24
- STATE_INIT: str
25
- STATE_CON_MADE: str
26
- STATE_EOF: str
27
- STATE_CON_LOST: str
24
+ STATE_INIT = "STATE_INIT"
25
+ STATE_CON_MADE = "STATE_CON_MADE"
26
+ STATE_EOF = "STATE_EOF"
27
+ STATE_CON_LOST = "STATE_CON_LOST"
28
28
 
29
29
  def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ...
30
30
 
@@ -1,8 +1,8 @@
1
1
  import ssl
2
2
  import sys
3
- from _typeshed import StrPath
4
- from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence
5
- from typing import Any, SupportsIndex
3
+ from _typeshed import ReadableBuffer, StrPath
4
+ from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence, Sized
5
+ from typing import Any, Protocol, SupportsIndex
6
6
  from typing_extensions import Self, TypeAlias
7
7
 
8
8
  from . import events, protocols, transports
@@ -23,6 +23,8 @@ else:
23
23
 
24
24
  _ClientConnectedCallback: TypeAlias = Callable[[StreamReader, StreamWriter], Awaitable[None] | None]
25
25
 
26
+ class _ReaduntilBuffer(ReadableBuffer, Sized, Protocol): ...
27
+
26
28
  if sys.version_info >= (3, 10):
27
29
  async def open_connection(
28
30
  host: str | None = None,
@@ -140,8 +142,11 @@ class StreamReader(AsyncIterator[bytes]):
140
142
  def at_eof(self) -> bool: ...
141
143
  def feed_data(self, data: Iterable[SupportsIndex]) -> None: ...
142
144
  async def readline(self) -> bytes: ...
143
- # Can be any buffer that supports len(); consider changing to a Protocol if PEP 688 is accepted
144
- async def readuntil(self, separator: bytes | bytearray | memoryview = b"\n") -> bytes: ...
145
+ if sys.version_info >= (3, 13):
146
+ async def readuntil(self, separator: _ReaduntilBuffer | tuple[_ReaduntilBuffer, ...] = b"\n") -> bytes: ...
147
+ else:
148
+ async def readuntil(self, separator: _ReaduntilBuffer = b"\n") -> bytes: ...
149
+
145
150
  async def read(self, n: int = -1) -> bytes: ...
146
151
  async def readexactly(self, n: int) -> bytes: ...
147
152
  def __aiter__(self) -> Self: ...
@@ -31,32 +31,33 @@ if sys.version_info >= (3, 11):
31
31
  _T = TypeVar("_T")
32
32
  _T_co = TypeVar("_T_co", covariant=True)
33
33
  _T_io = TypeVar("_T_io", bound=IO[str] | None)
34
+ _ExitT_co = TypeVar("_ExitT_co", covariant=True, bound=bool | None, default=bool | None)
34
35
  _F = TypeVar("_F", bound=Callable[..., Any])
35
36
  _P = ParamSpec("_P")
36
37
 
37
38
  _ExitFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool | None]
38
- _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any] | _ExitFunc)
39
+ _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc)
39
40
 
40
41
  @runtime_checkable
41
- class AbstractContextManager(Protocol[_T_co]):
42
+ class AbstractContextManager(Protocol[_T_co, _ExitT_co]):
42
43
  def __enter__(self) -> _T_co: ...
43
44
  @abstractmethod
44
45
  def __exit__(
45
46
  self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
46
- ) -> bool | None: ...
47
+ ) -> _ExitT_co: ...
47
48
 
48
49
  @runtime_checkable
49
- class AbstractAsyncContextManager(Protocol[_T_co]):
50
+ class AbstractAsyncContextManager(Protocol[_T_co, _ExitT_co]):
50
51
  async def __aenter__(self) -> _T_co: ...
51
52
  @abstractmethod
52
53
  async def __aexit__(
53
54
  self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
54
- ) -> bool | None: ...
55
+ ) -> _ExitT_co: ...
55
56
 
56
57
  class ContextDecorator:
57
58
  def __call__(self, func: _F) -> _F: ...
58
59
 
59
- class _GeneratorContextManager(AbstractContextManager[_T_co], ContextDecorator):
60
+ class _GeneratorContextManager(AbstractContextManager[_T_co, bool | None], ContextDecorator):
60
61
  # __init__ and all instance attributes are actually inherited from _GeneratorContextManagerBase
61
62
  # _GeneratorContextManagerBase is more trouble than it's worth to include in the stub; see #6676
62
63
  def __init__(self, func: Callable[..., Iterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
@@ -81,7 +82,7 @@ if sys.version_info >= (3, 10):
81
82
  class AsyncContextDecorator:
82
83
  def __call__(self, func: _AF) -> _AF: ...
83
84
 
84
- class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co], AsyncContextDecorator):
85
+ class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co, bool | None], AsyncContextDecorator):
85
86
  # __init__ and these attributes are actually defined in the base class _GeneratorContextManagerBase,
86
87
  # which is more trouble than it's worth to include in the stub (see #6676)
87
88
  def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
@@ -94,7 +95,7 @@ if sys.version_info >= (3, 10):
94
95
  ) -> bool | None: ...
95
96
 
96
97
  else:
97
- class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co]):
98
+ class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co, bool | None]):
98
99
  def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
99
100
  gen: AsyncGenerator[_T_co, Any]
100
101
  func: Callable[..., AsyncGenerator[_T_co, Any]]
@@ -111,7 +112,7 @@ class _SupportsClose(Protocol):
111
112
 
112
113
  _SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose)
113
114
 
114
- class closing(AbstractContextManager[_SupportsCloseT]):
115
+ class closing(AbstractContextManager[_SupportsCloseT, None]):
115
116
  def __init__(self, thing: _SupportsCloseT) -> None: ...
116
117
  def __exit__(self, *exc_info: Unused) -> None: ...
117
118
 
@@ -121,17 +122,17 @@ if sys.version_info >= (3, 10):
121
122
 
122
123
  _SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose)
123
124
 
124
- class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]):
125
+ class aclosing(AbstractAsyncContextManager[_SupportsAcloseT, None]):
125
126
  def __init__(self, thing: _SupportsAcloseT) -> None: ...
126
127
  async def __aexit__(self, *exc_info: Unused) -> None: ...
127
128
 
128
- class suppress(AbstractContextManager[None]):
129
+ class suppress(AbstractContextManager[None, bool]):
129
130
  def __init__(self, *exceptions: type[BaseException]) -> None: ...
130
131
  def __exit__(
131
132
  self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
132
133
  ) -> bool: ...
133
134
 
134
- class _RedirectStream(AbstractContextManager[_T_io]):
135
+ class _RedirectStream(AbstractContextManager[_T_io, None]):
135
136
  def __init__(self, new_target: _T_io) -> None: ...
136
137
  def __exit__(
137
138
  self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
@@ -142,8 +143,8 @@ class redirect_stderr(_RedirectStream[_T_io]): ...
142
143
 
143
144
  # In reality this is a subclass of `AbstractContextManager`;
144
145
  # see #7961 for why we don't do that in the stub
145
- class ExitStack(metaclass=abc.ABCMeta):
146
- def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ...
146
+ class ExitStack(Generic[_ExitT_co], metaclass=abc.ABCMeta):
147
+ def enter_context(self, cm: AbstractContextManager[_T, _ExitT_co]) -> _T: ...
147
148
  def push(self, exit: _CM_EF) -> _CM_EF: ...
148
149
  def callback(self, callback: Callable[_P, _T], /, *args: _P.args, **kwds: _P.kwargs) -> Callable[_P, _T]: ...
149
150
  def pop_all(self) -> Self: ...
@@ -151,18 +152,18 @@ class ExitStack(metaclass=abc.ABCMeta):
151
152
  def __enter__(self) -> Self: ...
152
153
  def __exit__(
153
154
  self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
154
- ) -> bool: ...
155
+ ) -> _ExitT_co: ...
155
156
 
156
157
  _ExitCoroFunc: TypeAlias = Callable[
157
158
  [type[BaseException] | None, BaseException | None, TracebackType | None], Awaitable[bool | None]
158
159
  ]
159
- _ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any] | _ExitCoroFunc)
160
+ _ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any, Any] | _ExitCoroFunc)
160
161
 
161
162
  # In reality this is a subclass of `AbstractAsyncContextManager`;
162
163
  # see #7961 for why we don't do that in the stub
163
- class AsyncExitStack(metaclass=abc.ABCMeta):
164
- def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ...
165
- async def enter_async_context(self, cm: AbstractAsyncContextManager[_T]) -> _T: ...
164
+ class AsyncExitStack(Generic[_ExitT_co], metaclass=abc.ABCMeta):
165
+ def enter_context(self, cm: AbstractContextManager[_T, _ExitT_co]) -> _T: ...
166
+ async def enter_async_context(self, cm: AbstractAsyncContextManager[_T, _ExitT_co]) -> _T: ...
166
167
  def push(self, exit: _CM_EF) -> _CM_EF: ...
167
168
  def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ...
168
169
  def callback(self, callback: Callable[_P, _T], /, *args: _P.args, **kwds: _P.kwargs) -> Callable[_P, _T]: ...
@@ -177,7 +178,7 @@ class AsyncExitStack(metaclass=abc.ABCMeta):
177
178
  ) -> bool: ...
178
179
 
179
180
  if sys.version_info >= (3, 10):
180
- class nullcontext(AbstractContextManager[_T], AbstractAsyncContextManager[_T]):
181
+ class nullcontext(AbstractContextManager[_T, None], AbstractAsyncContextManager[_T, None]):
181
182
  enter_result: _T
182
183
  @overload
183
184
  def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
@@ -189,7 +190,7 @@ if sys.version_info >= (3, 10):
189
190
  async def __aexit__(self, *exctype: Unused) -> None: ...
190
191
 
191
192
  else:
192
- class nullcontext(AbstractContextManager[_T]):
193
+ class nullcontext(AbstractContextManager[_T, None]):
193
194
  enter_result: _T
194
195
  @overload
195
196
  def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
@@ -201,7 +202,7 @@ else:
201
202
  if sys.version_info >= (3, 11):
202
203
  _T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=FileDescriptorOrPath)
203
204
 
204
- class chdir(AbstractContextManager[None], Generic[_T_fd_or_any_path]):
205
+ class chdir(AbstractContextManager[None, None], Generic[_T_fd_or_any_path]):
205
206
  path: _T_fd_or_any_path
206
207
  def __init__(self, path: _T_fd_or_any_path) -> None: ...
207
208
  def __enter__(self) -> None: ...
@@ -3,22 +3,25 @@ from email import _ParamsType, _ParamType
3
3
  from email.charset import Charset
4
4
  from email.contentmanager import ContentManager
5
5
  from email.errors import MessageDefect
6
- from email.header import Header
7
6
  from email.policy import Policy
8
- from typing import Any, Literal, Protocol, TypeVar, overload
7
+ from typing import Any, Generic, Literal, Protocol, TypeVar, overload
9
8
  from typing_extensions import Self, TypeAlias
10
9
 
11
10
  __all__ = ["Message", "EmailMessage"]
12
11
 
13
12
  _T = TypeVar("_T")
13
+ # Type returned by Policy.header_fetch_parse, often str or Header.
14
+ _HeaderT = TypeVar("_HeaderT", default=str)
15
+ _HeaderParamT = TypeVar("_HeaderParamT", default=str)
16
+ # Represents headers constructed by HeaderRegistry. Those are sub-classes
17
+ # of BaseHeader and another header type.
18
+ _HeaderRegistryT = TypeVar("_HeaderRegistryT", default=Any)
19
+ _HeaderRegistryParamT = TypeVar("_HeaderRegistryParamT", default=Any)
20
+
14
21
  _PayloadType: TypeAlias = Message | str
15
22
  _EncodedPayloadType: TypeAlias = Message | bytes
16
23
  _MultipartPayloadType: TypeAlias = list[_PayloadType]
17
24
  _CharsetType: TypeAlias = Charset | str | None
18
- # Type returned by Policy.header_fetch_parse, often str or Header.
19
- _HeaderType: TypeAlias = Any
20
- # Type accepted by Policy.header_store_parse.
21
- _HeaderTypeParam: TypeAlias = str | Header | Any
22
25
 
23
26
  class _SupportsEncodeToPayload(Protocol):
24
27
  def encode(self, encoding: str, /) -> _PayloadType | _MultipartPayloadType | _SupportsDecodeToPayload: ...
@@ -26,10 +29,7 @@ class _SupportsEncodeToPayload(Protocol):
26
29
  class _SupportsDecodeToPayload(Protocol):
27
30
  def decode(self, encoding: str, errors: str, /) -> _PayloadType | _MultipartPayloadType: ...
28
31
 
29
- # TODO: This class should be generic over the header policy and/or the header
30
- # value types allowed by the policy. This depends on PEP 696 support
31
- # (https://github.com/python/typeshed/issues/11422).
32
- class Message:
32
+ class Message(Generic[_HeaderT, _HeaderParamT]):
33
33
  policy: Policy # undocumented
34
34
  preamble: str | None
35
35
  epilogue: str | None
@@ -70,24 +70,23 @@ class Message:
70
70
  # Same as `get` with `failobj=None`, but with the expectation that it won't return None in most scenarios
71
71
  # This is important for protocols using __getitem__, like SupportsKeysAndGetItem
72
72
  # Morally, the return type should be `AnyOf[_HeaderType, None]`,
73
- # which we could spell as `_HeaderType | Any`,
74
- # *but* `_HeaderType` itself is currently an alias to `Any`...
75
- def __getitem__(self, name: str) -> _HeaderType: ...
76
- def __setitem__(self, name: str, val: _HeaderTypeParam) -> None: ...
73
+ # so using "the Any trick" instead.
74
+ def __getitem__(self, name: str) -> _HeaderT | Any: ...
75
+ def __setitem__(self, name: str, val: _HeaderParamT) -> None: ...
77
76
  def __delitem__(self, name: str) -> None: ...
78
77
  def keys(self) -> list[str]: ...
79
- def values(self) -> list[_HeaderType]: ...
80
- def items(self) -> list[tuple[str, _HeaderType]]: ...
78
+ def values(self) -> list[_HeaderT]: ...
79
+ def items(self) -> list[tuple[str, _HeaderT]]: ...
81
80
  @overload
82
- def get(self, name: str, failobj: None = None) -> _HeaderType | None: ...
81
+ def get(self, name: str, failobj: None = None) -> _HeaderT | None: ...
83
82
  @overload
84
- def get(self, name: str, failobj: _T) -> _HeaderType | _T: ...
83
+ def get(self, name: str, failobj: _T) -> _HeaderT | _T: ...
85
84
  @overload
86
- def get_all(self, name: str, failobj: None = None) -> list[_HeaderType] | None: ...
85
+ def get_all(self, name: str, failobj: None = None) -> list[_HeaderT] | None: ...
87
86
  @overload
88
- def get_all(self, name: str, failobj: _T) -> list[_HeaderType] | _T: ...
87
+ def get_all(self, name: str, failobj: _T) -> list[_HeaderT] | _T: ...
89
88
  def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ...
90
- def replace_header(self, _name: str, _value: _HeaderTypeParam) -> None: ...
89
+ def replace_header(self, _name: str, _value: _HeaderParamT) -> None: ...
91
90
  def get_content_type(self) -> str: ...
92
91
  def get_content_maintype(self) -> str: ...
93
92
  def get_content_subtype(self) -> str: ...
@@ -141,14 +140,14 @@ class Message:
141
140
  ) -> None: ...
142
141
  def __init__(self, policy: Policy = ...) -> None: ...
143
142
  # The following two methods are undocumented, but a source code comment states that they are public API
144
- def set_raw(self, name: str, value: _HeaderTypeParam) -> None: ...
145
- def raw_items(self) -> Iterator[tuple[str, _HeaderType]]: ...
143
+ def set_raw(self, name: str, value: _HeaderParamT) -> None: ...
144
+ def raw_items(self) -> Iterator[tuple[str, _HeaderT]]: ...
146
145
 
147
- class MIMEPart(Message):
146
+ class MIMEPart(Message[_HeaderRegistryT, _HeaderRegistryParamT]):
148
147
  def __init__(self, policy: Policy | None = None) -> None: ...
149
- def get_body(self, preferencelist: Sequence[str] = ("related", "html", "plain")) -> Message | None: ...
150
- def iter_attachments(self) -> Iterator[Message]: ...
151
- def iter_parts(self) -> Iterator[Message]: ...
148
+ def get_body(self, preferencelist: Sequence[str] = ("related", "html", "plain")) -> MIMEPart[_HeaderRegistryT] | None: ...
149
+ def iter_attachments(self) -> Iterator[MIMEPart[_HeaderRegistryT]]: ...
150
+ def iter_parts(self) -> Iterator[MIMEPart[_HeaderRegistryT]]: ...
152
151
  def get_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> Any: ...
153
152
  def set_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> None: ...
154
153
  def make_related(self, boundary: str | None = None) -> None: ...
@@ -3,24 +3,34 @@ from collections.abc import Callable
3
3
  from email.feedparser import BytesFeedParser as BytesFeedParser, FeedParser as FeedParser
4
4
  from email.message import Message
5
5
  from email.policy import Policy
6
- from typing import IO
6
+ from io import _WrappedBuffer
7
+ from typing import Generic, TypeVar, overload
7
8
 
8
9
  __all__ = ["Parser", "HeaderParser", "BytesParser", "BytesHeaderParser", "FeedParser", "BytesFeedParser"]
9
10
 
10
- class Parser:
11
- def __init__(self, _class: Callable[[], Message] | None = None, *, policy: Policy = ...) -> None: ...
12
- def parse(self, fp: SupportsRead[str], headersonly: bool = False) -> Message: ...
13
- def parsestr(self, text: str, headersonly: bool = False) -> Message: ...
11
+ _MessageT = TypeVar("_MessageT", bound=Message, default=Message)
14
12
 
15
- class HeaderParser(Parser):
16
- def parse(self, fp: SupportsRead[str], headersonly: bool = True) -> Message: ...
17
- def parsestr(self, text: str, headersonly: bool = True) -> Message: ...
13
+ class Parser(Generic[_MessageT]):
14
+ @overload
15
+ def __init__(self: Parser[Message[str, str]], _class: None = None, *, policy: Policy = ...) -> None: ...
16
+ @overload
17
+ def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
18
+ def parse(self, fp: SupportsRead[str], headersonly: bool = False) -> _MessageT: ...
19
+ def parsestr(self, text: str, headersonly: bool = False) -> _MessageT: ...
18
20
 
19
- class BytesParser:
20
- def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ...
21
- def parse(self, fp: IO[bytes], headersonly: bool = False) -> Message: ...
22
- def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> Message: ...
21
+ class HeaderParser(Parser[_MessageT]):
22
+ def parse(self, fp: SupportsRead[str], headersonly: bool = True) -> _MessageT: ...
23
+ def parsestr(self, text: str, headersonly: bool = True) -> _MessageT: ...
23
24
 
24
- class BytesHeaderParser(BytesParser):
25
- def parse(self, fp: IO[bytes], headersonly: bool = True) -> Message: ...
26
- def parsebytes(self, text: bytes | bytearray, headersonly: bool = True) -> Message: ...
25
+ class BytesParser(Generic[_MessageT]):
26
+ parser: Parser[_MessageT]
27
+ @overload
28
+ def __init__(self: BytesParser[Message[str, str]], _class: None = None, *, policy: Policy = ...) -> None: ...
29
+ @overload
30
+ def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
31
+ def parse(self, fp: _WrappedBuffer, headersonly: bool = False) -> _MessageT: ...
32
+ def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> _MessageT: ...
33
+
34
+ class BytesHeaderParser(BytesParser[_MessageT]):
35
+ def parse(self, fp: _WrappedBuffer, headersonly: bool = True) -> _MessageT: ...
36
+ def parsebytes(self, text: bytes | bytearray, headersonly: bool = True) -> _MessageT: ...
@@ -15,65 +15,65 @@ class HTTPStatus(IntEnum):
15
15
  def phrase(self) -> str: ...
16
16
  @property
17
17
  def description(self) -> str: ...
18
- CONTINUE: int
19
- SWITCHING_PROTOCOLS: int
20
- PROCESSING: int
21
- OK: int
22
- CREATED: int
23
- ACCEPTED: int
24
- NON_AUTHORITATIVE_INFORMATION: int
25
- NO_CONTENT: int
26
- RESET_CONTENT: int
27
- PARTIAL_CONTENT: int
28
- MULTI_STATUS: int
29
- ALREADY_REPORTED: int
30
- IM_USED: int
31
- MULTIPLE_CHOICES: int
32
- MOVED_PERMANENTLY: int
33
- FOUND: int
34
- SEE_OTHER: int
35
- NOT_MODIFIED: int
36
- USE_PROXY: int
37
- TEMPORARY_REDIRECT: int
38
- PERMANENT_REDIRECT: int
39
- BAD_REQUEST: int
40
- UNAUTHORIZED: int
41
- PAYMENT_REQUIRED: int
42
- FORBIDDEN: int
43
- NOT_FOUND: int
44
- METHOD_NOT_ALLOWED: int
45
- NOT_ACCEPTABLE: int
46
- PROXY_AUTHENTICATION_REQUIRED: int
47
- REQUEST_TIMEOUT: int
48
- CONFLICT: int
49
- GONE: int
50
- LENGTH_REQUIRED: int
51
- PRECONDITION_FAILED: int
52
- REQUEST_ENTITY_TOO_LARGE: int
53
- REQUEST_URI_TOO_LONG: int
54
- UNSUPPORTED_MEDIA_TYPE: int
55
- REQUESTED_RANGE_NOT_SATISFIABLE: int
56
- EXPECTATION_FAILED: int
57
- UNPROCESSABLE_ENTITY: int
58
- LOCKED: int
59
- FAILED_DEPENDENCY: int
60
- UPGRADE_REQUIRED: int
61
- PRECONDITION_REQUIRED: int
62
- TOO_MANY_REQUESTS: int
63
- REQUEST_HEADER_FIELDS_TOO_LARGE: int
64
- INTERNAL_SERVER_ERROR: int
65
- NOT_IMPLEMENTED: int
66
- BAD_GATEWAY: int
67
- SERVICE_UNAVAILABLE: int
68
- GATEWAY_TIMEOUT: int
69
- HTTP_VERSION_NOT_SUPPORTED: int
70
- VARIANT_ALSO_NEGOTIATES: int
71
- INSUFFICIENT_STORAGE: int
72
- LOOP_DETECTED: int
73
- NOT_EXTENDED: int
74
- NETWORK_AUTHENTICATION_REQUIRED: int
75
- MISDIRECTED_REQUEST: int
76
- UNAVAILABLE_FOR_LEGAL_REASONS: int
18
+ CONTINUE = 100
19
+ SWITCHING_PROTOCOLS = 101
20
+ PROCESSING = 102
21
+ OK = 200
22
+ CREATED = 201
23
+ ACCEPTED = 202
24
+ NON_AUTHORITATIVE_INFORMATION = 203
25
+ NO_CONTENT = 204
26
+ RESET_CONTENT = 205
27
+ PARTIAL_CONTENT = 206
28
+ MULTI_STATUS = 207
29
+ ALREADY_REPORTED = 208
30
+ IM_USED = 226
31
+ MULTIPLE_CHOICES = 300
32
+ MOVED_PERMANENTLY = 301
33
+ FOUND = 302
34
+ SEE_OTHER = 303
35
+ NOT_MODIFIED = 304
36
+ USE_PROXY = 305
37
+ TEMPORARY_REDIRECT = 307
38
+ PERMANENT_REDIRECT = 308
39
+ BAD_REQUEST = 400
40
+ UNAUTHORIZED = 401
41
+ PAYMENT_REQUIRED = 402
42
+ FORBIDDEN = 403
43
+ NOT_FOUND = 404
44
+ METHOD_NOT_ALLOWED = 405
45
+ NOT_ACCEPTABLE = 406
46
+ PROXY_AUTHENTICATION_REQUIRED = 407
47
+ REQUEST_TIMEOUT = 408
48
+ CONFLICT = 409
49
+ GONE = 410
50
+ LENGTH_REQUIRED = 411
51
+ PRECONDITION_FAILED = 412
52
+ REQUEST_ENTITY_TOO_LARGE = 413
53
+ REQUEST_URI_TOO_LONG = 414
54
+ UNSUPPORTED_MEDIA_TYPE = 415
55
+ REQUESTED_RANGE_NOT_SATISFIABLE = 416
56
+ EXPECTATION_FAILED = 417
57
+ UNPROCESSABLE_ENTITY = 422
58
+ LOCKED = 423
59
+ FAILED_DEPENDENCY = 424
60
+ UPGRADE_REQUIRED = 426
61
+ PRECONDITION_REQUIRED = 428
62
+ TOO_MANY_REQUESTS = 429
63
+ REQUEST_HEADER_FIELDS_TOO_LARGE = 431
64
+ INTERNAL_SERVER_ERROR = 500
65
+ NOT_IMPLEMENTED = 501
66
+ BAD_GATEWAY = 502
67
+ SERVICE_UNAVAILABLE = 503
68
+ GATEWAY_TIMEOUT = 504
69
+ HTTP_VERSION_NOT_SUPPORTED = 505
70
+ VARIANT_ALSO_NEGOTIATES = 506
71
+ INSUFFICIENT_STORAGE = 507
72
+ LOOP_DETECTED = 508
73
+ NOT_EXTENDED = 510
74
+ NETWORK_AUTHENTICATION_REQUIRED = 511
75
+ MISDIRECTED_REQUEST = 421
76
+ UNAVAILABLE_FOR_LEGAL_REASONS = 451
77
77
  if sys.version_info >= (3, 9):
78
78
  EARLY_HINTS: Literal[103]
79
79
  IM_A_TEAPOT: Literal[418]
@@ -94,12 +94,12 @@ if sys.version_info >= (3, 11):
94
94
  class HTTPMethod(StrEnum):
95
95
  @property
96
96
  def description(self) -> str: ...
97
- CONNECT: str
98
- DELETE: str
99
- GET: str
100
- HEAD: str
101
- OPTIONS: str
102
- PATCH: str
103
- POST: str
104
- PUT: str
105
- TRACE: str
97
+ CONNECT = "CONNECT"
98
+ DELETE = "DELETE"
99
+ GET = "GET"
100
+ HEAD = "HEAD"
101
+ OPTIONS = "OPTIONS"
102
+ PATCH = "PATCH"
103
+ POST = "POST"
104
+ PUT = "PUT"
105
+ TRACE = "TRACE"
@@ -3,7 +3,7 @@ import io
3
3
  import ssl
4
4
  import sys
5
5
  import types
6
- from _typeshed import ReadableBuffer, SupportsRead, WriteableBuffer
6
+ from _typeshed import ReadableBuffer, SupportsRead, SupportsReadline, WriteableBuffer
7
7
  from collections.abc import Callable, Iterable, Iterator, Mapping
8
8
  from socket import socket
9
9
  from typing import Any, BinaryIO, TypeVar, overload
@@ -33,6 +33,7 @@ __all__ = [
33
33
 
34
34
  _DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | ReadableBuffer
35
35
  _T = TypeVar("_T")
36
+ _MessageT = TypeVar("_MessageT", bound=email.message.Message)
36
37
 
37
38
  HTTP_PORT: int
38
39
  HTTPS_PORT: int
@@ -97,28 +98,13 @@ NETWORK_AUTHENTICATION_REQUIRED: int
97
98
 
98
99
  responses: dict[int, str]
99
100
 
100
- class HTTPMessage(email.message.Message):
101
+ class HTTPMessage(email.message.Message[str, str]):
101
102
  def getallmatchingheaders(self, name: str) -> list[str]: ... # undocumented
102
- # override below all of Message's methods that use `_HeaderType` / `_HeaderTypeParam` with `str`
103
- # `HTTPMessage` breaks the Liskov substitution principle by only intending for `str` headers
104
- # This is easier than making `Message` generic
105
- def __getitem__(self, name: str) -> str | None: ...
106
- def __setitem__(self, name: str, val: str) -> None: ... # type: ignore[override]
107
- def values(self) -> list[str]: ...
108
- def items(self) -> list[tuple[str, str]]: ...
109
- @overload
110
- def get(self, name: str, failobj: None = None) -> str | None: ...
111
- @overload
112
- def get(self, name: str, failobj: _T) -> str | _T: ...
113
- @overload
114
- def get_all(self, name: str, failobj: None = None) -> list[str] | None: ...
115
- @overload
116
- def get_all(self, name: str, failobj: _T) -> list[str] | _T: ...
117
- def replace_header(self, _name: str, _value: str) -> None: ... # type: ignore[override]
118
- def set_raw(self, name: str, value: str) -> None: ... # type: ignore[override]
119
- def raw_items(self) -> Iterator[tuple[str, str]]: ...
120
103
 
121
- def parse_headers(fp: io.BufferedIOBase, _class: Callable[[], email.message.Message] = ...) -> HTTPMessage: ...
104
+ @overload
105
+ def parse_headers(fp: SupportsReadline[bytes], _class: Callable[[], _MessageT]) -> _MessageT: ...
106
+ @overload
107
+ def parse_headers(fp: SupportsReadline[bytes]) -> HTTPMessage: ...
122
108
 
123
109
  class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible method definitions in the base classes
124
110
  msg: HTTPMessage