basedpyright 1.13.2 → 1.13.3

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 (229) 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/VERSIONS +2 -0
  7. package/dist/typeshed-fallback/stdlib/_ast.pyi +42 -279
  8. package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
  9. package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
  10. package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +15 -5
  11. package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
  12. package/dist/typeshed-fallback/stdlib/_decimal.pyi +0 -18
  13. package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
  14. package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +180 -164
  15. package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
  16. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +16 -0
  17. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +50 -0
  18. package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
  19. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
  20. package/dist/typeshed-fallback/stdlib/_msi.pyi +94 -92
  21. package/dist/typeshed-fallback/stdlib/_operator.pyi +0 -24
  22. package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
  23. package/dist/typeshed-fallback/stdlib/_tkinter.pyi +6 -2
  24. package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +7 -1
  25. package/dist/typeshed-fallback/stdlib/abc.pyi +12 -4
  26. package/dist/typeshed-fallback/stdlib/argparse.pyi +3 -1
  27. package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
  28. package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
  29. package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +35 -4
  30. package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +107 -15
  31. package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +9 -3
  32. package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +10 -2
  33. package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +23 -4
  34. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +107 -12
  35. package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +86 -86
  36. package/dist/typeshed-fallback/stdlib/asyncio/windows_utils.pyi +49 -49
  37. package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
  38. package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
  39. package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
  40. package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
  41. package/dist/typeshed-fallback/stdlib/builtins.pyi +0 -1
  42. package/dist/typeshed-fallback/stdlib/bz2.pyi +59 -6
  43. package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
  44. package/dist/typeshed-fallback/stdlib/codecs.pyi +18 -6
  45. package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +200 -56
  46. package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +33 -14
  47. package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +7 -1
  48. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +7 -1
  49. package/dist/typeshed-fallback/stdlib/contextvars.pyi +99 -16
  50. package/dist/typeshed-fallback/stdlib/csv.pyi +14 -2
  51. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
  52. package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +6 -2
  53. package/dist/typeshed-fallback/stdlib/curses/panel.pyi +16 -4
  54. package/dist/typeshed-fallback/stdlib/dataclasses.pyi +7 -1
  55. package/dist/typeshed-fallback/stdlib/datetime.pyi +346 -104
  56. package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +52 -2
  57. package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +26 -2
  58. package/dist/typeshed-fallback/stdlib/difflib.pyi +7 -1
  59. package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
  60. package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
  61. package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
  62. package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +173 -173
  63. package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +99 -99
  64. package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +25 -25
  65. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +21 -21
  66. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +45 -45
  67. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +52 -52
  68. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
  69. package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +33 -33
  70. package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +27 -27
  71. package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +50 -50
  72. package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +44 -44
  73. package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +24 -24
  74. package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +39 -39
  75. package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +17 -17
  76. package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
  77. package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +65 -65
  78. package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +19 -19
  79. package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +18 -18
  80. package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +16 -16
  81. package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +25 -25
  82. package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +18 -18
  83. package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +20 -20
  84. package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +44 -44
  85. package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +17 -17
  86. package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
  87. package/dist/typeshed-fallback/stdlib/distutils/core.pyi +57 -57
  88. package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
  89. package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +1 -1
  90. package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
  91. package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
  92. package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +149 -149
  93. package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
  94. package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
  95. package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
  96. package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
  97. package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
  98. package/dist/typeshed-fallback/stdlib/distutils/log.pyi +25 -25
  99. package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
  100. package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +6 -6
  101. package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
  102. package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
  103. package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
  104. package/dist/typeshed-fallback/stdlib/distutils/util.pyi +50 -50
  105. package/dist/typeshed-fallback/stdlib/distutils/version.pyi +38 -36
  106. package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
  107. package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +3 -1
  108. package/dist/typeshed-fallback/stdlib/email/charset.pyi +3 -1
  109. package/dist/typeshed-fallback/stdlib/email/header.pyi +3 -1
  110. package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +6 -1
  111. package/dist/typeshed-fallback/stdlib/enum.pyi +8 -1
  112. package/dist/typeshed-fallback/stdlib/filecmp.pyi +7 -1
  113. package/dist/typeshed-fallback/stdlib/fileinput.pyi +7 -1
  114. package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
  115. package/dist/typeshed-fallback/stdlib/fractions.pyi +6 -2
  116. package/dist/typeshed-fallback/stdlib/functools.pyi +65 -13
  117. package/dist/typeshed-fallback/stdlib/graphlib.pyi +7 -1
  118. package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -1
  119. package/dist/typeshed-fallback/stdlib/hashlib.pyi +42 -14
  120. package/dist/typeshed-fallback/stdlib/heapq.pyi +3 -1
  121. package/dist/typeshed-fallback/stdlib/hmac.pyi +30 -2
  122. package/dist/typeshed-fallback/stdlib/http/cookies.pyi +7 -1
  123. package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
  124. package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +3 -1
  125. package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +3 -1
  126. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +79 -15
  127. package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +3 -1
  128. package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +3 -1
  129. package/dist/typeshed-fallback/stdlib/io.pyi +428 -44
  130. package/dist/typeshed-fallback/stdlib/ipaddress.pyi +153 -28
  131. package/dist/typeshed-fallback/stdlib/itertools.pyi +5 -1
  132. package/dist/typeshed-fallback/stdlib/json/encoder.pyi +14 -2
  133. package/dist/typeshed-fallback/stdlib/keyword.pyi +6 -2
  134. package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +12 -2
  135. package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +17 -3
  136. package/dist/typeshed-fallback/stdlib/lzma.pyi +107 -9
  137. package/dist/typeshed-fallback/stdlib/mailbox.pyi +14 -2
  138. package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
  139. package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -160
  140. package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
  141. package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
  142. package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
  143. package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
  144. package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +9 -3
  145. package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +12 -2
  146. package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +3 -1
  147. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +10 -2
  148. package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +7 -1
  149. package/dist/typeshed-fallback/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -30
  150. package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +15 -4
  151. package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +14 -2
  152. package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +19 -5
  153. package/dist/typeshed-fallback/stdlib/nis.pyi +31 -4
  154. package/dist/typeshed-fallback/stdlib/numbers.pyi +26 -6
  155. package/dist/typeshed-fallback/stdlib/opcode.pyi +3 -1
  156. package/dist/typeshed-fallback/stdlib/optparse.pyi +3 -1
  157. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1447 -217
  158. package/dist/typeshed-fallback/stdlib/pathlib.pyi +42 -11
  159. package/dist/typeshed-fallback/stdlib/pickle.pyi +200 -12
  160. package/dist/typeshed-fallback/stdlib/posixpath.pyi +6 -2
  161. package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +2 -0
  162. package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +2 -0
  163. package/dist/typeshed-fallback/stdlib/queue.pyi +57 -9
  164. package/dist/typeshed-fallback/stdlib/re.pyi +219 -57
  165. package/dist/typeshed-fallback/stdlib/sched.pyi +8 -1
  166. package/dist/typeshed-fallback/stdlib/signal.pyi +95 -19
  167. package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
  168. package/dist/typeshed-fallback/stdlib/socket.pyi +12 -2
  169. package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +417 -83
  170. package/dist/typeshed-fallback/stdlib/ssl.pyi +133 -22
  171. package/dist/typeshed-fallback/stdlib/statistics.pyi +20 -5
  172. package/dist/typeshed-fallback/stdlib/struct.pyi +114 -13
  173. package/dist/typeshed-fallback/stdlib/subprocess.pyi +14 -2
  174. package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
  175. package/dist/typeshed-fallback/stdlib/symtable.pyi +30 -1
  176. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -3
  177. package/dist/typeshed-fallback/stdlib/tarfile.pyi +6 -2
  178. package/dist/typeshed-fallback/stdlib/tempfile.pyi +17 -3
  179. package/dist/typeshed-fallback/stdlib/threading.pyi +68 -7
  180. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3 -1
  181. package/dist/typeshed-fallback/stdlib/turtle.pyi +11 -3
  182. package/dist/typeshed-fallback/stdlib/types.pyi +306 -79
  183. package/dist/typeshed-fallback/stdlib/typing.pyi +310 -31
  184. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +42 -11
  185. package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +6 -1
  186. package/dist/typeshed-fallback/stdlib/unittest/case.pyi +7 -1
  187. package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +3 -1
  188. package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +51 -3
  189. package/dist/typeshed-fallback/stdlib/weakref.pyi +6 -2
  190. package/dist/typeshed-fallback/stdlib/winsound.pyi +44 -28
  191. package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +6 -2
  192. package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +33 -11
  193. package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +30 -10
  194. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +2 -0
  195. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +2 -0
  196. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +19 -4
  197. package/dist/typeshed-fallback/stdlib/zipimport.pyi +31 -0
  198. package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
  199. package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +18 -6
  200. package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +2 -2
  201. package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +18 -1
  202. package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +5 -19
  203. package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +2 -1
  204. package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +268 -6
  205. package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +3 -7
  206. package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +10 -4
  207. package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +47 -0
  208. package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +1 -1
  209. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +1 -1
  210. package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
  211. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +0 -2
  212. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +2 -1
  213. package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
  214. package/dist/typeshed-fallback/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +2 -2
  215. package/dist/typeshed-fallback/stubs/python-crontab/METADATA.toml +1 -1
  216. package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
  217. package/dist/typeshed-fallback/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +23 -11
  218. package/dist/typeshed-fallback/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +6 -0
  219. package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
  220. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +8 -8
  221. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +11 -17
  222. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +11 -11
  223. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +1 -2
  224. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +4 -12
  225. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +2 -4
  226. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +5 -8
  227. package/dist/typeshed-fallback/stubs/str2bool/METADATA.toml +2 -0
  228. package/dist/typeshed-fallback/stubs/str2bool/str2bool/__init__.pyi +7 -0
  229. package/package.json +1 -1
@@ -32,21 +32,48 @@ class PurePath(PathLike[str]):
32
32
  def full_match(self, pattern: StrPath, *, case_sensitive: bool | None = None) -> bool: ...
33
33
 
34
34
  @property
35
- def parts(self) -> tuple[str, ...]: ...
35
+ def parts(self) -> tuple[str, ...]:
36
+ """
37
+ An object providing sequence-like access to the
38
+ components in the filesystem path.
39
+ """
40
+ ...
36
41
  @property
37
- def drive(self) -> str: ...
42
+ def drive(self) -> str:
43
+ """The drive prefix (letter or UNC path), if any."""
44
+ ...
38
45
  @property
39
- def root(self) -> str: ...
46
+ def root(self) -> str:
47
+ """The root of the path, if any."""
48
+ ...
40
49
  @property
41
- def anchor(self) -> str: ...
50
+ def anchor(self) -> str:
51
+ """The concatenation of the drive and root, or ''."""
52
+ ...
42
53
  @property
43
- def name(self) -> str: ...
54
+ def name(self) -> str:
55
+ """The final path component, if any."""
56
+ ...
44
57
  @property
45
- def suffix(self) -> str: ...
58
+ def suffix(self) -> str:
59
+ """
60
+ The final component's last suffix, if any.
61
+
62
+ This includes the leading period. For example: '.txt'
63
+ """
64
+ ...
46
65
  @property
47
- def suffixes(self) -> list[str]: ...
66
+ def suffixes(self) -> list[str]:
67
+ """
68
+ A list of the final component's suffixes, if any.
69
+
70
+ These include the leading periods. For example: ['.tar', '.gz']
71
+ """
72
+ ...
48
73
  @property
49
- def stem(self) -> str: ...
74
+ def stem(self) -> str:
75
+ """The final path component, minus its last suffix."""
76
+ ...
50
77
  if sys.version_info >= (3, 12):
51
78
  def __new__(cls, *args: StrPath, **kwargs: Unused) -> Self: ...
52
79
  def __init__(self, *args: StrPath) -> None: ...
@@ -88,9 +115,13 @@ class PurePath(PathLike[str]):
88
115
  def with_suffix(self, suffix: str) -> Self: ...
89
116
  def joinpath(self, *other: StrPath) -> Self: ...
90
117
  @property
91
- def parents(self) -> Sequence[Self]: ...
118
+ def parents(self) -> Sequence[Self]:
119
+ """A sequence of this path's logical parents."""
120
+ ...
92
121
  @property
93
- def parent(self) -> Self: ...
122
+ def parent(self) -> Self:
123
+ """The logical parent of the path."""
124
+ ...
94
125
  if sys.version_info >= (3, 9) and sys.version_info < (3, 11):
95
126
  def __class_getitem__(cls, type: Any) -> GenericAlias: ...
96
127
 
@@ -113,7 +144,7 @@ class Path(PurePath):
113
144
 
114
145
  if sys.version_info >= (3, 13):
115
146
  @classmethod
116
- def from_uri(cls, uri: str) -> Path: ...
147
+ def from_uri(cls, uri: str) -> Self: ...
117
148
  def is_dir(self, *, follow_symlinks: bool = True) -> bool: ...
118
149
  def is_file(self, *, follow_symlinks: bool = True) -> bool: ...
119
150
  def read_text(self, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> str: ...
@@ -100,10 +100,21 @@ class _ReadableFileobj(Protocol):
100
100
  @final
101
101
  class PickleBuffer:
102
102
  def __init__(self, buffer: ReadableBuffer) -> None: ...
103
- def raw(self) -> memoryview: ...
104
- def release(self) -> None: ...
105
- def __buffer__(self, flags: int, /) -> memoryview: ...
106
- def __release_buffer__(self, buffer: memoryview, /) -> None: ...
103
+ def raw(self) -> memoryview:
104
+ """
105
+ Return a memoryview of the raw memory underlying this buffer.
106
+ Will raise BufferError is the buffer isn't contiguous.
107
+ """
108
+ ...
109
+ def release(self) -> None:
110
+ """Release the underlying buffer exposed by the PickleBuffer object."""
111
+ ...
112
+ def __buffer__(self, flags: int, /) -> memoryview:
113
+ """Return a buffer object that exposes the underlying memory of the object."""
114
+ ...
115
+ def __release_buffer__(self, buffer: memoryview, /) -> None:
116
+ """Release the buffer object that exposes the underlying memory of the object."""
117
+ ...
107
118
 
108
119
  _BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None
109
120
 
@@ -114,10 +125,60 @@ def dump(
114
125
  *,
115
126
  fix_imports: bool = True,
116
127
  buffer_callback: _BufferCallback = None,
117
- ) -> None: ...
128
+ ) -> None:
129
+ """
130
+ Write a pickled representation of obj to the open file object file.
131
+
132
+ This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may
133
+ be more efficient.
134
+
135
+ The optional *protocol* argument tells the pickler to use the given
136
+ protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
137
+ protocol is 4. It was introduced in Python 3.4, and is incompatible
138
+ with previous versions.
139
+
140
+ Specifying a negative protocol version selects the highest protocol
141
+ version supported. The higher the protocol used, the more recent the
142
+ version of Python needed to read the pickle produced.
143
+
144
+ The *file* argument must have a write() method that accepts a single
145
+ bytes argument. It can thus be a file object opened for binary
146
+ writing, an io.BytesIO instance, or any other custom object that meets
147
+ this interface.
148
+
149
+ If *fix_imports* is True and protocol is less than 3, pickle will try
150
+ to map the new Python 3 names to the old module names used in Python
151
+ 2, so that the pickle data stream is readable with Python 2.
152
+
153
+ If *buffer_callback* is None (the default), buffer views are serialized
154
+ into *file* as part of the pickle stream. It is an error if
155
+ *buffer_callback* is not None and *protocol* is None or smaller than 5.
156
+ """
157
+ ...
118
158
  def dumps(
119
159
  obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None
120
- ) -> bytes: ...
160
+ ) -> bytes:
161
+ """
162
+ Return the pickled representation of the object as a bytes object.
163
+
164
+ The optional *protocol* argument tells the pickler to use the given
165
+ protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
166
+ protocol is 4. It was introduced in Python 3.4, and is incompatible
167
+ with previous versions.
168
+
169
+ Specifying a negative protocol version selects the highest protocol
170
+ version supported. The higher the protocol used, the more recent the
171
+ version of Python needed to read the pickle produced.
172
+
173
+ If *fix_imports* is True and *protocol* is less than 3, pickle will
174
+ try to map the new Python 3 names to the old module names used in
175
+ Python 2, so that the pickle data stream is readable with Python 2.
176
+
177
+ If *buffer_callback* is None (the default), buffer views are serialized
178
+ into *file* as part of the pickle stream. It is an error if
179
+ *buffer_callback* is not None and *protocol* is None or smaller than 5.
180
+ """
181
+ ...
121
182
  def load(
122
183
  file: _ReadableFileobj,
123
184
  *,
@@ -125,7 +186,33 @@ def load(
125
186
  encoding: str = "ASCII",
126
187
  errors: str = "strict",
127
188
  buffers: Iterable[Any] | None = (),
128
- ) -> Any: ...
189
+ ) -> Any:
190
+ """
191
+ Read and return an object from the pickle data stored in a file.
192
+
193
+ This is equivalent to ``Unpickler(file).load()``, but may be more
194
+ efficient.
195
+
196
+ The protocol version of the pickle is detected automatically, so no
197
+ protocol argument is needed. Bytes past the pickled object's
198
+ representation are ignored.
199
+
200
+ The argument *file* must have two methods, a read() method that takes
201
+ an integer argument, and a readline() method that requires no
202
+ arguments. Both methods should return bytes. Thus *file* can be a
203
+ binary file object opened for reading, an io.BytesIO object, or any
204
+ other custom object that meets this interface.
205
+
206
+ Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
207
+ which are used to control compatibility support for pickle stream
208
+ generated by Python 2. If *fix_imports* is True, pickle will try to
209
+ map the old Python 2 names to the new names used in Python 3. The
210
+ *encoding* and *errors* tell pickle how to decode 8-bit string
211
+ instances pickled by Python 2; these default to 'ASCII' and 'strict',
212
+ respectively. The *encoding* can be 'bytes' to read these 8-bit
213
+ string instances as bytes objects.
214
+ """
215
+ ...
129
216
  def loads(
130
217
  data: ReadableBuffer,
131
218
  /,
@@ -134,7 +221,24 @@ def loads(
134
221
  encoding: str = "ASCII",
135
222
  errors: str = "strict",
136
223
  buffers: Iterable[Any] | None = (),
137
- ) -> Any: ...
224
+ ) -> Any:
225
+ """
226
+ Read and return an object from the given pickle data.
227
+
228
+ The protocol version of the pickle is detected automatically, so no
229
+ protocol argument is needed. Bytes past the pickled object's
230
+ representation are ignored.
231
+
232
+ Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
233
+ which are used to control compatibility support for pickle stream
234
+ generated by Python 2. If *fix_imports* is True, pickle will try to
235
+ map the old Python 2 names to the new names used in Python 3. The
236
+ *encoding* and *errors* tell pickle how to decode 8-bit string
237
+ instances pickled by Python 2; these default to 'ASCII' and 'strict',
238
+ respectively. The *encoding* can be 'bytes' to read these 8-bit
239
+ string instances as bytes objects.
240
+ """
241
+ ...
138
242
 
139
243
  class PickleError(Exception): ...
140
244
  class PicklingError(PickleError): ...
@@ -149,6 +253,38 @@ _ReducedType: TypeAlias = (
149
253
  )
150
254
 
151
255
  class Pickler:
256
+ """
257
+ This takes a binary file for writing a pickle data stream.
258
+
259
+ The optional *protocol* argument tells the pickler to use the given
260
+ protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
261
+ protocol is 4. It was introduced in Python 3.4, and is incompatible
262
+ with previous versions.
263
+
264
+ Specifying a negative protocol version selects the highest protocol
265
+ version supported. The higher the protocol used, the more recent the
266
+ version of Python needed to read the pickle produced.
267
+
268
+ The *file* argument must have a write() method that accepts a single
269
+ bytes argument. It can thus be a file object opened for binary
270
+ writing, an io.BytesIO instance, or any other custom object that meets
271
+ this interface.
272
+
273
+ If *fix_imports* is True and protocol is less than 3, pickle will try
274
+ to map the new Python 3 names to the old module names used in Python
275
+ 2, so that the pickle data stream is readable with Python 2.
276
+
277
+ If *buffer_callback* is None (the default), buffer views are
278
+ serialized into *file* as part of the pickle stream.
279
+
280
+ If *buffer_callback* is not None, then it can be called any number
281
+ of times with a buffer view. If the callback returns a false value
282
+ (such as None), the given buffer is out-of-band; otherwise the
283
+ buffer is serialized in-band, i.e. inside the pickle stream.
284
+
285
+ It is an error if *buffer_callback* is not None and *protocol*
286
+ is None or smaller than 5.
287
+ """
152
288
  fast: bool
153
289
  dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
154
290
  bin: bool # undocumented
@@ -163,11 +299,44 @@ class Pickler:
163
299
  buffer_callback: _BufferCallback = ...,
164
300
  ) -> None: ...
165
301
  def reducer_override(self, obj: Any) -> Any: ...
166
- def dump(self, obj: Any, /) -> None: ...
167
- def clear_memo(self) -> None: ...
302
+ def dump(self, obj: Any, /) -> None:
303
+ """Write a pickled representation of the given object to the open file."""
304
+ ...
305
+ def clear_memo(self) -> None:
306
+ """
307
+ Clears the pickler's "memo".
308
+
309
+ The memo is the data structure that remembers which objects the
310
+ pickler has already seen, so that shared or recursive objects are
311
+ pickled by reference and not by value. This method is useful when
312
+ re-using picklers.
313
+ """
314
+ ...
168
315
  def persistent_id(self, obj: Any) -> Any: ...
169
316
 
170
317
  class Unpickler:
318
+ """
319
+ This takes a binary file for reading a pickle data stream.
320
+
321
+ The protocol version of the pickle is detected automatically, so no
322
+ protocol argument is needed. Bytes past the pickled object's
323
+ representation are ignored.
324
+
325
+ The argument *file* must have two methods, a read() method that takes
326
+ an integer argument, and a readline() method that requires no
327
+ arguments. Both methods should return bytes. Thus *file* can be a
328
+ binary file object opened for reading, an io.BytesIO object, or any
329
+ other custom object that meets this interface.
330
+
331
+ Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
332
+ which are used to control compatibility support for pickle stream
333
+ generated by Python 2. If *fix_imports* is True, pickle will try to
334
+ map the old Python 2 names to the new names used in Python 3. The
335
+ *encoding* and *errors* tell pickle how to decode 8-bit string
336
+ instances pickled by Python 2; these default to 'ASCII' and 'strict',
337
+ respectively. The *encoding* can be 'bytes' to read these 8-bit
338
+ string instances as bytes objects.
339
+ """
171
340
  dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only
172
341
 
173
342
  def __init__(
@@ -179,8 +348,27 @@ class Unpickler:
179
348
  errors: str = ...,
180
349
  buffers: Iterable[Any] | None = ...,
181
350
  ) -> None: ...
182
- def load(self) -> Any: ...
183
- def find_class(self, module_name: str, global_name: str, /) -> Any: ...
351
+ def load(self) -> Any:
352
+ """
353
+ Load a pickle.
354
+
355
+ Read a pickled object representation from the open file object given
356
+ in the constructor, and return the reconstituted object hierarchy
357
+ specified therein.
358
+ """
359
+ ...
360
+ def find_class(self, module_name: str, global_name: str, /) -> Any:
361
+ """
362
+ Return an object from a specified module.
363
+
364
+ If necessary, the module will be imported. Subclasses may override
365
+ this method (e.g. to restrict unpickling of arbitrary classes and
366
+ functions).
367
+
368
+ This method is called whenever a class or a function object is
369
+ needed. Both arguments passed are str objects.
370
+ """
371
+ ...
184
372
  def persistent_load(self, pid: Any) -> Any: ...
185
373
 
186
374
  MARK: bytes
@@ -93,9 +93,13 @@ def normcase(s: PathLike[AnyStr]) -> AnyStr: ...
93
93
  @overload
94
94
  def normcase(s: AnyOrLiteralStr) -> AnyOrLiteralStr: ...
95
95
  @overload
96
- def normpath(path: PathLike[AnyStr]) -> AnyStr: ...
96
+ def normpath(path: PathLike[AnyStr]) -> AnyStr:
97
+ """Normalize path, eliminating double slashes, etc."""
98
+ ...
97
99
  @overload
98
- def normpath(path: AnyOrLiteralStr) -> AnyOrLiteralStr: ...
100
+ def normpath(path: AnyOrLiteralStr) -> AnyOrLiteralStr:
101
+ """Normalize path, eliminating double slashes, etc."""
102
+ ...
99
103
  @overload
100
104
  def commonpath(paths: Iterable[LiteralString]) -> LiteralString: ...
101
105
  @overload
@@ -1,3 +1,5 @@
1
+ """Constants used to describe error conditions."""
2
+
1
3
  import sys
2
4
 
3
5
  codes: dict[str, int]
@@ -1,3 +1,5 @@
1
+ """Constants used to interpret content model information."""
2
+
1
3
  XML_CTYPE_ANY: int
2
4
  XML_CTYPE_CHOICE: int
3
5
  XML_CTYPE_EMPTY: int
@@ -11,7 +11,9 @@ if sys.version_info >= (3, 13):
11
11
 
12
12
  _T = TypeVar("_T")
13
13
 
14
- class Empty(Exception): ...
14
+ class Empty(Exception):
15
+ """Exception raised by Queue.get(block=0)/get_nowait()."""
16
+ ...
15
17
  class Full(Exception): ...
16
18
 
17
19
  if sys.version_info >= (3, 13):
@@ -48,7 +50,13 @@ class Queue(Generic[_T]):
48
50
  def _qsize(self) -> int: ...
49
51
  def task_done(self) -> None: ...
50
52
  if sys.version_info >= (3, 9):
51
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
53
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
54
+ """
55
+ Represent a PEP 585 generic type
56
+
57
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
58
+ """
59
+ ...
52
60
 
53
61
  class PriorityQueue(Queue[_T]):
54
62
  queue: list[_T]
@@ -57,12 +65,52 @@ class LifoQueue(Queue[_T]):
57
65
  queue: list[_T]
58
66
 
59
67
  class SimpleQueue(Generic[_T]):
68
+ """Simple, unbounded, reentrant FIFO queue."""
60
69
  def __init__(self) -> None: ...
61
- def empty(self) -> bool: ...
62
- def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
63
- def get_nowait(self) -> _T: ...
64
- def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
65
- def put_nowait(self, item: _T) -> None: ...
66
- def qsize(self) -> int: ...
70
+ def empty(self) -> bool:
71
+ """Return True if the queue is empty, False otherwise (not reliable!)."""
72
+ ...
73
+ def get(self, block: bool = True, timeout: float | None = None) -> _T:
74
+ """
75
+ Remove and return an item from the queue.
76
+
77
+ If optional args 'block' is true and 'timeout' is None (the default),
78
+ block if necessary until an item is available. If 'timeout' is
79
+ a non-negative number, it blocks at most 'timeout' seconds and raises
80
+ the Empty exception if no item was available within that time.
81
+ Otherwise ('block' is false), return an item if one is immediately
82
+ available, else raise the Empty exception ('timeout' is ignored
83
+ in that case).
84
+ """
85
+ ...
86
+ def get_nowait(self) -> _T:
87
+ """
88
+ Remove and return an item from the queue without blocking.
89
+
90
+ Only get an item if one is immediately available. Otherwise
91
+ raise the Empty exception.
92
+ """
93
+ ...
94
+ def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None:
95
+ """
96
+ Put the item on the queue.
97
+
98
+ The optional 'block' and 'timeout' arguments are ignored, as this method
99
+ never blocks. They are provided for compatibility with the Queue class.
100
+ """
101
+ ...
102
+ def put_nowait(self, item: _T) -> None:
103
+ """
104
+ Put an item into the queue without blocking.
105
+
106
+ This is exactly equivalent to `put(item)` and is only provided
107
+ for compatibility with the Queue class.
108
+ """
109
+ ...
110
+ def qsize(self) -> int:
111
+ """Return the approximate size of the queue (not reliable!)."""
112
+ ...
67
113
  if sys.version_info >= (3, 9):
68
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
114
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
115
+ """See PEP 585"""
116
+ ...