Skip to content

Commit ac1f907

Browse files
committed
avoid importing testing module
1 parent 9f879a6 commit ac1f907

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ exclude_lines = [
3333
"pragma: no cover",
3434
'\.\.\.',
3535
"raise NotImplementedError",
36+
"if TYPE_CHECKING:",
3637
]
3738
omit = [
3839
"src/idom/__main__.py",

src/idom/widgets.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from base64 import b64encode
4-
from typing import Any, Callable, Iterable, Tuple, TypeVar, Union
4+
from typing import TYPE_CHECKING, Any, Callable, Iterable, Tuple, TypeVar, Union
55

66
from typing_extensions import Protocol
77

@@ -10,7 +10,6 @@
1010
from . import html
1111
from ._warnings import warn
1212
from .core.types import ComponentConstructor, VdomDict
13-
from .testing.backend import _hotswap, _MountFunc
1413

1514

1615
def image(
@@ -95,6 +94,10 @@ def __call__(self, value: str) -> _CastTo:
9594
...
9695

9796

97+
if TYPE_CHECKING:
98+
from .testing.backend import _MountFunc
99+
100+
98101
def hotswap(
99102
update_on_change: bool = False,
100103
) -> Tuple[_MountFunc, ComponentConstructor]: # pragma: no cover
@@ -103,4 +106,6 @@ def hotswap(
103106
DeprecationWarning,
104107
stacklevel=2,
105108
)
109+
from .testing.backend import _hotswap
110+
106111
return _hotswap(update_on_change)

0 commit comments

Comments
 (0)