From 8e8282e92d5588bc18a7aa7c58a3d7511b2a268f Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 21 Mar 2024 15:50:15 -0400 Subject: [PATCH] Update _dispatch.py --- shiny/render/renderer/_dispatch.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shiny/render/renderer/_dispatch.py b/shiny/render/renderer/_dispatch.py index 4d1838963..8d5f63d9c 100644 --- a/shiny/render/renderer/_dispatch.py +++ b/shiny/render/renderer/_dispatch.py @@ -7,11 +7,11 @@ Callable, Literal, Protocol, - TypeGuard, TypeVar, runtime_checkable, ) +from ..._typing_extensions import TypeGuard from ...types import Jsonifiable if TYPE_CHECKING: @@ -39,7 +39,12 @@ async def __call__(self, arg: Any) -> Jsonifiable: ... def is_output_binding_request_handler(x: Any) -> TypeGuard[OutputBindingRequestHandler]: - return callable(x) and (getattr(x, "_outputBindingRequestHandler", False) == True) + if not callable(x): + return False + attr = getattr(x, "_outputBindingRequestHandler", False) + if not isinstance(attr, bool): + return False + return attr # Cast value for within `output_binding_request_handler` dispatching