Spaces:
Running
Running
File size: 341 Bytes
3a3b216 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from functools import wraps
from typing import Any, Callable
from .loop import create_event_loop
def async_to_sync_method(func: Callable) -> Callable:
@wraps(func)
def wrapper(self, *args, **kwargs) -> Any:
loop = create_event_loop()
return loop.run_until_complete(func(self, *args, **kwargs))
return wrapper
|