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
72 lines (58 loc) · 1.61 KB
/
pythonmonkey.pyi
File metadata and controls
72 lines (58 loc) · 1.61 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
stub file for type hints & documentations for the native module
@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 internalBinding(namespace: str) -> JSObjectProxy:
"""
INTERNAL USE ONLY
See function declarations in ./builtin_modules/internal-binding.d.ts
"""
def collect() -> None:
"""
Calls the spidermonkey garbage collector
"""
class bigint(int):
"""
Representing JavaScript BigInt in Python
"""
class SpiderMonkeyError(Exception):
"""
Representing a corresponding JS Error in Python
"""
class JSObjectProxy(dict):
"""
JavaScript Object proxy dict
"""
def __init__(self) -> None: ...
null = _typing.Annotated[
_typing.NewType("pythonmonkey.null", object),
"Representing the JS null type in Python using a singleton object",
]