Skip to content

Commit 242da23

Browse files
committed
Use isinstance(x, ReprHtml) rather than looking for specific field
1 parent 19c5eba commit 242da23

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

htmltools/_core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def get_html_string(
412412
if prev_was_add_ws:
413413
html_ += " " * indent
414414

415-
html_ += child._repr_html_() # type: ignore
415+
html_ += child._repr_html_() # pyright: ignore[reportPrivateUsage]
416416

417417
prev_was_add_ws = False
418418

@@ -998,8 +998,8 @@ def wrap_displayhook_handler(
998998
def handler_wrapper(value: object) -> None:
999999
if isinstance(value, (Tag, TagList, Tagifiable)):
10001000
handler(value)
1001-
elif hasattr(value, "_repr_html_"):
1002-
handler(HTML(value._repr_html_())) # pyright: ignore
1001+
elif isinstance(value, ReprHtml):
1002+
handler(HTML(value._repr_html_())) # pyright: ignore[reportPrivateUsage]
10031003
elif value not in (None, ...):
10041004
handler(value)
10051005

0 commit comments

Comments
 (0)