Skip to content

Commit

Permalink
Remove WrapAsync code
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Oct 1, 2024
1 parent fdc685c commit 21f1022
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
54 changes: 0 additions & 54 deletions shiny/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,60 +279,6 @@ async def fn_async(*args: P.args, **kwargs: P.kwargs) -> R:
return fn_async


# # TODO-barret-future; Q: Keep code?
# class WrapAsync(Generic[P, R]):
# """
# Make a function asynchronous.

# Parameters
# ----------
# fn
# Function to make asynchronous.

# Returns
# -------
# :
# Asynchronous function (within the `WrapAsync` instance)
# """

# def __init__(self, fn: Callable[P, R] | Callable[P, Awaitable[R]]):
# if isinstance(fn, WrapAsync):
# fn = cast(WrapAsync[P, R], fn)
# return fn
# self._is_async = is_async_callable(fn)
# self._fn = wrap_async(fn)

# async def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R:
# """
# Call the asynchronous function.
# """
# return await self._fn(*args, **kwargs)

# @property
# def is_async(self) -> bool:
# """
# Was the original function asynchronous?

# Returns
# -------
# :
# Whether the original function is asynchronous.
# """
# return self._is_async

# @property
# def fn(self) -> Callable[P, R] | Callable[P, Awaitable[R]]:
# """
# Retrieve the original function

# Returns
# -------
# :
# Original function supplied to the `WrapAsync` constructor.
# """
# return self._fn


# This function should generally be used in this code base instead of
# `iscoroutinefunction()`.
def is_async_callable(
Expand Down
3 changes: 0 additions & 3 deletions shiny/render/renderer/_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ def _auto_register(self) -> None:
self._auto_registered = True


# Not inheriting from `WrapAsync[[], IT]` as python 3.8 needs typing extensions that
# doesn't support `[]` for a ParamSpec definition. :-( Would be minimal/clean if we
# could do `class AsyncValueFn(WrapAsync[[], IT]):`
class AsyncValueFn(Generic[IT]):
"""
App-supplied output value function which returns type `IT`.
Expand Down

0 comments on commit 21f1022

Please sign in to comment.