File tree 5 files changed +12
-6
lines changed
gallery/examples/interest_calculator
5 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ channels:
3
3
- conda-forge
4
4
- microsoft
5
5
dependencies :
6
- - python=3.9
6
+ - python=3.10
7
7
- pip=20.2.2
8
8
- pytest=7
9
9
- nodejs=16
Original file line number Diff line number Diff line change 1
1
"""Provide a web server to browse the examples."""
2
2
import contextlib
3
+ from collections .abc import Iterator
3
4
from pathlib import PurePath
4
5
from typing import AsyncContextManager
5
- from typing import Iterator
6
6
7
7
from starlette .applications import Starlette
8
8
from starlette .requests import Request
Original file line number Diff line number Diff line change 2
2
from __future__ import annotations
3
3
4
4
import builtins
5
+ from collections .abc import Callable
6
+ from collections .abc import Generator
5
7
from dataclasses import dataclass
6
8
from dataclasses import field
7
9
from mimetypes import guess_type
8
- from typing import Callable
9
- from typing import Generator
10
10
from urllib .parse import urlparse
11
11
12
12
import pytest
@@ -199,23 +199,28 @@ def fake_document() -> FakeDocument:
199
199
200
200
@dataclass
201
201
class ElementNode :
202
+ """An element node."""
203
+
202
204
value : str
203
205
document : FakeDocument
204
206
205
207
def write (self , value : str ) -> None :
206
208
"""Collect anything that is written to the node."""
207
209
self .document .log .append (value )
208
210
209
- def removeAttribute (self , name ) -> None :
211
+ def removeAttribute (self , name ) -> None : # noqa
210
212
"""Pretend to remove an attribute from this node."""
211
213
pass
212
214
213
215
214
216
@dataclass
215
217
class ElementCallable :
218
+ """A callable that returns an ElementNode."""
219
+
216
220
document : FakeDocument
217
221
218
222
def __call__ (self , key : str ) -> ElementNode :
223
+ """Return an ElementNode."""
219
224
value = self .document .values [key ]
220
225
node = ElementNode (value , self .document )
221
226
return node
Original file line number Diff line number Diff line change 1
1
def interest (* args , ** kwargs ):
2
+ """Main interest calculation function."""
2
3
# Signal that PyScript is alive by setting the ``Calculate``
3
4
# button away from disabled.
4
5
calculate_button = Element ("calc" ) # noqa
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def test_html_page() -> None:
90
90
"""Make an instance of a .html Page resource and test it."""
91
91
this_page = Page (path = PurePath ("contributing" ))
92
92
assert this_page .title == "Contributing"
93
- assert this_page .subtitle == "How to get involved in the PyCharm Collective."
93
+ assert this_page .subtitle == "How to get involved in the PyScript Collective."
94
94
assert 'id="viewer"' in this_page .body
95
95
96
96
You can’t perform that action at this time.
0 commit comments