basedpyright 1.18.4 → 1.19.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 (45) 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/stdlib/_collections_abc.pyi +6 -2
  6. package/dist/typeshed-fallback/stdlib/_csv.pyi +1 -63
  7. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +29 -3
  8. package/dist/typeshed-fallback/stdlib/_interpchannels.pyi +258 -86
  9. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +100 -16
  10. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +204 -50
  11. package/dist/typeshed-fallback/stdlib/_json.pyi +1 -1
  12. package/dist/typeshed-fallback/stdlib/_socket.pyi +5 -26
  13. package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +24 -9
  14. package/dist/typeshed-fallback/stdlib/_stat.pyi +13 -2
  15. package/dist/typeshed-fallback/stdlib/_thread.pyi +35 -93
  16. package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +3 -1
  17. package/dist/typeshed-fallback/stdlib/atexit.pyi +6 -20
  18. package/dist/typeshed-fallback/stdlib/builtins.pyi +250 -251
  19. package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +8 -7
  20. package/dist/typeshed-fallback/stdlib/datetime.pyi +9 -3
  21. package/dist/typeshed-fallback/stdlib/dbm/sqlite3.pyi +29 -29
  22. package/dist/typeshed-fallback/stdlib/dis.pyi +33 -7
  23. package/dist/typeshed-fallback/stdlib/functools.pyi +2 -2
  24. package/dist/typeshed-fallback/stdlib/gc.pyi +5 -11
  25. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +17 -2
  26. package/dist/typeshed-fallback/stdlib/importlib/metadata/diagnose.pyi +2 -2
  27. package/dist/typeshed-fallback/stdlib/importlib/resources/_functional.pyi +30 -30
  28. package/dist/typeshed-fallback/stdlib/io.pyi +3 -1
  29. package/dist/typeshed-fallback/stdlib/ipaddress.pyi +8 -1
  30. package/dist/typeshed-fallback/stdlib/itertools.pyi +3 -6
  31. package/dist/typeshed-fallback/stdlib/marshal.pyi +61 -4
  32. package/dist/typeshed-fallback/stdlib/math.pyi +7 -1
  33. package/dist/typeshed-fallback/stdlib/mmap.pyi +1 -1
  34. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +14 -2
  35. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +43 -9
  36. package/dist/typeshed-fallback/stdlib/posixpath.pyi +14 -2
  37. package/dist/typeshed-fallback/stdlib/signal.pyi +2 -3
  38. package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +54 -6
  39. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +11 -17
  40. package/dist/typeshed-fallback/stdlib/threading.pyi +44 -16
  41. package/dist/typeshed-fallback/stdlib/time.pyi +2 -10
  42. package/dist/typeshed-fallback/stdlib/types.pyi +31 -13
  43. package/dist/typeshed-fallback/stdlib/typing.pyi +6 -2
  44. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +2 -2
  45. package/package.json +1 -1
@@ -253,20 +253,21 @@ class deque(MutableSequence[_T]):
253
253
  """Return a shallow copy of a deque."""
254
254
  ...
255
255
  def count(self, x: _T, /) -> int:
256
- """D.count(value) -- return number of occurrences of value"""
256
+ """Return number of occurrences of value."""
257
257
  ...
258
258
  def extend(self, iterable: Iterable[_T], /) -> None:
259
- """Extend the right side of the deque with elements from the iterable"""
259
+ """Extend the right side of the deque with elements from the iterable."""
260
260
  ...
261
261
  def extendleft(self, iterable: Iterable[_T], /) -> None:
262
- """Extend the left side of the deque with elements from the iterable"""
262
+ """Extend the left side of the deque with elements from the iterable."""
263
263
  ...
264
264
  def insert(self, i: int, x: _T, /) -> None:
265
- """D.insert(index, object) -- insert object before index"""
265
+ """Insert value before index."""
266
266
  ...
267
267
  def index(self, x: _T, start: int = 0, stop: int = ..., /) -> int:
268
268
  """
269
- D.index(value, [start, [stop]]) -- return first index of value.
269
+ Return first index of value.
270
+
270
271
  Raises ValueError if the value is not present.
271
272
  """
272
273
  ...
@@ -277,10 +278,10 @@ class deque(MutableSequence[_T]):
277
278
  """Remove and return the leftmost element."""
278
279
  ...
279
280
  def remove(self, value: _T, /) -> None:
280
- """D.remove(value) -- remove first occurrence of value."""
281
+ """Remove first occurrence of value."""
281
282
  ...
282
283
  def rotate(self, n: int = 1, /) -> None:
283
- """Rotate the deque n steps to the right (default n=1). If n is negative, rotates left."""
284
+ """Rotate the deque n steps to the right. If n is negative, rotates left."""
284
285
  ...
285
286
  def __copy__(self) -> Self:
286
287
  """Return a shallow copy of a deque."""
@@ -131,7 +131,9 @@ class date:
131
131
  """Return proleptic Gregorian ordinal. January 1 of year 1 is day 1."""
132
132
  ...
133
133
  if sys.version_info >= (3, 13):
134
- def __replace__(self, /, *, year: SupportsIndex = ..., month: SupportsIndex = ..., day: SupportsIndex = ...) -> Self: ...
134
+ def __replace__(self, /, *, year: SupportsIndex = ..., month: SupportsIndex = ..., day: SupportsIndex = ...) -> Self:
135
+ """The same as replace()."""
136
+ ...
135
137
 
136
138
  def replace(self, year: SupportsIndex = ..., month: SupportsIndex = ..., day: SupportsIndex = ...) -> Self:
137
139
  """Return date with new specified fields."""
@@ -285,7 +287,9 @@ class time:
285
287
  microsecond: SupportsIndex = ...,
286
288
  tzinfo: _TzInfo | None = ...,
287
289
  fold: int = ...,
288
- ) -> Self: ...
290
+ ) -> Self:
291
+ """The same as replace()."""
292
+ ...
289
293
 
290
294
  def replace(
291
295
  self,
@@ -499,7 +503,9 @@ class datetime(date):
499
503
  microsecond: SupportsIndex = ...,
500
504
  tzinfo: _TzInfo | None = ...,
501
505
  fold: int = ...,
502
- ) -> Self: ...
506
+ ) -> Self:
507
+ """The same as replace()."""
508
+ ...
503
509
 
504
510
  def replace(
505
511
  self,
@@ -1,29 +1,29 @@
1
- from _typeshed import ReadableBuffer, StrOrBytesPath, Unused
2
- from collections.abc import Generator, MutableMapping
3
- from typing import Final, Literal
4
- from typing_extensions import LiteralString, Self, TypeAlias
5
-
6
- BUILD_TABLE: Final[LiteralString]
7
- GET_SIZE: Final[LiteralString]
8
- LOOKUP_KEY: Final[LiteralString]
9
- STORE_KV: Final[LiteralString]
10
- DELETE_KEY: Final[LiteralString]
11
- ITER_KEYS: Final[LiteralString]
12
-
13
- _SqliteData: TypeAlias = str | ReadableBuffer | int | float
14
-
15
- class error(OSError): ...
16
-
17
- class _Database(MutableMapping[bytes, bytes]):
18
- def __init__(self, path: StrOrBytesPath, /, *, flag: Literal["r", "w", "c", "n"], mode: int) -> None: ...
19
- def __len__(self) -> int: ...
20
- def __getitem__(self, key: _SqliteData) -> bytes: ...
21
- def __setitem__(self, key: _SqliteData, value: _SqliteData) -> None: ...
22
- def __delitem__(self, key: _SqliteData) -> None: ...
23
- def __iter__(self) -> Generator[bytes]: ...
24
- def close(self) -> None: ...
25
- def keys(self) -> list[bytes]: ... # type: ignore[override]
26
- def __enter__(self) -> Self: ...
27
- def __exit__(self, *args: Unused) -> None: ...
28
-
29
- def open(filename: StrOrBytesPath, /, flag: Literal["r", "w,", "c", "n"] = "r", mode: int = 0o666) -> _Database: ...
1
+ from _typeshed import ReadableBuffer, StrOrBytesPath, Unused
2
+ from collections.abc import Generator, MutableMapping
3
+ from typing import Final, Literal
4
+ from typing_extensions import LiteralString, Self, TypeAlias
5
+
6
+ BUILD_TABLE: Final[LiteralString]
7
+ GET_SIZE: Final[LiteralString]
8
+ LOOKUP_KEY: Final[LiteralString]
9
+ STORE_KV: Final[LiteralString]
10
+ DELETE_KEY: Final[LiteralString]
11
+ ITER_KEYS: Final[LiteralString]
12
+
13
+ _SqliteData: TypeAlias = str | ReadableBuffer | int | float
14
+
15
+ class error(OSError): ...
16
+
17
+ class _Database(MutableMapping[bytes, bytes]):
18
+ def __init__(self, path: StrOrBytesPath, /, *, flag: Literal["r", "w", "c", "n"], mode: int) -> None: ...
19
+ def __len__(self) -> int: ...
20
+ def __getitem__(self, key: _SqliteData) -> bytes: ...
21
+ def __setitem__(self, key: _SqliteData, value: _SqliteData) -> None: ...
22
+ def __delitem__(self, key: _SqliteData) -> None: ...
23
+ def __iter__(self) -> Generator[bytes]: ...
24
+ def close(self) -> None: ...
25
+ def keys(self) -> list[bytes]: ... # type: ignore[override]
26
+ def __enter__(self) -> Self: ...
27
+ def __exit__(self, *args: Unused) -> None: ...
28
+
29
+ def open(filename: StrOrBytesPath, /, flag: Literal["r", "w,", "c", "n"] = "r", mode: int = 0o666) -> _Database: ...
@@ -93,19 +93,45 @@ class Instruction(_Instruction):
93
93
  def _disassemble(self, lineno_width: int = 3, mark_as_current: bool = False, offset_width: int = 4) -> str: ...
94
94
  if sys.version_info >= (3, 13):
95
95
  @property
96
- def oparg(self) -> int: ...
96
+ def oparg(self) -> int:
97
+ """Alias for Instruction.arg."""
98
+ ...
97
99
  @property
98
- def baseopcode(self) -> int: ...
100
+ def baseopcode(self) -> int:
101
+ """
102
+ Numeric code for the base operation if operation is specialized.
103
+
104
+ Otherwise equal to Instruction.opcode.
105
+ """
106
+ ...
99
107
  @property
100
- def baseopname(self) -> str: ...
108
+ def baseopname(self) -> str:
109
+ """
110
+ Human readable name for the base operation if operation is specialized.
111
+
112
+ Otherwise equal to Instruction.opname.
113
+ """
114
+ ...
101
115
  @property
102
- def cache_offset(self) -> int: ...
116
+ def cache_offset(self) -> int:
117
+ """Start index of the cache entries following the operation."""
118
+ ...
103
119
  @property
104
- def end_offset(self) -> int: ...
120
+ def end_offset(self) -> int:
121
+ """End index of the cache entries following the operation."""
122
+ ...
105
123
  @property
106
- def jump_target(self) -> int: ...
124
+ def jump_target(self) -> int:
125
+ """
126
+ Bytecode index of the jump target if this is a jump operation.
127
+
128
+ Otherwise return None.
129
+ """
130
+ ...
107
131
  @property
108
- def is_jump_target(self) -> bool: ...
132
+ def is_jump_target(self) -> bool:
133
+ """True if other code jumps to here, otherwise False"""
134
+ ...
109
135
 
110
136
  class Bytecode:
111
137
  codeobj: types.CodeType
@@ -38,7 +38,7 @@ _RWrapper = TypeVar("_RWrapper")
38
38
  @overload
39
39
  def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T, /) -> _T:
40
40
  """
41
- reduce(function, iterable[, initial]) -> value
41
+ reduce(function, iterable[, initial], /) -> value
42
42
 
43
43
  Apply a function of two arguments cumulatively to the items of a sequence
44
44
  or iterable, from left to right, so as to reduce the iterable to a single
@@ -51,7 +51,7 @@ def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T
51
51
  @overload
52
52
  def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T], /) -> _T:
53
53
  """
54
- reduce(function, iterable[, initial]) -> value
54
+ reduce(function, iterable[, initial], /) -> value
55
55
 
56
56
  Apply a function of two arguments cumulatively to the items of a sequence
57
57
  or iterable, from left to right, so as to reduce the iterable to a single
@@ -91,16 +91,10 @@ def get_freeze_count() -> int:
91
91
  """Return the number of objects in the permanent generation."""
92
92
  ...
93
93
  def get_referents(*objs: Any) -> list[Any]:
94
- """
95
- get_referents(*objs) -> list
96
- Return the list of objects that are directly referred to by objs.
97
- """
94
+ """Return the list of objects that are directly referred to by 'objs'."""
98
95
  ...
99
96
  def get_referrers(*objs: Any) -> list[Any]:
100
- """
101
- get_referrers(*objs) -> list
102
- Return the list of objects that directly refer to any of objs.
103
- """
97
+ """Return the list of objects that directly refer to any of 'objs'."""
104
98
  ...
105
99
  def get_stats() -> list[dict[str, Any]]:
106
100
  """Return a list of dictionaries containing per-generation statistics."""
@@ -142,9 +136,9 @@ def set_debug(flags: int, /) -> None:
142
136
  ...
143
137
  def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ..., /) -> None:
144
138
  """
145
- set_threshold(threshold0, [threshold1, threshold2]) -> None
139
+ set_threshold(threshold0, [threshold1, [threshold2]])
140
+ Set the collection thresholds (the collection frequency).
146
141
 
147
- Sets the collection thresholds. Setting threshold0 to zero disables
148
- collection.
142
+ Setting 'threshold0' to zero disables collection.
149
143
  """
150
144
  ...
@@ -239,11 +239,22 @@ class Distribution(_distribution_parent):
239
239
  Return the parsed metadata for this Distribution.
240
240
 
241
241
  The returned object will have keys that name the various bits of
242
- metadata. See PEP 566 for details.
242
+ metadata per the
243
+ `Core metadata specifications <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_.
244
+
245
+ Custom providers may provide the METADATA file or override this
246
+ property.
243
247
  """
244
248
  ...
245
249
  @property
246
- def entry_points(self) -> EntryPoints: ...
250
+ def entry_points(self) -> EntryPoints:
251
+ """
252
+ Return EntryPoints for this distribution.
253
+
254
+ Custom providers may provide the ``entry_points.txt`` file
255
+ or override this property.
256
+ """
257
+ ...
247
258
  else:
248
259
  @property
249
260
  def metadata(self) -> Message:
@@ -272,6 +283,10 @@ class Distribution(_distribution_parent):
272
283
  (i.e. RECORD for dist-info, or installed-files.txt or
273
284
  SOURCES.txt for egg-info) is missing.
274
285
  Result may be empty if the metadata exists but is empty.
286
+
287
+ Custom providers are recommended to provide a "RECORD" file (in
288
+ ``read_text``) or override this property to allow for callers to be
289
+ able to resolve filenames provided by the package.
275
290
  """
276
291
  ...
277
292
  @property
@@ -1,2 +1,2 @@
1
- def inspect(path: str) -> None: ...
2
- def run() -> None: ...
1
+ def inspect(path: str) -> None: ...
2
+ def run() -> None: ...
@@ -1,30 +1,30 @@
1
- import sys
2
-
3
- # Even though this file is 3.13+ only, Pyright will complain in stubtest for older versions.
4
- if sys.version_info >= (3, 13):
5
- from _typeshed import StrPath
6
- from collections.abc import Iterator
7
- from contextlib import AbstractContextManager
8
- from importlib.resources._common import Anchor
9
- from io import TextIOWrapper
10
- from pathlib import Path
11
- from typing import BinaryIO, overload
12
- from typing_extensions import Unpack
13
-
14
- def open_binary(anchor: Anchor, *path_names: StrPath) -> BinaryIO: ...
15
- @overload
16
- def open_text(
17
- anchor: Anchor, *path_names: Unpack[tuple[StrPath]], encoding: str | None = "utf-8", errors: str | None = "strict"
18
- ) -> TextIOWrapper: ...
19
- @overload
20
- def open_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> TextIOWrapper: ...
21
- def read_binary(anchor: Anchor, *path_names: StrPath) -> bytes: ...
22
- @overload
23
- def read_text(
24
- anchor: Anchor, *path_names: Unpack[tuple[StrPath]], encoding: str | None = "utf-8", errors: str | None = "strict"
25
- ) -> str: ...
26
- @overload
27
- def read_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> str: ...
28
- def path(anchor: Anchor, *path_names: StrPath) -> AbstractContextManager[Path]: ...
29
- def is_resource(anchor: Anchor, *path_names: StrPath) -> bool: ...
30
- def contents(anchor: Anchor, *path_names: StrPath) -> Iterator[str]: ...
1
+ import sys
2
+
3
+ # Even though this file is 3.13+ only, Pyright will complain in stubtest for older versions.
4
+ if sys.version_info >= (3, 13):
5
+ from _typeshed import StrPath
6
+ from collections.abc import Iterator
7
+ from contextlib import AbstractContextManager
8
+ from importlib.resources._common import Anchor
9
+ from io import TextIOWrapper
10
+ from pathlib import Path
11
+ from typing import BinaryIO, overload
12
+ from typing_extensions import Unpack
13
+
14
+ def open_binary(anchor: Anchor, *path_names: StrPath) -> BinaryIO: ...
15
+ @overload
16
+ def open_text(
17
+ anchor: Anchor, *path_names: Unpack[tuple[StrPath]], encoding: str | None = "utf-8", errors: str | None = "strict"
18
+ ) -> TextIOWrapper: ...
19
+ @overload
20
+ def open_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> TextIOWrapper: ...
21
+ def read_binary(anchor: Anchor, *path_names: StrPath) -> bytes: ...
22
+ @overload
23
+ def read_text(
24
+ anchor: Anchor, *path_names: Unpack[tuple[StrPath]], encoding: str | None = "utf-8", errors: str | None = "strict"
25
+ ) -> str: ...
26
+ @overload
27
+ def read_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> str: ...
28
+ def path(anchor: Anchor, *path_names: StrPath) -> AbstractContextManager[Path]: ...
29
+ def is_resource(anchor: Anchor, *path_names: StrPath) -> bool: ...
30
+ def contents(anchor: Anchor, *path_names: StrPath) -> Iterator[str]: ...
@@ -178,7 +178,9 @@ class IOBase(metaclass=abc.ABCMeta):
178
178
  terminator(s) recognized.
179
179
  """
180
180
  ...
181
- def __del__(self) -> None: ...
181
+ def __del__(self) -> None:
182
+ """Called when the instance is about to be destroyed."""
183
+ ...
182
184
  @property
183
185
  def closed(self) -> bool: ...
184
186
  def _checkClosed(self) -> None: ... # undocumented
@@ -219,7 +219,14 @@ class _BaseV4:
219
219
  class IPv4Address(_BaseV4, _BaseAddress):
220
220
  if sys.version_info >= (3, 13):
221
221
  @property
222
- def ipv6_mapped(self) -> IPv6Address: ...
222
+ def ipv6_mapped(self) -> IPv6Address:
223
+ """
224
+ Return the IPv4-mapped IPv6 address.
225
+
226
+ Returns:
227
+ The IPv4-mapped IPv6 address per RFC 4291.
228
+ """
229
+ ...
223
230
 
224
231
  class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): ...
225
232
 
@@ -129,8 +129,6 @@ class accumulate(Iterator[_T]):
129
129
 
130
130
  class chain(Iterator[_T]):
131
131
  """
132
- chain(*iterables) --> chain object
133
-
134
132
  Return a chain object whose .__next__() method returns elements from the
135
133
  first iterable until it is exhausted, then elements from the next
136
134
  iterable, until all of the iterables are exhausted.
@@ -266,8 +264,6 @@ def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]:
266
264
 
267
265
  class zip_longest(Iterator[_T_co]):
268
266
  """
269
- zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object
270
-
271
267
  Return a zip_longest object whose .__next__() method returns a tuple where
272
268
  the i-th element comes from the i-th iterable argument. The .__next__()
273
269
  method continues until the longest iterable in the argument sequence
@@ -358,8 +354,6 @@ class zip_longest(Iterator[_T_co]):
358
354
 
359
355
  class product(Iterator[_T_co]):
360
356
  """
361
- product(*iterables, repeat=1) --> product object
362
-
363
357
  Cartesian product of input iterables. Equivalent to nested for-loops.
364
358
 
365
359
  For example, product(A, B) returns the same as: ((x,y) for x in A for y in B).
@@ -562,6 +556,9 @@ if sys.version_info >= (3, 12):
562
556
  ('A', 'B', 'C')
563
557
  ('D', 'E', 'F')
564
558
  ('G',)
559
+
560
+ If "strict" is True, raises a ValueError if the final batch is shorter
561
+ than n.
565
562
  """
566
563
  if sys.version_info >= (3, 13):
567
564
  def __new__(cls, iterable: Iterable[_T_co], n: int, *, strict: bool = False) -> Self: ...
@@ -59,10 +59,67 @@ _Marshallable: TypeAlias = (
59
59
  )
60
60
 
61
61
  if sys.version_info >= (3, 13):
62
- def dump(value: _Marshallable, file: SupportsWrite[bytes], version: int = 4, /, *, allow_code: bool = True) -> None: ...
63
- def load(file: SupportsRead[bytes], /, *, allow_code: bool = True) -> Any: ...
64
- def dumps(value: _Marshallable, version: int = 4, /, *, allow_code: bool = True) -> bytes: ...
65
- def loads(bytes: ReadableBuffer, /, *, allow_code: bool = True) -> Any: ...
62
+ def dump(value: _Marshallable, file: SupportsWrite[bytes], version: int = 4, /, *, allow_code: bool = True) -> None:
63
+ """
64
+ Write the value on the open file.
65
+
66
+ value
67
+ Must be a supported type.
68
+ file
69
+ Must be a writeable binary file.
70
+ version
71
+ Indicates the data format that dump should use.
72
+ allow_code
73
+ Allow to write code objects.
74
+
75
+ If the value has (or contains an object that has) an unsupported type, a
76
+ ValueError exception is raised - but garbage data will also be written
77
+ to the file. The object will not be properly read back by load().
78
+ """
79
+ ...
80
+ def load(file: SupportsRead[bytes], /, *, allow_code: bool = True) -> Any:
81
+ """
82
+ Read one value from the open file and return it.
83
+
84
+ file
85
+ Must be readable binary file.
86
+ allow_code
87
+ Allow to load code objects.
88
+
89
+ If no valid value is read (e.g. because the data has a different Python
90
+ version's incompatible marshal format), raise EOFError, ValueError or
91
+ TypeError.
92
+
93
+ Note: If an object containing an unsupported type was marshalled with
94
+ dump(), load() will substitute None for the unmarshallable type.
95
+ """
96
+ ...
97
+ def dumps(value: _Marshallable, version: int = 4, /, *, allow_code: bool = True) -> bytes:
98
+ """
99
+ Return the bytes object that would be written to a file by dump(value, file).
100
+
101
+ value
102
+ Must be a supported type.
103
+ version
104
+ Indicates the data format that dumps should use.
105
+ allow_code
106
+ Allow to write code objects.
107
+
108
+ Raise a ValueError exception if value has (or contains an object that has) an
109
+ unsupported type.
110
+ """
111
+ ...
112
+ def loads(bytes: ReadableBuffer, /, *, allow_code: bool = True) -> Any:
113
+ """
114
+ Convert the bytes-like object to a value.
115
+
116
+ allow_code
117
+ Allow to load code objects.
118
+
119
+ If no valid value is found, raise EOFError, ValueError or TypeError. Extra
120
+ bytes in the input are ignored.
121
+ """
122
+ ...
66
123
 
67
124
  else:
68
125
  def dump(value: _Marshallable, file: SupportsWrite[bytes], version: int = 4, /) -> None:
@@ -433,4 +433,10 @@ if sys.version_info >= (3, 9):
433
433
  ...
434
434
 
435
435
  if sys.version_info >= (3, 13):
436
- def fma(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, z: _SupportsFloatOrIndex, /) -> float: ...
436
+ def fma(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, z: _SupportsFloatOrIndex, /) -> float:
437
+ """
438
+ Fused multiply-add operation.
439
+
440
+ Compute (x * y) + z with a single round.
441
+ """
442
+ ...
@@ -41,7 +41,7 @@ class mmap(Iterable[int], Sized):
41
41
  except that if the file is empty Windows raises an exception (you cannot
42
42
  create an empty mapping on Windows).
43
43
 
44
- Unix: mmap(fileno, length[, flags[, prot[, access[, offset]]]])
44
+ Unix: mmap(fileno, length[, flags[, prot[, access[, offset[, trackfd]]]]])
45
45
 
46
46
  Maps length bytes from the file specified by the file descriptor fileno,
47
47
  and returns a mmap object. If length is 0, the maximum length of the map
@@ -92,7 +92,13 @@ class DictProxy(BaseProxy, MutableMapping[_KT, _VT]):
92
92
  def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override]
93
93
  def values(self) -> list[_VT]: ... # type: ignore[override]
94
94
  if sys.version_info >= (3, 13):
95
- def __class_getitem__(cls, args: Any, /) -> Any: ...
95
+ def __class_getitem__(cls, args: Any, /) -> Any:
96
+ """
97
+ Represent a PEP 585 generic type
98
+
99
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
100
+ """
101
+ ...
96
102
 
97
103
  class BaseListProxy(BaseProxy, MutableSequence[_T]):
98
104
  __builtins__: ClassVar[dict[str, Any]]
@@ -128,7 +134,13 @@ class ListProxy(BaseListProxy[_T]):
128
134
  def __iadd__(self, value: Iterable[_T], /) -> Self: ... # type: ignore[override]
129
135
  def __imul__(self, value: SupportsIndex, /) -> Self: ... # type: ignore[override]
130
136
  if sys.version_info >= (3, 13):
131
- def __class_getitem__(cls, args: Any, /) -> Any: ...
137
+ def __class_getitem__(cls, args: Any, /) -> Any:
138
+ """
139
+ Represent a PEP 585 generic type
140
+
141
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
142
+ """
143
+ ...
132
144
 
133
145
  # Returned by BaseManager.get_server()
134
146
  class Server:
@@ -1096,7 +1096,7 @@ if sys.platform != "win32":
1096
1096
  Write bytes to a file descriptor starting at a particular offset.
1097
1097
 
1098
1098
  Write buffer to fd, starting at offset bytes from the beginning of
1099
- the file. Returns the number of bytes writte. Does not change the
1099
+ the file. Returns the number of bytes written. Does not change the
1100
1100
  current file offset.
1101
1101
  """
1102
1102
  ...
@@ -2224,11 +2224,9 @@ if sys.platform != "win32":
2224
2224
 
2225
2225
  def cpu_count() -> int | None:
2226
2226
  """
2227
- Return the number of CPUs in the system; return None if indeterminable.
2227
+ Return the number of logical CPUs in the system.
2228
2228
 
2229
- This number is not equivalent to the number of CPUs the current process can
2230
- use. The number of usable CPUs can be obtained with
2231
- ``len(os.sched_getaffinity(0))``
2229
+ Return None if indeterminable.
2232
2230
  """
2233
2231
  ...
2234
2232
 
@@ -2375,10 +2373,46 @@ if sys.version_info >= (3, 12) and sys.platform == "linux":
2375
2373
  def setns(fd: FileDescriptorLike, nstype: int = 0) -> None: ...
2376
2374
 
2377
2375
  if sys.version_info >= (3, 13) and sys.platform != "win32":
2378
- def posix_openpt(oflag: int, /) -> int: ...
2379
- def grantpt(fd: FileDescriptorLike, /) -> None: ...
2380
- def unlockpt(fd: FileDescriptorLike, /) -> None: ...
2381
- def ptsname(fd: FileDescriptorLike, /) -> str: ...
2376
+ def posix_openpt(oflag: int, /) -> int:
2377
+ """
2378
+ Open and return a file descriptor for a master pseudo-terminal device.
2379
+
2380
+ Performs a posix_openpt() C function call. The oflag argument is used to
2381
+ set file status flags and file access modes as specified in the manual page
2382
+ of posix_openpt() of your system.
2383
+ """
2384
+ ...
2385
+ def grantpt(fd: FileDescriptorLike, /) -> None:
2386
+ """
2387
+ Grant access to the slave pseudo-terminal device.
2388
+
2389
+ fd
2390
+ File descriptor of a master pseudo-terminal device.
2391
+
2392
+ Performs a grantpt() C function call.
2393
+ """
2394
+ ...
2395
+ def unlockpt(fd: FileDescriptorLike, /) -> None:
2396
+ """
2397
+ Unlock a pseudo-terminal master/slave pair.
2398
+
2399
+ fd
2400
+ File descriptor of a master pseudo-terminal device.
2401
+
2402
+ Performs an unlockpt() C function call.
2403
+ """
2404
+ ...
2405
+ def ptsname(fd: FileDescriptorLike, /) -> str:
2406
+ """
2407
+ Return the name of the slave pseudo-terminal device.
2408
+
2409
+ fd
2410
+ File descriptor of a master pseudo-terminal device.
2411
+
2412
+ If the ptsname_r() C function is available, it is called;
2413
+ otherwise, performs a ptsname() C function call.
2414
+ """
2415
+ ...
2382
2416
 
2383
2417
  if sys.version_info >= (3, 13) and sys.platform == "linux":
2384
2418
  TFD_TIMER_ABSTIME: Final = 1
@@ -155,6 +155,18 @@ def lexists(path: FileDescriptorOrPath) -> bool: ...
155
155
  if sys.version_info >= (3, 12):
156
156
  def isjunction(path: StrOrBytesPath) -> bool: ...
157
157
  @overload
158
- def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ...
158
+ def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]:
159
+ """
160
+ Split a pathname into drive, root and tail.
161
+
162
+ The tail contains anything after the root.
163
+ """
164
+ ...
159
165
  @overload
160
- def splitroot(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ...
166
+ def splitroot(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]:
167
+ """
168
+ Split a pathname into drive, root and tail.
169
+
170
+ The tail contains anything after the root.
171
+ """
172
+ ...
@@ -249,10 +249,9 @@ def raise_signal(signalnum: _SIGNUM, /) -> None:
249
249
  ...
250
250
  def set_wakeup_fd(fd: int, /, *, warn_on_full_buffer: bool = ...) -> int:
251
251
  """
252
- set_wakeup_fd(fd, *, warn_on_full_buffer=True) -> fd
252
+ Sets the fd to be written to (with the signal number) when a signal comes in.
253
253
 
254
- Sets the fd to be written to (with the signal number) when a signal
255
- comes in. A library can use this to wakeup select or poll.
254
+ A library can use this to wakeup select or poll.
256
255
  The previous fd or -1 is returned.
257
256
 
258
257
  The fd must be non-blocking.