temporary module providing d2f and f2d for converting between twisted and asyncio

This commit is contained in:
Lex Berezhny 2018-12-15 15:30:09 -05:00
parent fb4e94b04a
commit 6c52450858

10
lbrynet/extras/compat.py Normal file
View file

@ -0,0 +1,10 @@
import asyncio
from twisted.internet import defer
def d2f(deferred):
return deferred.asFuture(asyncio.get_event_loop())
def f2d(future):
return defer.Deferred.fromFuture(asyncio.ensure_future(future))