basedpyright 1.24.0 → 1.25.0

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 (189) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.LICENSE.txt +42 -0
  3. package/dist/pyright-langserver.js.map +1 -1
  4. package/dist/pyright.js +1 -1
  5. package/dist/pyright.js.map +1 -1
  6. package/dist/typeshed-fallback/stdlib/_asyncio.pyi +3 -25
  7. package/dist/typeshed-fallback/stdlib/_bisect.pyi +4 -44
  8. package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
  9. package/dist/typeshed-fallback/stdlib/_csv.pyi +2 -16
  10. package/dist/typeshed-fallback/stdlib/_dbm.pyi +1 -13
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +1 -8
  12. package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
  13. package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +164 -180
  14. package/dist/typeshed-fallback/stdlib/_gdbm.pyi +1 -39
  15. package/dist/typeshed-fallback/stdlib/_hashlib.pyi +7 -28
  16. package/dist/typeshed-fallback/stdlib/_imp.pyi +1 -3
  17. package/dist/typeshed-fallback/stdlib/_msi.pyi +92 -94
  18. package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +6 -48
  19. package/dist/typeshed-fallback/stdlib/_ssl.pyi +1 -8
  20. package/dist/typeshed-fallback/stdlib/_thread.pyi +1 -8
  21. package/dist/typeshed-fallback/stdlib/_warnings.pyi +2 -6
  22. package/dist/typeshed-fallback/stdlib/aifc.pyi +91 -91
  23. package/dist/typeshed-fallback/stdlib/array.pyi +3 -17
  24. package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
  25. package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +4 -23
  26. package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
  27. package/dist/typeshed-fallback/stdlib/audioop.pyi +43 -95
  28. package/dist/typeshed-fallback/stdlib/binascii.pyi +5 -15
  29. package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
  30. package/dist/typeshed-fallback/stdlib/builtins.pyi +8 -106
  31. package/dist/typeshed-fallback/stdlib/cgi.pyi +118 -118
  32. package/dist/typeshed-fallback/stdlib/cgitb.pyi +32 -32
  33. package/dist/typeshed-fallback/stdlib/chunk.pyi +20 -20
  34. package/dist/typeshed-fallback/stdlib/datetime.pyi +4 -12
  35. package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
  36. package/dist/typeshed-fallback/stdlib/distutils/_msvccompiler.pyi +13 -13
  37. package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
  38. package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
  39. package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +176 -176
  40. package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +229 -229
  41. package/dist/typeshed-fallback/stdlib/distutils/command/__init__.pyi +48 -48
  42. package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +27 -27
  43. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +22 -22
  44. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +46 -46
  45. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +53 -53
  46. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
  47. package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +34 -34
  48. package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +29 -29
  49. package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +52 -52
  50. package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +45 -45
  51. package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +25 -25
  52. package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +40 -40
  53. package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +18 -18
  54. package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
  55. package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +71 -71
  56. package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +20 -20
  57. package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +19 -19
  58. package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +17 -17
  59. package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +26 -26
  60. package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +19 -19
  61. package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +21 -21
  62. package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +45 -45
  63. package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +18 -18
  64. package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
  65. package/dist/typeshed-fallback/stdlib/distutils/core.pyi +58 -58
  66. package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
  67. package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +3 -3
  68. package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
  69. package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
  70. package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +317 -317
  71. package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
  72. package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
  73. package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
  74. package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
  75. package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
  76. package/dist/typeshed-fallback/stdlib/distutils/log.pyi +26 -26
  77. package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
  78. package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +10 -10
  79. package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
  80. package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
  81. package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
  82. package/dist/typeshed-fallback/stdlib/distutils/util.pyi +53 -53
  83. package/dist/typeshed-fallback/stdlib/distutils/version.pyi +36 -38
  84. package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
  85. package/dist/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi +21 -21
  86. package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
  87. package/dist/typeshed-fallback/stdlib/hmac.pyi +2 -30
  88. package/dist/typeshed-fallback/stdlib/imghdr.pyi +17 -17
  89. package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
  90. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +7 -36
  91. package/dist/typeshed-fallback/stdlib/lib2to3/btm_matcher.pyi +28 -28
  92. package/dist/typeshed-fallback/stdlib/lib2to3/fixer_base.pyi +42 -42
  93. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_apply.pyi +8 -8
  94. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_asserts.pyi +10 -10
  95. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_basestring.pyi +8 -8
  96. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_buffer.pyi +8 -8
  97. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_dict.pyi +16 -16
  98. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_except.pyi +14 -14
  99. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_exec.pyi +8 -8
  100. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_execfile.pyi +8 -8
  101. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_exitfunc.pyi +13 -13
  102. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_filter.pyi +9 -9
  103. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_funcattrs.pyi +8 -8
  104. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_future.pyi +8 -8
  105. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_getcwdu.pyi +8 -8
  106. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_has_key.pyi +8 -8
  107. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_idioms.pyi +15 -15
  108. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_import.pyi +16 -16
  109. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_imports.pyi +21 -21
  110. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_imports2.pyi +8 -8
  111. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_input.pyi +11 -11
  112. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_intern.pyi +9 -9
  113. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_isinstance.pyi +8 -8
  114. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_itertools.pyi +9 -9
  115. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +7 -7
  116. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_long.pyi +7 -7
  117. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_map.pyi +9 -9
  118. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_metaclass.pyi +17 -17
  119. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_methodattrs.pyi +10 -10
  120. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_ne.pyi +8 -8
  121. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_next.pyi +19 -19
  122. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_nonzero.pyi +8 -8
  123. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_numliterals.pyi +8 -8
  124. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_operator.pyi +12 -12
  125. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_paren.pyi +8 -8
  126. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_print.pyi +12 -12
  127. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_raise.pyi +8 -8
  128. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_raw_input.pyi +8 -8
  129. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_reduce.pyi +8 -8
  130. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_reload.pyi +9 -9
  131. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_renames.pyi +17 -17
  132. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_repr.pyi +8 -8
  133. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_set_literal.pyi +7 -7
  134. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_standarderror.pyi +8 -8
  135. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_sys_exc.pyi +9 -9
  136. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_throw.pyi +8 -8
  137. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_tuple_params.pyi +17 -17
  138. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_types.pyi +8 -8
  139. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_unicode.pyi +12 -12
  140. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_urllib.pyi +15 -15
  141. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_ws_comma.pyi +12 -12
  142. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_xrange.pyi +20 -20
  143. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_xreadlines.pyi +8 -8
  144. package/dist/typeshed-fallback/stdlib/lib2to3/fixes/fix_zip.pyi +9 -9
  145. package/dist/typeshed-fallback/stdlib/lib2to3/main.pyi +42 -42
  146. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/__init__.pyi +9 -9
  147. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/driver.pyi +27 -27
  148. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/grammar.pyi +24 -24
  149. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/literals.pyi +7 -7
  150. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/parse.pyi +30 -30
  151. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/pgen.pyi +50 -50
  152. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/token.pyi +69 -69
  153. package/dist/typeshed-fallback/stdlib/lib2to3/pgen2/tokenize.pyi +96 -96
  154. package/dist/typeshed-fallback/stdlib/lib2to3/pygram.pyi +114 -114
  155. package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +117 -127
  156. package/dist/typeshed-fallback/stdlib/lib2to3/refactor.pyi +82 -82
  157. package/dist/typeshed-fallback/stdlib/mailcap.pyi +11 -11
  158. package/dist/typeshed-fallback/stdlib/marshal.pyi +4 -52
  159. package/dist/typeshed-fallback/stdlib/math.pyi +2 -6
  160. package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
  161. package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
  162. package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
  163. package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
  164. package/dist/typeshed-fallback/stdlib/nis.pyi +4 -31
  165. package/dist/typeshed-fallback/stdlib/nntplib.pyi +125 -125
  166. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1 -8
  167. package/dist/typeshed-fallback/stdlib/parser.pyi +24 -55
  168. package/dist/typeshed-fallback/stdlib/pipes.pyi +16 -16
  169. package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
  170. package/dist/typeshed-fallback/stdlib/sndhdr.pyi +14 -14
  171. package/dist/typeshed-fallback/stdlib/spwd.pyi +13 -66
  172. package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +2 -6
  173. package/dist/typeshed-fallback/stdlib/ssl.pyi +0 -4
  174. package/dist/typeshed-fallback/stdlib/sunau.pyi +86 -86
  175. package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
  176. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +4 -40
  177. package/dist/typeshed-fallback/stdlib/telnetlib.pyi +123 -123
  178. package/dist/typeshed-fallback/stdlib/tkinter/tix.pyi +299 -299
  179. package/dist/typeshed-fallback/stdlib/types.pyi +2 -6
  180. package/dist/typeshed-fallback/stdlib/typing.pyi +2 -6
  181. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +544 -559
  182. package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +1 -6
  183. package/dist/typeshed-fallback/stdlib/uu.pyi +13 -13
  184. package/dist/typeshed-fallback/stdlib/xdrlib.pyi +57 -57
  185. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +1 -3
  186. package/dist/typeshed-fallback/stdlib/zipimport.pyi +0 -29
  187. package/dist/typeshed-fallback/stdlib/zlib.pyi +1 -10
  188. package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +3 -9
  189. package/package.json +1 -1
@@ -50,32 +50,13 @@ if sys.version_info < (3, 11):
50
50
  _shutdown_cb: Callable[[], None] | None
51
51
  def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = None) -> None: ...
52
52
  @property
53
- def context(self) -> ssl.SSLContext:
54
- """The SSL context passed to the constructor."""
55
- ...
53
+ def context(self) -> ssl.SSLContext: ...
56
54
  @property
57
- def ssl_object(self) -> ssl.SSLObject | None:
58
- """
59
- The internal ssl.SSLObject instance.
60
-
61
- Return None if the pipe is not wrapped.
62
- """
63
- ...
55
+ def ssl_object(self) -> ssl.SSLObject | None: ...
64
56
  @property
65
- def need_ssldata(self) -> bool:
66
- """
67
- Whether more record level data is needed to complete a handshake
68
- that is currently in progress.
69
- """
70
- ...
57
+ def need_ssldata(self) -> bool: ...
71
58
  @property
72
- def wrapped(self) -> bool:
73
- """
74
- Whether a security layer is currently in effect.
75
-
76
- Return False during handshake.
77
- """
78
- ...
59
+ def wrapped(self) -> bool: ...
79
60
  def do_handshake(self, callback: Callable[[BaseException | None], object] | None = None) -> list[bytes]: ...
80
61
  def shutdown(self, callback: Callable[[], object] | None = None) -> list[bytes]: ...
81
62
  def feed_eof(self) -> None: ...
@@ -1,90 +1,90 @@
1
- import sys
2
- from _typeshed import FileDescriptorLike, ReadableBuffer
3
- from socket import socket
4
- from typing import Any, overload
5
- from typing_extensions import TypeAlias
6
-
7
- # cyclic dependence with asynchat
8
- _MapType: TypeAlias = dict[int, Any]
9
- _Socket: TypeAlias = socket
10
-
11
- socket_map: _MapType # undocumented
12
-
13
- class ExitNow(Exception): ...
14
-
15
- def read(obj: Any) -> None: ...
16
- def write(obj: Any) -> None: ...
17
- def readwrite(obj: Any, flags: int) -> None: ...
18
- def poll(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
19
- def poll2(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
20
-
21
- poll3 = poll2
22
-
23
- def loop(timeout: float = 30.0, use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ...
24
-
25
- # Not really subclass of socket.socket; it's only delegation.
26
- # It is not covariant to it.
27
- class dispatcher:
28
- debug: bool
29
- connected: bool
30
- accepting: bool
31
- connecting: bool
32
- closing: bool
33
- ignore_log_types: frozenset[str]
34
- socket: _Socket | None
35
- def __init__(self, sock: _Socket | None = None, map: _MapType | None = None) -> None: ...
36
- def add_channel(self, map: _MapType | None = None) -> None: ...
37
- def del_channel(self, map: _MapType | None = None) -> None: ...
38
- def create_socket(self, family: int = ..., type: int = ...) -> None: ...
39
- def set_socket(self, sock: _Socket, map: _MapType | None = None) -> None: ...
40
- def set_reuse_addr(self) -> None: ...
41
- def readable(self) -> bool: ...
42
- def writable(self) -> bool: ...
43
- def listen(self, num: int) -> None: ...
44
- def bind(self, addr: tuple[Any, ...] | str) -> None: ...
45
- def connect(self, address: tuple[Any, ...] | str) -> None: ...
46
- def accept(self) -> tuple[_Socket, Any] | None: ...
47
- def send(self, data: ReadableBuffer) -> int: ...
48
- def recv(self, buffer_size: int) -> bytes: ...
49
- def close(self) -> None: ...
50
- def log(self, message: Any) -> None: ...
51
- def log_info(self, message: Any, type: str = "info") -> None: ...
52
- def handle_read_event(self) -> None: ...
53
- def handle_connect_event(self) -> None: ...
54
- def handle_write_event(self) -> None: ...
55
- def handle_expt_event(self) -> None: ...
56
- def handle_error(self) -> None: ...
57
- def handle_expt(self) -> None: ...
58
- def handle_read(self) -> None: ...
59
- def handle_write(self) -> None: ...
60
- def handle_connect(self) -> None: ...
61
- def handle_accept(self) -> None: ...
62
- def handle_close(self) -> None: ...
63
-
64
- class dispatcher_with_send(dispatcher):
65
- def initiate_send(self) -> None: ...
66
- # incompatible signature:
67
- # def send(self, data: bytes) -> int | None: ...
68
-
69
- def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ...
70
- def close_all(map: _MapType | None = None, ignore_all: bool = False) -> None: ...
71
-
72
- if sys.platform != "win32":
73
- class file_wrapper:
74
- fd: int
75
- def __init__(self, fd: int) -> None: ...
76
- def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
77
- def send(self, data: bytes, flags: int = ...) -> int: ...
78
- @overload
79
- def getsockopt(self, level: int, optname: int, buflen: None = None) -> int: ...
80
- @overload
81
- def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
82
- def read(self, bufsize: int, flags: int = ...) -> bytes: ...
83
- def write(self, data: bytes, flags: int = ...) -> int: ...
84
- def close(self) -> None: ...
85
- def fileno(self) -> int: ...
86
- def __del__(self) -> None: ...
87
-
88
- class file_dispatcher(dispatcher):
89
- def __init__(self, fd: FileDescriptorLike, map: _MapType | None = None) -> None: ...
90
- def set_file(self, fd: int) -> None: ...
1
+ import sys
2
+ from _typeshed import FileDescriptorLike, ReadableBuffer
3
+ from socket import socket
4
+ from typing import Any, overload
5
+ from typing_extensions import TypeAlias
6
+
7
+ # cyclic dependence with asynchat
8
+ _MapType: TypeAlias = dict[int, Any]
9
+ _Socket: TypeAlias = socket
10
+
11
+ socket_map: _MapType # undocumented
12
+
13
+ class ExitNow(Exception): ...
14
+
15
+ def read(obj: Any) -> None: ...
16
+ def write(obj: Any) -> None: ...
17
+ def readwrite(obj: Any, flags: int) -> None: ...
18
+ def poll(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
19
+ def poll2(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
20
+
21
+ poll3 = poll2
22
+
23
+ def loop(timeout: float = 30.0, use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ...
24
+
25
+ # Not really subclass of socket.socket; it's only delegation.
26
+ # It is not covariant to it.
27
+ class dispatcher:
28
+ debug: bool
29
+ connected: bool
30
+ accepting: bool
31
+ connecting: bool
32
+ closing: bool
33
+ ignore_log_types: frozenset[str]
34
+ socket: _Socket | None
35
+ def __init__(self, sock: _Socket | None = None, map: _MapType | None = None) -> None: ...
36
+ def add_channel(self, map: _MapType | None = None) -> None: ...
37
+ def del_channel(self, map: _MapType | None = None) -> None: ...
38
+ def create_socket(self, family: int = ..., type: int = ...) -> None: ...
39
+ def set_socket(self, sock: _Socket, map: _MapType | None = None) -> None: ...
40
+ def set_reuse_addr(self) -> None: ...
41
+ def readable(self) -> bool: ...
42
+ def writable(self) -> bool: ...
43
+ def listen(self, num: int) -> None: ...
44
+ def bind(self, addr: tuple[Any, ...] | str) -> None: ...
45
+ def connect(self, address: tuple[Any, ...] | str) -> None: ...
46
+ def accept(self) -> tuple[_Socket, Any] | None: ...
47
+ def send(self, data: ReadableBuffer) -> int: ...
48
+ def recv(self, buffer_size: int) -> bytes: ...
49
+ def close(self) -> None: ...
50
+ def log(self, message: Any) -> None: ...
51
+ def log_info(self, message: Any, type: str = "info") -> None: ...
52
+ def handle_read_event(self) -> None: ...
53
+ def handle_connect_event(self) -> None: ...
54
+ def handle_write_event(self) -> None: ...
55
+ def handle_expt_event(self) -> None: ...
56
+ def handle_error(self) -> None: ...
57
+ def handle_expt(self) -> None: ...
58
+ def handle_read(self) -> None: ...
59
+ def handle_write(self) -> None: ...
60
+ def handle_connect(self) -> None: ...
61
+ def handle_accept(self) -> None: ...
62
+ def handle_close(self) -> None: ...
63
+
64
+ class dispatcher_with_send(dispatcher):
65
+ def initiate_send(self) -> None: ...
66
+ # incompatible signature:
67
+ # def send(self, data: bytes) -> int | None: ...
68
+
69
+ def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ...
70
+ def close_all(map: _MapType | None = None, ignore_all: bool = False) -> None: ...
71
+
72
+ if sys.platform != "win32":
73
+ class file_wrapper:
74
+ fd: int
75
+ def __init__(self, fd: int) -> None: ...
76
+ def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
77
+ def send(self, data: bytes, flags: int = ...) -> int: ...
78
+ @overload
79
+ def getsockopt(self, level: int, optname: int, buflen: None = None) -> int: ...
80
+ @overload
81
+ def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
82
+ def read(self, bufsize: int, flags: int = ...) -> bytes: ...
83
+ def write(self, data: bytes, flags: int = ...) -> int: ...
84
+ def close(self) -> None: ...
85
+ def fileno(self) -> int: ...
86
+ def __del__(self) -> None: ...
87
+
88
+ class file_dispatcher(dispatcher):
89
+ def __init__(self, fd: FileDescriptorLike, map: _MapType | None = None) -> None: ...
90
+ def set_file(self, fd: int) -> None: ...
@@ -1,95 +1,43 @@
1
- from typing_extensions import Buffer, TypeAlias
2
-
3
- _AdpcmState: TypeAlias = tuple[int, int]
4
- _RatecvState: TypeAlias = tuple[int, tuple[tuple[int, int], ...]]
5
-
6
- class error(Exception): ...
7
-
8
- def add(fragment1: Buffer, fragment2: Buffer, width: int, /) -> bytes:
9
- """Return a fragment which is the addition of the two samples passed as parameters."""
10
- ...
11
- def adpcm2lin(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]:
12
- """Decode an Intel/DVI ADPCM coded fragment to a linear fragment."""
13
- ...
14
- def alaw2lin(fragment: Buffer, width: int, /) -> bytes:
15
- """Convert sound fragments in a-LAW encoding to linearly encoded sound fragments."""
16
- ...
17
- def avg(fragment: Buffer, width: int, /) -> int:
18
- """Return the average over all samples in the fragment."""
19
- ...
20
- def avgpp(fragment: Buffer, width: int, /) -> int:
21
- """Return the average peak-peak value over all samples in the fragment."""
22
- ...
23
- def bias(fragment: Buffer, width: int, bias: int, /) -> bytes:
24
- """Return a fragment that is the original fragment with a bias added to each sample."""
25
- ...
26
- def byteswap(fragment: Buffer, width: int, /) -> bytes:
27
- """Convert big-endian samples to little-endian and vice versa."""
28
- ...
29
- def cross(fragment: Buffer, width: int, /) -> int:
30
- """Return the number of zero crossings in the fragment passed as an argument."""
31
- ...
32
- def findfactor(fragment: Buffer, reference: Buffer, /) -> float:
33
- """Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal."""
34
- ...
35
- def findfit(fragment: Buffer, reference: Buffer, /) -> tuple[int, float]:
36
- """Try to match reference as well as possible to a portion of fragment."""
37
- ...
38
- def findmax(fragment: Buffer, length: int, /) -> int:
39
- """Search fragment for a slice of specified number of samples with maximum energy."""
40
- ...
41
- def getsample(fragment: Buffer, width: int, index: int, /) -> int:
42
- """Return the value of sample index from the fragment."""
43
- ...
44
- def lin2adpcm(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]:
45
- """Convert samples to 4 bit Intel/DVI ADPCM encoding."""
46
- ...
47
- def lin2alaw(fragment: Buffer, width: int, /) -> bytes:
48
- """Convert samples in the audio fragment to a-LAW encoding."""
49
- ...
50
- def lin2lin(fragment: Buffer, width: int, newwidth: int, /) -> bytes:
51
- """Convert samples between 1-, 2-, 3- and 4-byte formats."""
52
- ...
53
- def lin2ulaw(fragment: Buffer, width: int, /) -> bytes:
54
- """Convert samples in the audio fragment to u-LAW encoding."""
55
- ...
56
- def max(fragment: Buffer, width: int, /) -> int:
57
- """Return the maximum of the absolute value of all samples in a fragment."""
58
- ...
59
- def maxpp(fragment: Buffer, width: int, /) -> int:
60
- """Return the maximum peak-peak value in the sound fragment."""
61
- ...
62
- def minmax(fragment: Buffer, width: int, /) -> tuple[int, int]:
63
- """Return the minimum and maximum values of all samples in the sound fragment."""
64
- ...
65
- def mul(fragment: Buffer, width: int, factor: float, /) -> bytes:
66
- """Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor."""
67
- ...
68
- def ratecv(
69
- fragment: Buffer,
70
- width: int,
71
- nchannels: int,
72
- inrate: int,
73
- outrate: int,
74
- state: _RatecvState | None,
75
- weightA: int = 1,
76
- weightB: int = 0,
77
- /,
78
- ) -> tuple[bytes, _RatecvState]:
79
- """Convert the frame rate of the input fragment."""
80
- ...
81
- def reverse(fragment: Buffer, width: int, /) -> bytes:
82
- """Reverse the samples in a fragment and returns the modified fragment."""
83
- ...
84
- def rms(fragment: Buffer, width: int, /) -> int:
85
- """Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n)."""
86
- ...
87
- def tomono(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes:
88
- """Convert a stereo fragment to a mono fragment."""
89
- ...
90
- def tostereo(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes:
91
- """Generate a stereo fragment from a mono fragment."""
92
- ...
93
- def ulaw2lin(fragment: Buffer, width: int, /) -> bytes:
94
- """Convert sound fragments in u-LAW encoding to linearly encoded sound fragments."""
95
- ...
1
+ from typing_extensions import Buffer, TypeAlias
2
+
3
+ _AdpcmState: TypeAlias = tuple[int, int]
4
+ _RatecvState: TypeAlias = tuple[int, tuple[tuple[int, int], ...]]
5
+
6
+ class error(Exception): ...
7
+
8
+ def add(fragment1: Buffer, fragment2: Buffer, width: int, /) -> bytes: ...
9
+ def adpcm2lin(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]: ...
10
+ def alaw2lin(fragment: Buffer, width: int, /) -> bytes: ...
11
+ def avg(fragment: Buffer, width: int, /) -> int: ...
12
+ def avgpp(fragment: Buffer, width: int, /) -> int: ...
13
+ def bias(fragment: Buffer, width: int, bias: int, /) -> bytes: ...
14
+ def byteswap(fragment: Buffer, width: int, /) -> bytes: ...
15
+ def cross(fragment: Buffer, width: int, /) -> int: ...
16
+ def findfactor(fragment: Buffer, reference: Buffer, /) -> float: ...
17
+ def findfit(fragment: Buffer, reference: Buffer, /) -> tuple[int, float]: ...
18
+ def findmax(fragment: Buffer, length: int, /) -> int: ...
19
+ def getsample(fragment: Buffer, width: int, index: int, /) -> int: ...
20
+ def lin2adpcm(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]: ...
21
+ def lin2alaw(fragment: Buffer, width: int, /) -> bytes: ...
22
+ def lin2lin(fragment: Buffer, width: int, newwidth: int, /) -> bytes: ...
23
+ def lin2ulaw(fragment: Buffer, width: int, /) -> bytes: ...
24
+ def max(fragment: Buffer, width: int, /) -> int: ...
25
+ def maxpp(fragment: Buffer, width: int, /) -> int: ...
26
+ def minmax(fragment: Buffer, width: int, /) -> tuple[int, int]: ...
27
+ def mul(fragment: Buffer, width: int, factor: float, /) -> bytes: ...
28
+ def ratecv(
29
+ fragment: Buffer,
30
+ width: int,
31
+ nchannels: int,
32
+ inrate: int,
33
+ outrate: int,
34
+ state: _RatecvState | None,
35
+ weightA: int = 1,
36
+ weightB: int = 0,
37
+ /,
38
+ ) -> tuple[bytes, _RatecvState]: ...
39
+ def reverse(fragment: Buffer, width: int, /) -> bytes: ...
40
+ def rms(fragment: Buffer, width: int, /) -> int: ...
41
+ def tomono(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes: ...
42
+ def tostereo(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes: ...
43
+ def ulaw2lin(fragment: Buffer, width: int, /) -> bytes: ...
@@ -27,9 +27,7 @@ if sys.version_info >= (3, 11):
27
27
  ...
28
28
 
29
29
  else:
30
- def a2b_base64(data: _AsciiBuffer, /) -> bytes:
31
- """Decode a line of base64 data."""
32
- ...
30
+ def a2b_base64(data: _AsciiBuffer, /) -> bytes: ...
33
31
 
34
32
  def b2a_base64(data: ReadableBuffer, /, *, newline: bool = True) -> bytes:
35
33
  """Base64-code line of data."""
@@ -48,18 +46,10 @@ def b2a_qp(data: ReadableBuffer, quotetabs: bool = False, istext: bool = True, h
48
46
  ...
49
47
 
50
48
  if sys.version_info < (3, 11):
51
- def a2b_hqx(data: _AsciiBuffer, /) -> bytes:
52
- """Decode .hqx coding."""
53
- ...
54
- def rledecode_hqx(data: ReadableBuffer, /) -> bytes:
55
- """Decode hexbin RLE-coded string."""
56
- ...
57
- def rlecode_hqx(data: ReadableBuffer, /) -> bytes:
58
- """Binhex RLE-code binary data."""
59
- ...
60
- def b2a_hqx(data: ReadableBuffer, /) -> bytes:
61
- """Encode .hqx data."""
62
- ...
49
+ def a2b_hqx(data: _AsciiBuffer, /) -> bytes: ...
50
+ def rledecode_hqx(data: ReadableBuffer, /) -> bytes: ...
51
+ def rlecode_hqx(data: ReadableBuffer, /) -> bytes: ...
52
+ def b2a_hqx(data: ReadableBuffer, /) -> bytes: ...
63
53
 
64
54
  def crc_hqx(data: ReadableBuffer, crc: int, /) -> int:
65
55
  """Compute CRC-CCITT incrementally."""
@@ -1,45 +1,45 @@
1
- from _typeshed import SizedBuffer
2
- from typing import IO, Any, Final
3
- from typing_extensions import TypeAlias
4
-
5
- __all__ = ["binhex", "hexbin", "Error"]
6
-
7
- class Error(Exception): ...
8
-
9
- REASONABLY_LARGE: Final = 32768
10
- LINELEN: Final = 64
11
- RUNCHAR: Final = b"\x90"
12
-
13
- class FInfo:
14
- Type: str
15
- Creator: str
16
- Flags: int
17
-
18
- _FileInfoTuple: TypeAlias = tuple[str, FInfo, int, int]
19
- _FileHandleUnion: TypeAlias = str | IO[bytes]
20
-
21
- def getfileinfo(name: str) -> _FileInfoTuple: ...
22
-
23
- class openrsrc:
24
- def __init__(self, *args: Any) -> None: ...
25
- def read(self, *args: Any) -> bytes: ...
26
- def write(self, *args: Any) -> None: ...
27
- def close(self) -> None: ...
28
-
29
- class BinHex:
30
- def __init__(self, name_finfo_dlen_rlen: _FileInfoTuple, ofp: _FileHandleUnion) -> None: ...
31
- def write(self, data: SizedBuffer) -> None: ...
32
- def close_data(self) -> None: ...
33
- def write_rsrc(self, data: SizedBuffer) -> None: ...
34
- def close(self) -> None: ...
35
-
36
- def binhex(inp: str, out: str) -> None: ...
37
-
38
- class HexBin:
39
- def __init__(self, ifp: _FileHandleUnion) -> None: ...
40
- def read(self, *n: int) -> bytes: ...
41
- def close_data(self) -> None: ...
42
- def read_rsrc(self, *n: int) -> bytes: ...
43
- def close(self) -> None: ...
44
-
45
- def hexbin(inp: str, out: str) -> None: ...
1
+ from _typeshed import SizedBuffer
2
+ from typing import IO, Any, Final
3
+ from typing_extensions import TypeAlias
4
+
5
+ __all__ = ["binhex", "hexbin", "Error"]
6
+
7
+ class Error(Exception): ...
8
+
9
+ REASONABLY_LARGE: Final = 32768
10
+ LINELEN: Final = 64
11
+ RUNCHAR: Final = b"\x90"
12
+
13
+ class FInfo:
14
+ Type: str
15
+ Creator: str
16
+ Flags: int
17
+
18
+ _FileInfoTuple: TypeAlias = tuple[str, FInfo, int, int]
19
+ _FileHandleUnion: TypeAlias = str | IO[bytes]
20
+
21
+ def getfileinfo(name: str) -> _FileInfoTuple: ...
22
+
23
+ class openrsrc:
24
+ def __init__(self, *args: Any) -> None: ...
25
+ def read(self, *args: Any) -> bytes: ...
26
+ def write(self, *args: Any) -> None: ...
27
+ def close(self) -> None: ...
28
+
29
+ class BinHex:
30
+ def __init__(self, name_finfo_dlen_rlen: _FileInfoTuple, ofp: _FileHandleUnion) -> None: ...
31
+ def write(self, data: SizedBuffer) -> None: ...
32
+ def close_data(self) -> None: ...
33
+ def write_rsrc(self, data: SizedBuffer) -> None: ...
34
+ def close(self) -> None: ...
35
+
36
+ def binhex(inp: str, out: str) -> None: ...
37
+
38
+ class HexBin:
39
+ def __init__(self, ifp: _FileHandleUnion) -> None: ...
40
+ def read(self, *n: int) -> bytes: ...
41
+ def close_data(self) -> None: ...
42
+ def read_rsrc(self, *n: int) -> bytes: ...
43
+ def close(self) -> None: ...
44
+
45
+ def hexbin(inp: str, out: str) -> None: ...
@@ -515,25 +515,7 @@ class int:
515
515
  """
516
516
  ...
517
517
  else:
518
- def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = False) -> bytes:
519
- """
520
- Return an array of bytes representing an integer.
521
-
522
- length
523
- Length of bytes object to use. An OverflowError is raised if the
524
- integer is not representable with the given number of bytes.
525
- byteorder
526
- The byte order used to represent the integer. If byteorder is 'big',
527
- the most significant byte is at the beginning of the byte array. If
528
- byteorder is 'little', the most significant byte is at the end of the
529
- byte array. To request the native byte order of the host system, use
530
- `sys.byteorder' as the byte order value.
531
- signed
532
- Determines whether two's complement is used to represent the integer.
533
- If signed is False and a negative integer is given, an OverflowError
534
- is raised.
535
- """
536
- ...
518
+ def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = False) -> bytes: ...
537
519
  @classmethod
538
520
  def from_bytes(
539
521
  cls,
@@ -541,25 +523,7 @@ class int:
541
523
  byteorder: Literal["little", "big"],
542
524
  *,
543
525
  signed: bool = False,
544
- ) -> Self:
545
- """
546
- Return the integer represented by the given array of bytes.
547
-
548
- bytes
549
- Holds the array of bytes to convert. The argument must either
550
- support the buffer protocol or be an iterable object producing bytes.
551
- Bytes and bytearray are examples of built-in objects that support the
552
- buffer protocol.
553
- byteorder
554
- The byte order used to represent the integer. If byteorder is 'big',
555
- the most significant byte is at the beginning of the byte array. If
556
- byteorder is 'little', the most significant byte is at the end of the
557
- byte array. To request the native byte order of the host system, use
558
- `sys.byteorder' as the byte order value.
559
- signed
560
- Indicates whether two's complement is used to represent the integer.
561
- """
562
- ...
526
+ ) -> Self: ...
563
527
 
564
528
  if sys.version_info >= (3, 12):
565
529
  def is_integer(self) -> Literal[True]:
@@ -1370,31 +1334,9 @@ class str(Sequence[str]):
1370
1334
  @overload
1371
1335
  def replace(
1372
1336
  self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
1373
- ) -> LiteralString:
1374
- """
1375
- Return a copy with all occurrences of substring old replaced by new.
1376
-
1377
- count
1378
- Maximum number of occurrences to replace.
1379
- -1 (the default value) means replace all occurrences.
1380
-
1381
- If the optional argument count is given, only the first count occurrences are
1382
- replaced.
1383
- """
1384
- ...
1337
+ ) -> LiteralString: ...
1385
1338
  @overload
1386
- def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str:
1387
- """
1388
- Return a copy with all occurrences of substring old replaced by new.
1389
-
1390
- count
1391
- Maximum number of occurrences to replace.
1392
- -1 (the default value) means replace all occurrences.
1393
-
1394
- If the optional argument count is given, only the first count occurrences are
1395
- replaced.
1396
- """
1397
- ...
1339
+ def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
1398
1340
  if sys.version_info >= (3, 9):
1399
1341
  @overload
1400
1342
  def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString:
@@ -3055,15 +2997,7 @@ class memoryview(Sequence[_I]):
3055
2997
  """
3056
2998
  ...
3057
2999
  else:
3058
- def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes:
3059
- """
3060
- Return the data in the buffer as a byte string. Order can be {'C', 'F', 'A'}.
3061
- When order is 'C' or 'F', the data of the original array is converted to C or
3062
- Fortran order. For contiguous views, 'A' returns an exact copy of the physical
3063
- memory. In particular, in-memory Fortran order is preserved. For non-contiguous
3064
- views, the data is converted to C first. order=None is the same as order='C'.
3065
- """
3066
- ...
3000
+ def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes: ...
3067
3001
 
3068
3002
  def tolist(self) -> list[int]:
3069
3003
  """Return the data in the buffer as a list of elements."""
@@ -4242,17 +4176,7 @@ else:
4242
4176
  globals: dict[str, Any] | None = None,
4243
4177
  locals: Mapping[str, object] | None = None,
4244
4178
  /,
4245
- ) -> Any:
4246
- """
4247
- Evaluate the given source in the context of globals and locals.
4248
-
4249
- The source may be a string representing a Python expression
4250
- or a code object as returned by compile().
4251
- The globals must be a dictionary and locals can be any mapping,
4252
- defaulting to the current globals and locals.
4253
- If only globals is given, locals defaults to it.
4254
- """
4255
- ...
4179
+ ) -> Any: ...
4256
4180
 
4257
4181
  # Comment above regarding `eval` applies to `exec` as well
4258
4182
  if sys.version_info >= (3, 13):
@@ -4285,19 +4209,7 @@ elif sys.version_info >= (3, 11):
4285
4209
  /,
4286
4210
  *,
4287
4211
  closure: tuple[CellType, ...] | None = None,
4288
- ) -> None:
4289
- """
4290
- Execute the given source in the context of globals and locals.
4291
-
4292
- The source may be a string representing one or more Python statements
4293
- or a code object as returned by compile().
4294
- The globals must be a dictionary and locals can be any mapping,
4295
- defaulting to the current globals and locals.
4296
- If only globals is given, locals defaults to it.
4297
- The closure must be a tuple of cellvars, and can only be used
4298
- when source is a code object requiring exactly that many cellvars.
4299
- """
4300
- ...
4212
+ ) -> None: ...
4301
4213
 
4302
4214
  else:
4303
4215
  def exec(
@@ -4305,17 +4217,7 @@ else:
4305
4217
  globals: dict[str, Any] | None = None,
4306
4218
  locals: Mapping[str, object] | None = None,
4307
4219
  /,
4308
- ) -> None:
4309
- """
4310
- Execute the given source in the context of globals and locals.
4311
-
4312
- The source may be a string representing one or more Python statements
4313
- or a code object as returned by compile().
4314
- The globals must be a dictionary and locals can be any mapping,
4315
- defaulting to the current globals and locals.
4316
- If only globals is given, locals defaults to it.
4317
- """
4318
- ...
4220
+ ) -> None: ...
4319
4221
 
4320
4222
  def exit(code: sys._ExitCode = None) -> NoReturn: ...
4321
4223