Skip to content

Commit 3f9fbca

Browse files
committed
Clean up import for pyright
1 parent d2d2be9 commit 3f9fbca

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

dash/development/_py_components_generation.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@
2222
import_string = """# AUTO GENERATED FILE - DO NOT EDIT
2323
2424
import typing # noqa: F401
25-
from typing import TYPE_CHECKING # noqa: F401
2625
from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
2726
from dash.development.base_component import Component, _explicitize_args
28-
if TYPE_CHECKING:
27+
try:
2928
from dash.types import NumberType # noqa: F401
30-
else:
31-
try:
32-
from dash.types import NumberType # noqa: F401
33-
except ImportError:
34-
NumberType = typing.Union[ # noqa: F401
35-
typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
36-
]
29+
except ImportError:
30+
# Backwards compatibility for dash<=4.1.0
31+
if typing.TYPE_CHECKING:
32+
raise
33+
NumberType = typing.Union[ # noqa: F401
34+
typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
35+
]
3736
{custom_imports}
3837
ComponentSingleType = typing.Union[str, int, float, Component, None]
3938
ComponentType = typing.Union[

0 commit comments

Comments
 (0)