Skip to content

Commit f30a041

Browse files
committed
Resolve type checker warnings
1 parent 02d114c commit f30a041

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

src/reactpy/asgi/executors/pyscript.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from datetime import datetime, timezone
77
from email.utils import formatdate
88
from pathlib import Path
9+
from typing import Any
910

1011
from asgiref.typing import WebSocketScope
1112
from typing_extensions import Unpack
@@ -26,8 +27,8 @@ def __init__(
2627
self,
2728
*component_paths: str | Path,
2829
extra_py: tuple[str, ...] = (),
29-
extra_js: dict | str = "",
30-
pyscript_config: dict | str = "",
30+
extra_js: dict[str, Any] | str = "",
31+
pyscript_config: dict[str, Any] | str = "",
3132
root_name: str = "root",
3233
initial: str | VdomDict = "",
3334
http_headers: dict[str, str] | None = None,

src/reactpy/asgi/middleware.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ async def __call__(
293293

294294

295295
class Error404App:
296-
async def __call__(self, scope, receive, send):
296+
async def __call__(
297+
self,
298+
scope: asgi_types.HTTPScope,
299+
receive: asgi_types.ASGIReceiveCallable,
300+
send: asgi_types.ASGISendCallable,
301+
) -> None:
297302
response = ResponseText("Resource not found on this server.", status_code=404)
298-
await response(scope, receive, send)
303+
await response(scope, receive, send) # type: ignore

src/reactpy/jinja.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import ClassVar
1+
from typing import Any, ClassVar
22
from uuid import uuid4
33

44
from jinja2_simple_tags import StandaloneTag
@@ -37,7 +37,10 @@ class PyScriptSetup(StandaloneTag): # type: ignore
3737
tags: ClassVar[set[str]] = {"pyscript_setup"}
3838

3939
def render(
40-
self, *extra_py: str, extra_js: str | dict = "", config: str | dict = ""
40+
self,
41+
*extra_py: str,
42+
extra_js: str | dict[str, Any] = "",
43+
config: str | dict[str, Any] = "",
4144
) -> str:
4245
"""
4346
Args:

src/reactpy/pyscript/component_template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# ruff: noqa: TC004, N802, N816, RUF006
2+
# type: ignore
23
from typing import TYPE_CHECKING
34

45
if TYPE_CHECKING:

src/reactpy/pyscript/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _pyscript_component(
1717
*file_paths: str,
1818
initial: str | VdomDict = "",
1919
root: str = "root",
20-
):
20+
) -> None | VdomDict:
2121
if not file_paths:
2222
raise ValueError("At least one file path must be provided.")
2323

src/reactpy/pyscript/utils.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55
import textwrap
66
from pathlib import Path
7-
from typing import TYPE_CHECKING
7+
from typing import TYPE_CHECKING, Any
88
from uuid import uuid4
99

1010
import jsonpointer
@@ -65,7 +65,9 @@ def pyscript_component_html(
6565

6666

6767
def pyscript_setup_html(
68-
extra_py: Sequence[str], extra_js: dict | str, config: dict | str
68+
extra_py: Sequence[str],
69+
extra_js: dict[str, Any] | str,
70+
config: dict[str, Any] | str,
6971
) -> str:
7072
"""Renders the PyScript setup code."""
7173
hide_pyscript_debugger = f'<link rel="stylesheet" href="{REACTPY_PATH_PREFIX.current}static/pyscript-hide-debug.css" />'
@@ -82,10 +84,12 @@ def pyscript_setup_html(
8284

8385

8486
def extend_pyscript_config(
85-
extra_py: Sequence[str], extra_js: dict | str, config: dict | str
87+
extra_py: Sequence[str],
88+
extra_js: dict[str, Any] | str,
89+
config: dict[str, Any] | str,
8690
) -> str:
8791
# Extends ReactPy's default PyScript config with user provided values.
88-
pyscript_config = {
92+
pyscript_config: dict[str, Any] = {
8993
"packages": [
9094
f"reactpy=={reactpy.__version__}",
9195
f"jsonpointer=={jsonpointer.__version__}",

0 commit comments

Comments
 (0)