forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonmonkey.pyi
More file actions
43 lines (35 loc) · 965 Bytes
/
pythonmonkey.pyi
File metadata and controls
43 lines (35 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
@see https://typing.readthedocs.io/en/latest/source/stubs.html
"""
import typing as _typing
class EvalOptions(_typing.TypedDict, total=False):
filename: str
lineno: int
column: int
mutedErrors: bool
noScriptRval: bool
selfHosting: bool
strict: bool
module: bool
fromPythonFrame: bool
# pylint: disable=redefined-builtin
def eval(code: str, evalOpts: EvalOptions = {}, /) -> _typing.Any:
"""
JavaScript evaluator in Python
"""
def wait() -> _typing.Awaitable[None]:
"""
Block until all asynchronous jobs (Promise/setTimeout/etc.) finish.
```py
await pm.wait()
```
This is the event-loop shield that protects the loop from being prematurely terminated.
"""
def isCompilableUnit(code: str) -> bool:
"""
Hint if a string might be compilable Javascript without actual evaluation
"""
def collect() -> None:
"""
Calls the spidermonkey garbage collector
"""