-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates when python min version is 3.9 #1237
Comments
Definition: 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 Update class AsyncValueFn(WrapAsync[[], IT]):
... |
Just curious: why does this Python 3.9? |
When inheriting from a class that has a ParamSpec, in Python >= 3.9 the paramspec can be defined as |
Closing as it will not be utilized |
No description provided.
The text was updated successfully, but these errors were encountered: