-
Notifications
You must be signed in to change notification settings - Fork 2
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
Mypy support #7
Comments
As i’m tampering with the library i managed to create my own typed wrapper above from typing import (
Any,
AsyncGenerator,
Callable,
Coroutine,
Generator,
TypeVar,
overload,
Union,
)
import universalasync
T = TypeVar("T")
@overload
def synchronize(
function: Callable[..., Coroutine[Any, Any, T]]
) -> Callable[..., Union[Coroutine[Any, Any, T], T]]: ...
@overload
def synchronize(
function: Callable[..., AsyncGenerator[T, None]]
) -> Callable[..., Union[AsyncGenerator[T, None], Generator[T, None, None]]]: ...
def synchronize(
f: Callable[..., Coroutine[Any, Any, T]],
) -> Callable[..., T]:
return universalasync.async_to_sync_wraps(f) |
The problem is that later, mypy does not manage to infer the async or sync value from the call context. There was a closed request for a way to handle the request context of the call (async or sync) in mypy but it was rejected: python/mypy#9837 |
I’d like to request a review of my matter, pretty please. Don’t give up on me. :) |
Hi! Really sorry for the delay |
Hey,
Great job there, i’m wondering if you plan to support proper python typing ?
I’m happy to provide very easily a sync interface to my library unfortunately, everything mypy related is broken in sync context.
If not, do you have any tips to override the typing ?
The text was updated successfully, but these errors were encountered: