code-battles 1.0.1 → 1.2.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.
- package/LICENSE.md +7 -7
- package/README.md +39 -39
- package/dist/code_battles/__init__.py +20 -13
- package/dist/code_battles/__pycache__/__init__.cpython-312.pyc +0 -0
- package/dist/code_battles/__pycache__/battles.cpython-312.pyc +0 -0
- package/dist/code_battles/__pycache__/utilities.cpython-312.pyc +0 -0
- package/dist/code_battles/battles.py +640 -566
- package/dist/code_battles/js.pyi +131 -130
- package/dist/code_battles/pyodide/ffi/__init__.pyi +2 -2
- package/dist/code_battles/pyscript/ffi/__init__.pyi +3 -3
- package/dist/code_battles/utilities.py +226 -222
- package/dist/pdoc-template/custom.css +22 -22
- package/dist/pdoc-template/module.html.jinja2 +305 -305
- package/dist/pdoc-template/syntax-highlighting.css +248 -248
- package/dist/pyscript/core-CjO3FOKB.js +2 -0
- package/dist/pyscript/core-CjO3FOKB.js.map +1 -0
- package/dist/pyscript/core.js +1 -1
- package/dist/pyscript/{deprecations-manager-B8Tn4H-t.js → deprecations-manager-pFtn19mE.js} +2 -2
- package/dist/pyscript/{deprecations-manager-B8Tn4H-t.js.map → deprecations-manager-pFtn19mE.js.map} +1 -1
- package/dist/pyscript/{error-Dmba-E9f.js → error-tq-z48YI.js} +2 -2
- package/dist/pyscript/{error-Dmba-E9f.js.map → error-tq-z48YI.js.map} +1 -1
- package/dist/pyscript/{mpy-BnYOGs9W.js → mpy-DovD7Qjy.js} +2 -2
- package/dist/pyscript/{mpy-BnYOGs9W.js.map → mpy-DovD7Qjy.js.map} +1 -1
- package/dist/pyscript/{py-D2NmpN63.js → py-BUsUWVJg.js} +2 -2
- package/dist/pyscript/{py-D2NmpN63.js.map → py-BUsUWVJg.js.map} +1 -1
- package/dist/pyscript/{py-editor-Czy2e-Jt.js → py-editor-CeySmmer.js} +2 -2
- package/dist/pyscript/{py-editor-Czy2e-Jt.js.map → py-editor-CeySmmer.js.map} +1 -1
- package/dist/pyscript/{py-terminal-w87wZryi.js → py-terminal-CH_wV7wQ.js} +2 -2
- package/dist/pyscript/{py-terminal-w87wZryi.js.map → py-terminal-CH_wV7wQ.js.map} +1 -1
- package/package.json +14 -14
- package/dist/pyscript/core-CZGzC87D.js +0 -2
- package/dist/pyscript/core-CZGzC87D.js.map +0 -1
package/dist/code_battles/js.pyi
CHANGED
|
@@ -1,130 +1,131 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Basic type hints for JavaScript in PyOdide and PyScript.
|
|
3
|
-
A lot of properties are missing.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from typing import Callable, List, Literal, Optional
|
|
7
|
-
|
|
8
|
-
from pyodide.ffi import JsCallable
|
|
9
|
-
|
|
10
|
-
class TwoDContext:
|
|
11
|
-
textAlign: Literal["left", "right", "center", "start", "end"]
|
|
12
|
-
textBaseline: Literal[
|
|
13
|
-
"top", "hanging", "middle", "alphabetic", "ideographic", "bottom"
|
|
14
|
-
]
|
|
15
|
-
font: str
|
|
16
|
-
fillStyle: str
|
|
17
|
-
strokeStyle: str
|
|
18
|
-
|
|
19
|
-
@staticmethod
|
|
20
|
-
def beginPath(): ...
|
|
21
|
-
@staticmethod
|
|
22
|
-
def arc(
|
|
23
|
-
x: int,
|
|
24
|
-
y: int,
|
|
25
|
-
radius: float,
|
|
26
|
-
startAngle: float,
|
|
27
|
-
endAngle: float,
|
|
28
|
-
counterclockwise=False,
|
|
29
|
-
): ...
|
|
30
|
-
@staticmethod
|
|
31
|
-
def stroke(): ...
|
|
32
|
-
@staticmethod
|
|
33
|
-
def fill(): ...
|
|
34
|
-
@staticmethod
|
|
35
|
-
def fillText(text: str, x: int, y: int): ...
|
|
36
|
-
@staticmethod
|
|
37
|
-
def fillRect(x: int, y: int, width: int, height: int): ...
|
|
38
|
-
@staticmethod
|
|
39
|
-
def drawImage(image: Image, x: int, y: int, width: int, height: int): ...
|
|
40
|
-
@staticmethod
|
|
41
|
-
def clearRect(startX: int, endX: int, width: int, height: int): ...
|
|
42
|
-
@staticmethod
|
|
43
|
-
def save(): ...
|
|
44
|
-
@staticmethod
|
|
45
|
-
def restore(): ...
|
|
46
|
-
@staticmethod
|
|
47
|
-
def translate(x: float, y: float): ...
|
|
48
|
-
@staticmethod
|
|
49
|
-
def rotate(radians: float): ...
|
|
50
|
-
|
|
51
|
-
class Styles:
|
|
52
|
-
width: str
|
|
53
|
-
height: str
|
|
54
|
-
display: str
|
|
55
|
-
|
|
56
|
-
class Element:
|
|
57
|
-
id: str
|
|
58
|
-
value: str
|
|
59
|
-
textContent: str
|
|
60
|
-
ariaValueNow: str
|
|
61
|
-
onclick: JsCallable
|
|
62
|
-
width: float
|
|
63
|
-
height: float
|
|
64
|
-
clientWidth: Optional[int]
|
|
65
|
-
clientHeight: Optional[int]
|
|
66
|
-
style: Styles
|
|
67
|
-
|
|
68
|
-
@staticmethod
|
|
69
|
-
def getContext(dimensions: str) -> TwoDContext: ...
|
|
70
|
-
@staticmethod
|
|
71
|
-
def click(): ...
|
|
72
|
-
@staticmethod
|
|
73
|
-
def getElementsByClassName(classname: str) -> HTMLCollection: ...
|
|
74
|
-
|
|
75
|
-
class document:
|
|
76
|
-
body: Element
|
|
77
|
-
|
|
78
|
-
@staticmethod
|
|
79
|
-
def getElementById(id: str) -> Element: ...
|
|
80
|
-
|
|
81
|
-
class Matches:
|
|
82
|
-
matches: bool
|
|
83
|
-
|
|
84
|
-
class Event: ...
|
|
85
|
-
|
|
86
|
-
class LocalStorage:
|
|
87
|
-
@staticmethod
|
|
88
|
-
def getItem(key: str) -> Optional[str]: ...
|
|
89
|
-
@staticmethod
|
|
90
|
-
def setItem(key: str, value: str) -> None: ...
|
|
91
|
-
|
|
92
|
-
class window:
|
|
93
|
-
devicePixelRatio: float
|
|
94
|
-
localStorage: LocalStorage
|
|
95
|
-
|
|
96
|
-
@staticmethod
|
|
97
|
-
def matchMedia(media: str) -> Matches: ...
|
|
98
|
-
@staticmethod
|
|
99
|
-
def createEventListener(event: str, callable: JsCallable) -> None: ...
|
|
100
|
-
|
|
101
|
-
class Audio:
|
|
102
|
-
volume: float
|
|
103
|
-
|
|
104
|
-
@staticmethod
|
|
105
|
-
def new(src: str) -> Audio: ...
|
|
106
|
-
@staticmethod
|
|
107
|
-
def cloneNode(p: bool) -> Audio: ...
|
|
108
|
-
@staticmethod
|
|
109
|
-
def play() -> None: ...
|
|
110
|
-
|
|
111
|
-
class HTMLCollection:
|
|
112
|
-
@staticmethod
|
|
113
|
-
def to_py() -> List[Element]: ...
|
|
114
|
-
|
|
115
|
-
class Image(Element):
|
|
116
|
-
@staticmethod
|
|
117
|
-
def new() -> Image: ...
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def
|
|
124
|
-
def
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
1
|
+
"""
|
|
2
|
+
Basic type hints for JavaScript in PyOdide and PyScript.
|
|
3
|
+
A lot of properties are missing.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Callable, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from pyodide.ffi import JsCallable
|
|
9
|
+
|
|
10
|
+
class TwoDContext:
|
|
11
|
+
textAlign: Literal["left", "right", "center", "start", "end"]
|
|
12
|
+
textBaseline: Literal[
|
|
13
|
+
"top", "hanging", "middle", "alphabetic", "ideographic", "bottom"
|
|
14
|
+
]
|
|
15
|
+
font: str
|
|
16
|
+
fillStyle: str
|
|
17
|
+
strokeStyle: str
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def beginPath(): ...
|
|
21
|
+
@staticmethod
|
|
22
|
+
def arc(
|
|
23
|
+
x: int,
|
|
24
|
+
y: int,
|
|
25
|
+
radius: float,
|
|
26
|
+
startAngle: float,
|
|
27
|
+
endAngle: float,
|
|
28
|
+
counterclockwise=False,
|
|
29
|
+
): ...
|
|
30
|
+
@staticmethod
|
|
31
|
+
def stroke(): ...
|
|
32
|
+
@staticmethod
|
|
33
|
+
def fill(): ...
|
|
34
|
+
@staticmethod
|
|
35
|
+
def fillText(text: str, x: int, y: int): ...
|
|
36
|
+
@staticmethod
|
|
37
|
+
def fillRect(x: int, y: int, width: int, height: int): ...
|
|
38
|
+
@staticmethod
|
|
39
|
+
def drawImage(image: "Image", x: int, y: int, width: int, height: int): ...
|
|
40
|
+
@staticmethod
|
|
41
|
+
def clearRect(startX: int, endX: int, width: int, height: int): ...
|
|
42
|
+
@staticmethod
|
|
43
|
+
def save(): ...
|
|
44
|
+
@staticmethod
|
|
45
|
+
def restore(): ...
|
|
46
|
+
@staticmethod
|
|
47
|
+
def translate(x: float, y: float): ...
|
|
48
|
+
@staticmethod
|
|
49
|
+
def rotate(radians: float): ...
|
|
50
|
+
|
|
51
|
+
class Styles:
|
|
52
|
+
width: str
|
|
53
|
+
height: str
|
|
54
|
+
display: str
|
|
55
|
+
|
|
56
|
+
class Element:
|
|
57
|
+
id: str
|
|
58
|
+
value: str
|
|
59
|
+
textContent: str
|
|
60
|
+
ariaValueNow: str
|
|
61
|
+
onclick: JsCallable
|
|
62
|
+
width: float
|
|
63
|
+
height: float
|
|
64
|
+
clientWidth: Optional[int]
|
|
65
|
+
clientHeight: Optional[int]
|
|
66
|
+
style: Styles
|
|
67
|
+
|
|
68
|
+
@staticmethod
|
|
69
|
+
def getContext(dimensions: str) -> TwoDContext: ...
|
|
70
|
+
@staticmethod
|
|
71
|
+
def click(): ...
|
|
72
|
+
@staticmethod
|
|
73
|
+
def getElementsByClassName(classname: str) -> "HTMLCollection": ...
|
|
74
|
+
|
|
75
|
+
class document:
|
|
76
|
+
body: Element
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def getElementById(id: str) -> Element: ...
|
|
80
|
+
|
|
81
|
+
class Matches:
|
|
82
|
+
matches: bool
|
|
83
|
+
|
|
84
|
+
class Event: ...
|
|
85
|
+
|
|
86
|
+
class LocalStorage:
|
|
87
|
+
@staticmethod
|
|
88
|
+
def getItem(key: str) -> Optional[str]: ...
|
|
89
|
+
@staticmethod
|
|
90
|
+
def setItem(key: str, value: str) -> None: ...
|
|
91
|
+
|
|
92
|
+
class window:
|
|
93
|
+
devicePixelRatio: float
|
|
94
|
+
localStorage: LocalStorage
|
|
95
|
+
|
|
96
|
+
@staticmethod
|
|
97
|
+
def matchMedia(media: str) -> Matches: ...
|
|
98
|
+
@staticmethod
|
|
99
|
+
def createEventListener(event: str, callable: JsCallable) -> None: ...
|
|
100
|
+
|
|
101
|
+
class Audio:
|
|
102
|
+
volume: float
|
|
103
|
+
|
|
104
|
+
@staticmethod
|
|
105
|
+
def new(src: str) -> "Audio": ...
|
|
106
|
+
@staticmethod
|
|
107
|
+
def cloneNode(p: bool) -> "Audio": ...
|
|
108
|
+
@staticmethod
|
|
109
|
+
def play() -> None: ...
|
|
110
|
+
|
|
111
|
+
class HTMLCollection:
|
|
112
|
+
@staticmethod
|
|
113
|
+
def to_py() -> List[Element]: ...
|
|
114
|
+
|
|
115
|
+
class Image(Element):
|
|
116
|
+
@staticmethod
|
|
117
|
+
def new() -> "Image": ...
|
|
118
|
+
|
|
119
|
+
src: str
|
|
120
|
+
onload: Callable[[Event], None]
|
|
121
|
+
onerror: Callable[[Event], None]
|
|
122
|
+
|
|
123
|
+
def clearInterval(id: int) -> None: ...
|
|
124
|
+
def setInterval(fn: JsCallable, period: int) -> int: ...
|
|
125
|
+
def setTimeout(fn: JsCallable, period: int) -> None: ...
|
|
126
|
+
|
|
127
|
+
class FontFace:
|
|
128
|
+
@staticmethod
|
|
129
|
+
def new(name: str, url: str): ...
|
|
130
|
+
@staticmethod
|
|
131
|
+
def load(): ...
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class JsCallable:
|
|
2
|
-
pass
|
|
1
|
+
class JsCallable:
|
|
2
|
+
pass
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
from typing import Callable
|
|
2
|
-
|
|
3
|
-
def create_proxy(f: Callable): ...
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
3
|
+
def create_proxy(f: Callable): ...
|