4
4
from typing import Generic , Optional , Tuple , TypeVar , cast
5
5
6
6
from htmltools import Tag
7
- from ipywidgets .widgets import ( # pyright: ignore[reportMissingTypeStubs]
8
- DOMWidget ,
9
- Layout ,
10
- Widget ,
11
- )
7
+ from ipywidgets .widgets import DOMWidget , Layout , Widget
12
8
from shiny import req
13
9
from shiny .reactive ._core import Context , get_current_context
14
10
from shiny .render .renderer import Jsonifiable , Renderer , ValueFn
15
- from traitlets import Unicode
16
11
17
12
from ._as_widget import as_widget
18
13
from ._dependencies import widget_pkg
@@ -94,12 +89,7 @@ async def render(self) -> Jsonifiable | None:
94
89
return None
95
90
96
91
return {
97
- "model_id" : str (
98
- cast (
99
- Unicode ,
100
- widget .model_id , # pyright: ignore[reportUnknownMemberType]
101
- )
102
- ),
92
+ "model_id" : str (widget .model_id ),
103
93
"fill" : fill ,
104
94
}
105
95
@@ -168,7 +158,7 @@ def set_layout_defaults(widget: Widget) -> Tuple[Widget, bool]:
168
158
# If the ipywidget Layout() height is set to something other than "auto", then
169
159
# don't do filling layout https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Layout.html
170
160
if isinstance (layout , Layout ):
171
- if layout .height is not None and layout .height != "auto" : # type: ignore
161
+ if layout .height is not None and layout .height != "auto" :
172
162
fill = False
173
163
174
164
pkg = widget_pkg (widget )
@@ -178,7 +168,7 @@ def set_layout_defaults(widget: Widget) -> Tuple[Widget, bool]:
178
168
from plotly .graph_objs import Layout as PlotlyLayout # pyright: ignore
179
169
180
170
if isinstance (layout , PlotlyLayout ):
181
- if layout .height is not None : # pyright: ignore[reportUnknownMemberType]
171
+ if layout .height is not None :
182
172
fill = False
183
173
# Default margins are also way too big
184
174
layout .template .layout .margin = dict ( # pyright: ignore
@@ -196,7 +186,7 @@ def set_layout_defaults(widget: Widget) -> Tuple[Widget, bool]:
196
186
# container since it'll be contained within the Layout() container, which has a
197
187
# full-fledged sizing API.
198
188
if pkg == "altair" :
199
- import altair as alt # pyright: ignore[reportMissingTypeStubs]
189
+ import altair as alt
200
190
201
191
# Since as_widget() has already happened, we only need to handle JupyterChart
202
192
if isinstance (widget , alt .JupyterChart ):
0 commit comments