U
vâ’i} ã @ sn d dl Z d dl mZ d dlmZmZmZmZ d dlmZm Z d dl
mZ edƒZdee dœd d
„Z
d
gZdS )é N)ÚFuture)ÚAnyÚOptionalÚTypeVarÚcast)Ú
ObservableÚabc)Ú
DisposableÚ_Tú
Future[_T]©ÚfutureÚreturnc s. dt jt tt j t jdœ‡ fdd„
}t|ƒS )a Converts a Future to an Observable sequence
Args:
future -- A Python 3 compatible future.
https://docs.python.org/3/library/asyncio-task.html#future
Returns:
An Observable sequence which wraps the existing future success
and failure.
N)ÚobserverÚ schedulerr c s8 dd dœ‡ fdd„}ˆ |¡ d dœ‡fdd„}t|ƒS )Nr r c
s‚ z| ¡ }W n^ tk
r8 } zˆ |¡ W 5 d }~X Y nF tjk
rj } zˆ tt|ƒ¡ W 5 d }~X Y nX ˆ |¡ ˆ ¡ d S ©N)ÚresultÚ ExceptionZon_errorÚasyncioÚCancelledErrorr Zon_nextZon_completed)r
ÚvalueÚex©r © úP/opt/alt/python38/lib/python3.8/site-packages/reactivex/observable/fromfuture.pyÚdone s "
z-from_future_.