File tree 1 file changed +28
-1
lines changed
1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import logging
4
- from typing import Any , Mapping , cast
4
+ from functools import wraps
5
+ from typing import Any , Mapping , TypeVar , cast
6
+ from warnings import warn
5
7
6
8
from fastjsonschema import compile as compile_json_schema
7
9
@@ -128,6 +130,31 @@ def is_vdom(value: Any) -> bool:
128
130
)
129
131
130
132
133
+ _T = TypeVar ("_T" )
134
+
135
+
136
+ def _help_message (func : _T ) -> _T :
137
+ @wraps (func )
138
+ def wrapper (* args , ** kwargs ):
139
+ try :
140
+ return func (* args , ** kwargs )
141
+ except TypeError : # pragma: no cover
142
+ warn (
143
+ (
144
+ "Element constructor signatures have changed! A CLI tool for "
145
+ "automatically updating code to the latest API has been provided "
146
+ "with this release of IDOM (e.g. 'idom update-html-usages'). For "
147
+ "start a discussion if you need help transitioning to this new "
148
+ "interface: https://github.com/idom-team/idom/discussions/new?category=question"
149
+ ),
150
+ UserWarning ,
151
+ )
152
+ raise
153
+
154
+ return wrapper
155
+
156
+
157
+ @_help_message
131
158
def vdom (
132
159
tag : str , * children : VdomChild , key : Key | None = None , ** attributes : Any
133
160
) -> VdomDict :
You can’t perform that action at this time.
0 commit comments