Skip to content

Commit 398dc2a

Browse files
committed
Fix python 3.10 compat
1 parent 04b7b1b commit 398dc2a

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/reactpy/core/vdom.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
from typing import (
77
Any,
88
Callable,
9-
Unpack,
109
cast,
1110
overload,
1211
)
1312

1413
from fastjsonschema import compile as compile_json_schema
14+
from typing_extensions import Unpack
1515

1616
from reactpy._warnings import warn
1717
from reactpy.config import REACTPY_CHECK_JSON_ATTRS, REACTPY_DEBUG

src/reactpy/types.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
Callable,
1010
Generic,
1111
Literal,
12-
NotRequired,
1312
Protocol,
1413
TypeVar,
1514
overload,
1615
runtime_checkable,
1716
)
1817

19-
from typing_extensions import NamedTuple, TypeAlias, TypedDict
18+
from typing_extensions import NamedTuple, NotRequired, TypeAlias, TypedDict
2019

2120
CarrierType = TypeVar("CarrierType")
2221
_Type = TypeVar("_Type")
@@ -764,11 +763,21 @@ class DangerouslySetInnerHTML(TypedDict):
764763
VdomAttributes = VdomAttributesTypeDict | dict[str, Any]
765764

766765
VdomDictKeys = Literal[
767-
"tagName", "key", "children", "attributes", "eventHandlers", "importSource"
766+
"tagName",
767+
"key",
768+
"children",
769+
"attributes",
770+
"eventHandlers",
771+
"importSource",
768772
]
769-
770-
# This is a hack to pull the keys from the TypedDict
771-
ALLOWED_VDOM_KEYS = set(VdomDictKeys._determine_new_args([])) # type: ignore
773+
ALLOWED_VDOM_KEYS = {
774+
"tagName",
775+
"key",
776+
"children",
777+
"attributes",
778+
"eventHandlers",
779+
"importSource",
780+
}
772781

773782

774783
class _VdomDict(TypedDict):

0 commit comments

Comments
 (0)