U
vi @ s d dl mZmZmZ d dlZd dlmZmZ d dlmZm Z edZ
eg eej f eeej gee
f ee
dddZdgZ
dS ) )CallableOptionalTypeVarN)
Observableabc)CompositeDisposable
Disposable_T)resource_factoryobservable_factoryreturnc s0 dt jt tt j t jd fdd
}t|S )a? Constructs an observable sequence that depends on a resource
object, whose lifetime is tied to the resulting observable
sequence's lifetime.
Example:
>>> res = reactivex.using(lambda: AsyncSubject(), lambda: s: s)
Args:
resource_factory: Factory function to obtain a resource object.
observable_factory: Factory function to obtain an observable
sequence that depends on the obtained resource.
Returns:
An observable sequence whose lifetime controls the lifetime
of the dependent resource object.
N)observer schedulerr c
s~ t }z }|d k r|} |}W nD tk
rh } z&t|j| |d}t|| W Y S d }~X Y nX t|j| |d|S )N)r )r Exception reactivexthrow subscriber )r
r Zdispresourcesource exceptiondr r
K/opt/alt/python38/lib/python3.8/site-packages/reactivex/observable/using.pyr s zusing_.