22
33from base64 import b64encode
44from collections .abc import Sequence
5- from typing import TYPE_CHECKING , Any , Callable , Protocol , TypeVar
5+ from typing import Any , Callable , Protocol , TypeVar
66
77import reactpy
88from reactpy ._html import html
9- from reactpy ._warnings import warn
10- from reactpy .types import ComponentConstructor , VdomAttributes , VdomDict
9+ from reactpy .types import VdomAttributes , VdomDict
1110
1211
1312def image (
@@ -22,11 +21,7 @@ def image(
2221 if format == "svg" :
2322 format = "svg+xml" # noqa: A001
2423
25- if isinstance (value , str ):
26- bytes_value = value .encode ()
27- else :
28- bytes_value = value
29-
24+ bytes_value = value .encode () if isinstance (value , str ) else value
3025 base64_value = b64encode (bytes_value ).decode ()
3126 src = f"data:image/{ format } ;base64,{ base64_value } "
3227
@@ -83,20 +78,3 @@ def sync_inputs(event: dict[str, Any]) -> None:
8378
8479class _CastFunc (Protocol [_CastTo_co ]):
8580 def __call__ (self , value : str ) -> _CastTo_co : ...
86-
87-
88- if TYPE_CHECKING :
89- from reactpy .testing .backend import _MountFunc
90-
91-
92- def hotswap (
93- update_on_change : bool = False ,
94- ) -> tuple [_MountFunc , ComponentConstructor ]: # nocov
95- warn (
96- "The 'hotswap' function is deprecated and will be removed in a future release" ,
97- DeprecationWarning ,
98- stacklevel = 2 ,
99- )
100- from reactpy .testing .backend import _hotswap
101-
102- return _hotswap (update_on_change )
0 commit comments