1
1
import types
2
- from collections .abc import Callable , Mapping
3
- from typing import Final , Literal , SupportsIndex
2
+ from collections .abc import Callable
3
+ from typing import Any , Final , Literal , SupportsIndex
4
4
from typing_extensions import TypeAlias
5
5
6
6
_Configs : TypeAlias = Literal ["default" , "isolated" , "legacy" , "empty" , "" ]
7
+ _SharedDict : TypeAlias = dict [str , Any ] # many objects can be shared
7
8
8
9
class InterpreterError (Exception ): ...
9
10
class InterpreterNotFoundError (InterpreterError ): ...
@@ -22,7 +23,11 @@ def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool: ...
22
23
def get_config (id : SupportsIndex , * , restrict : bool = False ) -> types .SimpleNamespace : ...
23
24
def whence (id : SupportsIndex ) -> int : ...
24
25
def exec (
25
- id : SupportsIndex , code : str | types .CodeType | Callable [[], object ], shared : bool | None = None , * , restrict : bool = False
26
+ id : SupportsIndex ,
27
+ code : str | types .CodeType | Callable [[], object ],
28
+ shared : _SharedDict | None = None ,
29
+ * ,
30
+ restrict : bool = False ,
26
31
) -> None | types .SimpleNamespace : ...
27
32
def call (
28
33
id : SupportsIndex ,
@@ -33,12 +38,16 @@ def call(
33
38
restrict : bool = False ,
34
39
) -> object : ...
35
40
def run_string (
36
- id : SupportsIndex , script : str | types .CodeType | Callable [[], object ], shared : bool | None = None , * , restrict : bool = False
41
+ id : SupportsIndex ,
42
+ script : str | types .CodeType | Callable [[], object ],
43
+ shared : _SharedDict | None = None ,
44
+ * ,
45
+ restrict : bool = False ,
37
46
) -> None : ...
38
47
def run_func (
39
- id : SupportsIndex , func : types .CodeType | Callable [[], object ], shared : bool | None = None , * , restrict : bool = False
48
+ id : SupportsIndex , func : types .CodeType | Callable [[], object ], shared : _SharedDict | None = None , * , restrict : bool = False
40
49
) -> None : ...
41
- def set___main___attrs (id : SupportsIndex , updates : Mapping [ str , object ] , * , restrict : bool = False ) -> None : ...
50
+ def set___main___attrs (id : SupportsIndex , updates : _SharedDict , * , restrict : bool = False ) -> None : ...
42
51
def incref (id : SupportsIndex , * , implieslink : bool = False , restrict : bool = False ) -> None : ...
43
52
def decref (id : SupportsIndex , * , restrict : bool = False ) -> None : ...
44
53
def is_shareable (obj : object ) -> bool : ...
0 commit comments