basedpyright 1.31.6 → 1.31.7

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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/pyright-langserver.js +1 -1
  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 +6 -2
  7. package/dist/typeshed-fallback/stdlib/_compression.pyi +28 -28
  8. package/dist/typeshed-fallback/stdlib/_contextvars.pyi +6 -2
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +10 -51
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +187 -17
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +7 -1
  12. package/dist/typeshed-fallback/stdlib/_heapq.pyi +20 -5
  13. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +6 -6
  14. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +1 -7
  15. package/dist/typeshed-fallback/stdlib/_io.pyi +9 -5
  16. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +12 -20
  17. package/dist/typeshed-fallback/stdlib/_operator.pyi +6 -2
  18. package/dist/typeshed-fallback/stdlib/_pickle.pyi +3 -3
  19. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +26 -26
  20. package/dist/typeshed-fallback/stdlib/_socket.pyi +6 -18
  21. package/dist/typeshed-fallback/stdlib/_stat.pyi +1 -1
  22. package/dist/typeshed-fallback/stdlib/_thread.pyi +10 -2
  23. package/dist/typeshed-fallback/stdlib/_zstd.pyi +300 -97
  24. package/dist/typeshed-fallback/stdlib/annotationlib.pyi +146 -146
  25. package/dist/typeshed-fallback/stdlib/ast.pyi +256 -96
  26. package/dist/typeshed-fallback/stdlib/asyncio/graph.pyi +28 -28
  27. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +3 -1
  28. package/dist/typeshed-fallback/stdlib/asyncio/tools.pyi +46 -46
  29. package/dist/typeshed-fallback/stdlib/builtins.pyi +46 -36
  30. package/dist/typeshed-fallback/stdlib/compression/_common/_streams.pyi +26 -26
  31. package/dist/typeshed-fallback/stdlib/compression/bz2.pyi +1 -1
  32. package/dist/typeshed-fallback/stdlib/compression/gzip.pyi +1 -1
  33. package/dist/typeshed-fallback/stdlib/compression/lzma.pyi +1 -1
  34. package/dist/typeshed-fallback/stdlib/compression/zlib.pyi +1 -1
  35. package/dist/typeshed-fallback/stdlib/compression/zstd/__init__.pyi +88 -88
  36. package/dist/typeshed-fallback/stdlib/compression/zstd/_zstdfile.pyi +117 -117
  37. package/dist/typeshed-fallback/stdlib/concurrent/futures/interpreter.pyi +79 -79
  38. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +8 -8
  39. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/__init__.pyi +68 -68
  40. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/_crossinterp.pyi +30 -30
  41. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/_queues.pyi +74 -74
  42. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
  43. package/dist/typeshed-fallback/stdlib/datetime.pyi +6 -2
  44. package/dist/typeshed-fallback/stdlib/decimal.pyi +12 -1
  45. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +7 -5
  46. package/dist/typeshed-fallback/stdlib/functools.pyi +5 -9
  47. package/dist/typeshed-fallback/stdlib/gc.pyi +1 -1
  48. package/dist/typeshed-fallback/stdlib/marshal.pyi +6 -6
  49. package/dist/typeshed-fallback/stdlib/math.pyi +1 -3
  50. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +3 -1
  51. package/dist/typeshed-fallback/stdlib/numbers.pyi +2 -10
  52. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +15 -1
  53. package/dist/typeshed-fallback/stdlib/pathlib/__init__.pyi +6 -1
  54. package/dist/typeshed-fallback/stdlib/pathlib/types.pyi +8 -8
  55. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +1 -1
  56. package/dist/typeshed-fallback/stdlib/string/templatelib.pyi +46 -36
  57. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +25 -2
  58. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +7 -1
  59. package/dist/typeshed-fallback/stdlib/types.pyi +22 -8
  60. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +2 -2
  61. package/dist/typeshed-fallback/stdlib/winsound.pyi +4 -0
  62. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +3 -16
  63. package/package.json +1 -1
@@ -1,117 +1,117 @@
1
- from _typeshed import ReadableBuffer, StrOrBytesPath, SupportsWrite, WriteableBuffer
2
- from collections.abc import Mapping
3
- from compression._common import _streams
4
- from compression.zstd import ZstdDict
5
- from io import TextIOWrapper, _WrappedBuffer
6
- from typing import Literal, Protocol, overload, type_check_only
7
- from typing_extensions import TypeAlias
8
-
9
- from _zstd import ZstdCompressor, _ZstdCompressorFlushBlock, _ZstdCompressorFlushFrame
10
-
11
- __all__ = ("ZstdFile", "open")
12
-
13
- _ReadBinaryMode: TypeAlias = Literal["r", "rb"]
14
- _WriteBinaryMode: TypeAlias = Literal["w", "wb", "x", "xb", "a", "ab"]
15
- _ReadTextMode: TypeAlias = Literal["rt"]
16
- _WriteTextMode: TypeAlias = Literal["wt", "xt", "at"]
17
-
18
- @type_check_only
19
- class _FileBinaryRead(_streams._Reader, Protocol):
20
- def close(self) -> None: ...
21
-
22
- @type_check_only
23
- class _FileBinaryWrite(SupportsWrite[bytes], Protocol):
24
- def close(self) -> None: ...
25
-
26
- class ZstdFile(_streams.BaseStream):
27
- FLUSH_BLOCK = ZstdCompressor.FLUSH_BLOCK
28
- FLUSH_FRAME = ZstdCompressor.FLUSH_FRAME
29
-
30
- @overload
31
- def __init__(
32
- self,
33
- file: StrOrBytesPath | _FileBinaryRead,
34
- /,
35
- mode: _ReadBinaryMode = "r",
36
- *,
37
- level: None = None,
38
- options: Mapping[int, int] | None = None,
39
- zstd_dict: ZstdDict | None = None,
40
- ) -> None: ...
41
- @overload
42
- def __init__(
43
- self,
44
- file: StrOrBytesPath | _FileBinaryWrite,
45
- /,
46
- mode: _WriteBinaryMode,
47
- *,
48
- level: int | None = None,
49
- options: Mapping[int, int] | None = None,
50
- zstd_dict: ZstdDict | None = None,
51
- ) -> None: ...
52
- def write(self, data: ReadableBuffer, /) -> int: ...
53
- def flush(self, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 1) -> bytes: ... # type: ignore[override]
54
- def read(self, size: int | None = -1) -> bytes: ...
55
- def read1(self, size: int | None = -1) -> bytes: ...
56
- def readinto(self, b: WriteableBuffer) -> int: ...
57
- def readinto1(self, b: WriteableBuffer) -> int: ...
58
- def readline(self, size: int | None = -1) -> bytes: ...
59
- def seek(self, offset: int, whence: int = 0) -> int: ...
60
- def peek(self, size: int = -1) -> bytes: ...
61
- @property
62
- def name(self) -> str | bytes: ...
63
- @property
64
- def mode(self) -> Literal["rb", "wb"]: ...
65
-
66
- @overload
67
- def open(
68
- file: StrOrBytesPath | _FileBinaryRead,
69
- /,
70
- mode: _ReadBinaryMode = "rb",
71
- *,
72
- level: None = None,
73
- options: Mapping[int, int] | None = None,
74
- zstd_dict: ZstdDict | None = None,
75
- encoding: str | None = None,
76
- errors: str | None = None,
77
- newline: str | None = None,
78
- ) -> ZstdFile: ...
79
- @overload
80
- def open(
81
- file: StrOrBytesPath | _FileBinaryWrite,
82
- /,
83
- mode: _WriteBinaryMode,
84
- *,
85
- level: int | None = None,
86
- options: Mapping[int, int] | None = None,
87
- zstd_dict: ZstdDict | None = None,
88
- encoding: str | None = None,
89
- errors: str | None = None,
90
- newline: str | None = None,
91
- ) -> ZstdFile: ...
92
- @overload
93
- def open(
94
- file: StrOrBytesPath | _WrappedBuffer,
95
- /,
96
- mode: _ReadTextMode,
97
- *,
98
- level: None = None,
99
- options: Mapping[int, int] | None = None,
100
- zstd_dict: ZstdDict | None = None,
101
- encoding: str | None = None,
102
- errors: str | None = None,
103
- newline: str | None = None,
104
- ) -> TextIOWrapper: ...
105
- @overload
106
- def open(
107
- file: StrOrBytesPath | _WrappedBuffer,
108
- /,
109
- mode: _WriteTextMode,
110
- *,
111
- level: int | None = None,
112
- options: Mapping[int, int] | None = None,
113
- zstd_dict: ZstdDict | None = None,
114
- encoding: str | None = None,
115
- errors: str | None = None,
116
- newline: str | None = None,
117
- ) -> TextIOWrapper: ...
1
+ from _typeshed import ReadableBuffer, StrOrBytesPath, SupportsWrite, WriteableBuffer
2
+ from collections.abc import Mapping
3
+ from compression._common import _streams
4
+ from compression.zstd import ZstdDict
5
+ from io import TextIOWrapper, _WrappedBuffer
6
+ from typing import Literal, Protocol, overload, type_check_only
7
+ from typing_extensions import TypeAlias
8
+
9
+ from _zstd import ZstdCompressor, _ZstdCompressorFlushBlock, _ZstdCompressorFlushFrame
10
+
11
+ __all__ = ("ZstdFile", "open")
12
+
13
+ _ReadBinaryMode: TypeAlias = Literal["r", "rb"]
14
+ _WriteBinaryMode: TypeAlias = Literal["w", "wb", "x", "xb", "a", "ab"]
15
+ _ReadTextMode: TypeAlias = Literal["rt"]
16
+ _WriteTextMode: TypeAlias = Literal["wt", "xt", "at"]
17
+
18
+ @type_check_only
19
+ class _FileBinaryRead(_streams._Reader, Protocol):
20
+ def close(self) -> None: ...
21
+
22
+ @type_check_only
23
+ class _FileBinaryWrite(SupportsWrite[bytes], Protocol):
24
+ def close(self) -> None: ...
25
+
26
+ class ZstdFile(_streams.BaseStream):
27
+ FLUSH_BLOCK = ZstdCompressor.FLUSH_BLOCK
28
+ FLUSH_FRAME = ZstdCompressor.FLUSH_FRAME
29
+
30
+ @overload
31
+ def __init__(
32
+ self,
33
+ file: StrOrBytesPath | _FileBinaryRead,
34
+ /,
35
+ mode: _ReadBinaryMode = "r",
36
+ *,
37
+ level: None = None,
38
+ options: Mapping[int, int] | None = None,
39
+ zstd_dict: ZstdDict | None = None,
40
+ ) -> None: ...
41
+ @overload
42
+ def __init__(
43
+ self,
44
+ file: StrOrBytesPath | _FileBinaryWrite,
45
+ /,
46
+ mode: _WriteBinaryMode,
47
+ *,
48
+ level: int | None = None,
49
+ options: Mapping[int, int] | None = None,
50
+ zstd_dict: ZstdDict | None = None,
51
+ ) -> None: ...
52
+ def write(self, data: ReadableBuffer, /) -> int: ...
53
+ def flush(self, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 1) -> bytes: ... # type: ignore[override]
54
+ def read(self, size: int | None = -1) -> bytes: ...
55
+ def read1(self, size: int | None = -1) -> bytes: ...
56
+ def readinto(self, b: WriteableBuffer) -> int: ...
57
+ def readinto1(self, b: WriteableBuffer) -> int: ...
58
+ def readline(self, size: int | None = -1) -> bytes: ...
59
+ def seek(self, offset: int, whence: int = 0) -> int: ...
60
+ def peek(self, size: int = -1) -> bytes: ...
61
+ @property
62
+ def name(self) -> str | bytes: ...
63
+ @property
64
+ def mode(self) -> Literal["rb", "wb"]: ...
65
+
66
+ @overload
67
+ def open(
68
+ file: StrOrBytesPath | _FileBinaryRead,
69
+ /,
70
+ mode: _ReadBinaryMode = "rb",
71
+ *,
72
+ level: None = None,
73
+ options: Mapping[int, int] | None = None,
74
+ zstd_dict: ZstdDict | None = None,
75
+ encoding: str | None = None,
76
+ errors: str | None = None,
77
+ newline: str | None = None,
78
+ ) -> ZstdFile: ...
79
+ @overload
80
+ def open(
81
+ file: StrOrBytesPath | _FileBinaryWrite,
82
+ /,
83
+ mode: _WriteBinaryMode,
84
+ *,
85
+ level: int | None = None,
86
+ options: Mapping[int, int] | None = None,
87
+ zstd_dict: ZstdDict | None = None,
88
+ encoding: str | None = None,
89
+ errors: str | None = None,
90
+ newline: str | None = None,
91
+ ) -> ZstdFile: ...
92
+ @overload
93
+ def open(
94
+ file: StrOrBytesPath | _WrappedBuffer,
95
+ /,
96
+ mode: _ReadTextMode,
97
+ *,
98
+ level: None = None,
99
+ options: Mapping[int, int] | None = None,
100
+ zstd_dict: ZstdDict | None = None,
101
+ encoding: str | None = None,
102
+ errors: str | None = None,
103
+ newline: str | None = None,
104
+ ) -> TextIOWrapper: ...
105
+ @overload
106
+ def open(
107
+ file: StrOrBytesPath | _WrappedBuffer,
108
+ /,
109
+ mode: _WriteTextMode,
110
+ *,
111
+ level: int | None = None,
112
+ options: Mapping[int, int] | None = None,
113
+ zstd_dict: ZstdDict | None = None,
114
+ encoding: str | None = None,
115
+ errors: str | None = None,
116
+ newline: str | None = None,
117
+ ) -> TextIOWrapper: ...
@@ -1,79 +1,79 @@
1
- import sys
2
- from collections.abc import Callable
3
- from concurrent.futures import ThreadPoolExecutor
4
- from typing import Any, Literal, Protocol, overload, type_check_only
5
- from typing_extensions import ParamSpec, Self, TypeAlias, TypeVar, TypeVarTuple, Unpack
6
-
7
- _Task: TypeAlias = tuple[bytes, Literal["function", "script"]]
8
- _Ts = TypeVarTuple("_Ts")
9
- _P = ParamSpec("_P")
10
- _R = TypeVar("_R")
11
-
12
- @type_check_only
13
- class _TaskFunc(Protocol):
14
- @overload
15
- def __call__(self, fn: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> tuple[bytes, Literal["function"]]: ...
16
- @overload
17
- def __call__(self, fn: str) -> tuple[bytes, Literal["script"]]: ...
18
-
19
- if sys.version_info >= (3, 14):
20
- from concurrent.futures.thread import BrokenThreadPool, WorkerContext as ThreadWorkerContext
21
- from concurrent.interpreters import Interpreter, Queue
22
-
23
- def do_call(results: Queue, func: Callable[..., _R], args: tuple[Any, ...], kwargs: dict[str, Any]) -> _R: ...
24
-
25
- class WorkerContext(ThreadWorkerContext):
26
- interp: Interpreter | None
27
- results: Queue | None
28
- @overload # type: ignore[override]
29
- @classmethod
30
- def prepare(
31
- cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]
32
- ) -> tuple[Callable[[], Self], _TaskFunc]: ...
33
- @overload
34
- @classmethod
35
- def prepare(cls, initializer: Callable[[], object], initargs: tuple[()]) -> tuple[Callable[[], Self], _TaskFunc]: ...
36
- def __init__(self, initdata: _Task) -> None: ...
37
- def __del__(self) -> None: ...
38
- def run(self, task: _Task) -> None: ... # type: ignore[override]
39
-
40
- class BrokenInterpreterPool(BrokenThreadPool): ...
41
-
42
- class InterpreterPoolExecutor(ThreadPoolExecutor):
43
- BROKEN: type[BrokenInterpreterPool]
44
-
45
- @overload # type: ignore[override]
46
- @classmethod
47
- def prepare_context(
48
- cls, initializer: Callable[[], object], initargs: tuple[()]
49
- ) -> tuple[Callable[[], WorkerContext], _TaskFunc]: ...
50
- @overload
51
- @classmethod
52
- def prepare_context(
53
- cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]
54
- ) -> tuple[Callable[[], WorkerContext], _TaskFunc]: ...
55
- @overload
56
- def __init__(
57
- self,
58
- max_workers: int | None = None,
59
- thread_name_prefix: str = "",
60
- initializer: Callable[[], object] | None = None,
61
- initargs: tuple[()] = (),
62
- ) -> None: ...
63
- @overload
64
- def __init__(
65
- self,
66
- max_workers: int | None = None,
67
- thread_name_prefix: str = "",
68
- *,
69
- initializer: Callable[[Unpack[_Ts]], object],
70
- initargs: tuple[Unpack[_Ts]],
71
- ) -> None: ...
72
- @overload
73
- def __init__(
74
- self,
75
- max_workers: int | None,
76
- thread_name_prefix: str,
77
- initializer: Callable[[Unpack[_Ts]], object],
78
- initargs: tuple[Unpack[_Ts]],
79
- ) -> None: ...
1
+ import sys
2
+ from collections.abc import Callable
3
+ from concurrent.futures import ThreadPoolExecutor
4
+ from typing import Any, Literal, Protocol, overload, type_check_only
5
+ from typing_extensions import ParamSpec, Self, TypeAlias, TypeVar, TypeVarTuple, Unpack
6
+
7
+ _Task: TypeAlias = tuple[bytes, Literal["function", "script"]]
8
+ _Ts = TypeVarTuple("_Ts")
9
+ _P = ParamSpec("_P")
10
+ _R = TypeVar("_R")
11
+
12
+ @type_check_only
13
+ class _TaskFunc(Protocol):
14
+ @overload
15
+ def __call__(self, fn: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> tuple[bytes, Literal["function"]]: ...
16
+ @overload
17
+ def __call__(self, fn: str) -> tuple[bytes, Literal["script"]]: ...
18
+
19
+ if sys.version_info >= (3, 14):
20
+ from concurrent.futures.thread import BrokenThreadPool, WorkerContext as ThreadWorkerContext
21
+ from concurrent.interpreters import Interpreter, Queue
22
+
23
+ def do_call(results: Queue, func: Callable[..., _R], args: tuple[Any, ...], kwargs: dict[str, Any]) -> _R: ...
24
+
25
+ class WorkerContext(ThreadWorkerContext):
26
+ interp: Interpreter | None
27
+ results: Queue | None
28
+ @overload # type: ignore[override]
29
+ @classmethod
30
+ def prepare(
31
+ cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]
32
+ ) -> tuple[Callable[[], Self], _TaskFunc]: ...
33
+ @overload
34
+ @classmethod
35
+ def prepare(cls, initializer: Callable[[], object], initargs: tuple[()]) -> tuple[Callable[[], Self], _TaskFunc]: ...
36
+ def __init__(self, initdata: _Task) -> None: ...
37
+ def __del__(self) -> None: ...
38
+ def run(self, task: _Task) -> None: ... # type: ignore[override]
39
+
40
+ class BrokenInterpreterPool(BrokenThreadPool): ...
41
+
42
+ class InterpreterPoolExecutor(ThreadPoolExecutor):
43
+ BROKEN: type[BrokenInterpreterPool]
44
+
45
+ @overload # type: ignore[override]
46
+ @classmethod
47
+ def prepare_context(
48
+ cls, initializer: Callable[[], object], initargs: tuple[()]
49
+ ) -> tuple[Callable[[], WorkerContext], _TaskFunc]: ...
50
+ @overload
51
+ @classmethod
52
+ def prepare_context(
53
+ cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]
54
+ ) -> tuple[Callable[[], WorkerContext], _TaskFunc]: ...
55
+ @overload
56
+ def __init__(
57
+ self,
58
+ max_workers: int | None = None,
59
+ thread_name_prefix: str = "",
60
+ initializer: Callable[[], object] | None = None,
61
+ initargs: tuple[()] = (),
62
+ ) -> None: ...
63
+ @overload
64
+ def __init__(
65
+ self,
66
+ max_workers: int | None = None,
67
+ thread_name_prefix: str = "",
68
+ *,
69
+ initializer: Callable[[Unpack[_Ts]], object],
70
+ initargs: tuple[Unpack[_Ts]],
71
+ ) -> None: ...
72
+ @overload
73
+ def __init__(
74
+ self,
75
+ max_workers: int | None,
76
+ thread_name_prefix: str,
77
+ initializer: Callable[[Unpack[_Ts]], object],
78
+ initargs: tuple[Unpack[_Ts]],
79
+ ) -> None: ...
@@ -57,7 +57,13 @@ if sys.version_info >= (3, 14):
57
57
  task: _Task
58
58
  def __init__(self, future: Future[Any], task: _Task) -> None: ...
59
59
  def run(self, ctx: WorkerContext) -> None: ...
60
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
60
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
61
+ """
62
+ Represent a PEP 585 generic type
63
+
64
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
65
+ """
66
+ ...
61
67
 
62
68
  def _worker(executor_reference: ref[Any], ctx: WorkerContext, work_queue: queue.SimpleQueue[Any]) -> None: ...
63
69
 
@@ -69,13 +75,7 @@ else:
69
75
  kwargs: Mapping[str, Any]
70
76
  def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
71
77
  def run(self) -> None: ...
72
- def __class_getitem__(cls, item: Any, /) -> GenericAlias:
73
- """
74
- Represent a PEP 585 generic type
75
-
76
- E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
77
- """
78
- ...
78
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
79
79
 
80
80
  def _worker(
81
81
  executor_reference: ref[Any],
@@ -1,68 +1,68 @@
1
- import sys
2
- import threading
3
- import types
4
- from collections.abc import Callable
5
- from typing import Any, Literal, TypeVar
6
- from typing_extensions import ParamSpec, Self
7
-
8
- if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13
9
- from _interpreters import (
10
- InterpreterError as InterpreterError,
11
- InterpreterNotFoundError as InterpreterNotFoundError,
12
- NotShareableError as NotShareableError,
13
- _SharedDict,
14
- _Whence,
15
- is_shareable as is_shareable,
16
- )
17
-
18
- from ._queues import Queue as Queue, QueueEmpty as QueueEmpty, QueueFull as QueueFull, create as create_queue
19
-
20
- __all__ = [
21
- "ExecutionFailed",
22
- "Interpreter",
23
- "InterpreterError",
24
- "InterpreterNotFoundError",
25
- "NotShareableError",
26
- "Queue",
27
- "QueueEmpty",
28
- "QueueFull",
29
- "create",
30
- "create_queue",
31
- "get_current",
32
- "get_main",
33
- "is_shareable",
34
- "list_all",
35
- ]
36
-
37
- _R = TypeVar("_R")
38
- _P = ParamSpec("_P")
39
-
40
- class ExecutionFailed(InterpreterError):
41
- excinfo: types.SimpleNamespace
42
-
43
- def __init__(self, excinfo: types.SimpleNamespace) -> None: ...
44
-
45
- def create() -> Interpreter: ...
46
- def list_all() -> list[Interpreter]: ...
47
- def get_current() -> Interpreter: ...
48
- def get_main() -> Interpreter: ...
49
-
50
- class Interpreter:
51
- def __new__(cls, id: int, /, _whence: _Whence | None = None, _ownsref: bool | None = None) -> Self: ...
52
- def __reduce__(self) -> tuple[type[Self], int]: ...
53
- def __hash__(self) -> int: ...
54
- def __del__(self) -> None: ...
55
- @property
56
- def id(self) -> int: ...
57
- @property
58
- def whence(
59
- self,
60
- ) -> Literal["unknown", "runtime init", "legacy C-API", "C-API", "cross-interpreter C-API", "_interpreters module"]: ...
61
- def is_running(self) -> bool: ...
62
- def close(self) -> None: ...
63
- def prepare_main(
64
- self, ns: _SharedDict | None = None, /, **kwargs: Any
65
- ) -> None: ... # kwargs has same value restrictions as _SharedDict
66
- def exec(self, code: str | types.CodeType | Callable[[], object], /) -> None: ...
67
- def call(self, callable: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
68
- def call_in_thread(self, callable: Callable[_P, object], /, *args: _P.args, **kwargs: _P.kwargs) -> threading.Thread: ...
1
+ import sys
2
+ import threading
3
+ import types
4
+ from collections.abc import Callable
5
+ from typing import Any, Literal, TypeVar
6
+ from typing_extensions import ParamSpec, Self
7
+
8
+ if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13
9
+ from _interpreters import (
10
+ InterpreterError as InterpreterError,
11
+ InterpreterNotFoundError as InterpreterNotFoundError,
12
+ NotShareableError as NotShareableError,
13
+ _SharedDict,
14
+ _Whence,
15
+ is_shareable as is_shareable,
16
+ )
17
+
18
+ from ._queues import Queue as Queue, QueueEmpty as QueueEmpty, QueueFull as QueueFull, create as create_queue
19
+
20
+ __all__ = [
21
+ "ExecutionFailed",
22
+ "Interpreter",
23
+ "InterpreterError",
24
+ "InterpreterNotFoundError",
25
+ "NotShareableError",
26
+ "Queue",
27
+ "QueueEmpty",
28
+ "QueueFull",
29
+ "create",
30
+ "create_queue",
31
+ "get_current",
32
+ "get_main",
33
+ "is_shareable",
34
+ "list_all",
35
+ ]
36
+
37
+ _R = TypeVar("_R")
38
+ _P = ParamSpec("_P")
39
+
40
+ class ExecutionFailed(InterpreterError):
41
+ excinfo: types.SimpleNamespace
42
+
43
+ def __init__(self, excinfo: types.SimpleNamespace) -> None: ...
44
+
45
+ def create() -> Interpreter: ...
46
+ def list_all() -> list[Interpreter]: ...
47
+ def get_current() -> Interpreter: ...
48
+ def get_main() -> Interpreter: ...
49
+
50
+ class Interpreter:
51
+ def __new__(cls, id: int, /, _whence: _Whence | None = None, _ownsref: bool | None = None) -> Self: ...
52
+ def __reduce__(self) -> tuple[type[Self], int]: ...
53
+ def __hash__(self) -> int: ...
54
+ def __del__(self) -> None: ...
55
+ @property
56
+ def id(self) -> int: ...
57
+ @property
58
+ def whence(
59
+ self,
60
+ ) -> Literal["unknown", "runtime init", "legacy C-API", "C-API", "cross-interpreter C-API", "_interpreters module"]: ...
61
+ def is_running(self) -> bool: ...
62
+ def close(self) -> None: ...
63
+ def prepare_main(
64
+ self, ns: _SharedDict | None = None, /, **kwargs: Any
65
+ ) -> None: ... # kwargs has same value restrictions as _SharedDict
66
+ def exec(self, code: str | types.CodeType | Callable[[], object], /) -> None: ...
67
+ def call(self, callable: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
68
+ def call_in_thread(self, callable: Callable[_P, object], /, *args: _P.args, **kwargs: _P.kwargs) -> threading.Thread: ...
@@ -1,30 +1,30 @@
1
- import sys
2
- from collections.abc import Callable
3
- from typing import Final, NewType
4
- from typing_extensions import Never, Self, TypeAlias
5
-
6
- if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13
7
- from _interpqueues import _UnboundOp
8
-
9
- class ItemInterpreterDestroyed(Exception): ...
10
- # Actually a descriptor that behaves similarly to classmethod but prevents
11
- # access from instances.
12
- classonly = classmethod
13
-
14
- class UnboundItem:
15
- __slots__ = ()
16
- def __new__(cls) -> Never: ...
17
- @classonly
18
- def singleton(cls, kind: str, module: str, name: str = "UNBOUND") -> Self: ...
19
-
20
- # Sentinel types and alias that don't exist at runtime.
21
- _UnboundErrorType = NewType("_UnboundErrorType", object)
22
- _UnboundRemoveType = NewType("_UnboundRemoveType", object)
23
- _AnyUnbound: TypeAlias = _UnboundErrorType | _UnboundRemoveType | UnboundItem
24
-
25
- UNBOUND_ERROR: Final[_UnboundErrorType]
26
- UNBOUND_REMOVE: Final[_UnboundRemoveType]
27
- UNBOUND: Final[UnboundItem] # analogous to UNBOUND_REPLACE in C
28
-
29
- def serialize_unbound(unbound: _AnyUnbound) -> tuple[_UnboundOp]: ...
30
- def resolve_unbound(flag: _UnboundOp, exctype_destroyed: Callable[[str], BaseException]) -> UnboundItem: ...
1
+ import sys
2
+ from collections.abc import Callable
3
+ from typing import Final, NewType
4
+ from typing_extensions import Never, Self, TypeAlias
5
+
6
+ if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13
7
+ from _interpqueues import _UnboundOp
8
+
9
+ class ItemInterpreterDestroyed(Exception): ...
10
+ # Actually a descriptor that behaves similarly to classmethod but prevents
11
+ # access from instances.
12
+ classonly = classmethod
13
+
14
+ class UnboundItem:
15
+ __slots__ = ()
16
+ def __new__(cls) -> Never: ...
17
+ @classonly
18
+ def singleton(cls, kind: str, module: str, name: str = "UNBOUND") -> Self: ...
19
+
20
+ # Sentinel types and alias that don't exist at runtime.
21
+ _UnboundErrorType = NewType("_UnboundErrorType", object)
22
+ _UnboundRemoveType = NewType("_UnboundRemoveType", object)
23
+ _AnyUnbound: TypeAlias = _UnboundErrorType | _UnboundRemoveType | UnboundItem
24
+
25
+ UNBOUND_ERROR: Final[_UnboundErrorType]
26
+ UNBOUND_REMOVE: Final[_UnboundRemoveType]
27
+ UNBOUND: Final[UnboundItem] # analogous to UNBOUND_REPLACE in C
28
+
29
+ def serialize_unbound(unbound: _AnyUnbound) -> tuple[_UnboundOp]: ...
30
+ def resolve_unbound(flag: _UnboundOp, exctype_destroyed: Callable[[str], BaseException]) -> UnboundItem: ...