diff --git a/shiny/_utils.py b/shiny/_utils.py index 23e67af6e..4ac7b10a7 100644 --- a/shiny/_utils.py +++ b/shiny/_utils.py @@ -393,7 +393,7 @@ def _step(fut: Optional["asyncio.Future[None]"] = None): assert fut.done() try: fut.result() - except BaseException as e: + except BaseException as e: # noqa: B036 exc = e if result_future.cancelled(): @@ -419,7 +419,7 @@ def _step(fut: Optional["asyncio.Future[None]"] = None): except (KeyboardInterrupt, SystemExit) as e: result_future.set_exception(e) raise - except BaseException as e: + except BaseException as e: # noqa: B036 result_future.set_exception(e) else: # If we get here, the coro didn't finish. Schedule it for completion. diff --git a/shiny/render/renderer/_renderer.py b/shiny/render/renderer/_renderer.py index 0be14fc23..cb0bbd04a 100644 --- a/shiny/render/renderer/_renderer.py +++ b/shiny/render/renderer/_renderer.py @@ -225,7 +225,9 @@ class AsyncValueFn(Generic[IT]): def __init__(self, fn: Callable[[], IT] | Callable[[], Awaitable[IT]]): if isinstance(fn, AsyncValueFn): - return cast(AsyncValueFn[IT], fn) + raise TypeError( + "Must not call `AsyncValueFn.__init__` with an object of class `AsyncValueFn`" + ) self._is_async = is_async_callable(fn) self._fn = wrap_async(fn) self._orig_fn = fn