U vi8@sddlmZmZmZmZddlZddlmZmZddlm Z m Z m Z edZ d eee eeegeefeee eee gee fdddZ dgZdS) )AnyCallableOptionalTypeVarN) Observableabc)CompositeDisposableSerialDisposableSingleAssignmentDisposable_T) first_timeouttimeout_duration_mapperotherreturncsB|p t|pttdttttdfdd }|S)aReturns the source observable sequence, switching to the other observable sequence if a timeout is signaled. res = timeout_with_mapper(reactivex.timer(500)) res = timeout_with_mapper(reactivex.timer(500), lambda x: reactivex.timer(200)) res = timeout_with_mapper( reactivex.timer(500), lambda x: reactivex.timer(200)), reactivex.return_value(42) ) Args: first_timeout -- [Optional] Observable sequence that represents the timeout for the first element. If not provided, this defaults to reactivex.never(). timeout_duration_mapper -- [Optional] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element. other -- [Optional] Sequence to return in case of a timeout. If not provided, this is set to reactivex.throw(). Returns: The source sequence switching to the other sequence in case of a timeout. Timeout)sourcercs4dtjtttjtjdfdd }t|S)N)observer schedulerrcsttt}|_ddgttdd fdd fddtdd fd d }tdd fd d }ddfdd } j|||d|_tS)NFr)timeoutrcsdfddt_tddfdd }tddfdd }dd fd d }|j|||d _dS)Nrcs dkS)Nrr)_idmy_idrW/opt/alt/python38/lib/python3.8/site-packages/reactivex/operators/_timeoutwithmapper.py timer_winsAszktimeout_with_mapper_..timeout_with_mapper..subscribe..set_timer..timer_winsxrcs"rjd_dS)Nr) subscribe disposableZdispose)r)drother_r subscriptionrrron_nextGs zhtimeout_with_mapper_..timeout_with_mapper..subscribe..set_timer..on_next)ercsr|dSNon_error)r#)rrrrr&Oszitimeout_with_mapper_..timeout_with_mapper..subscribe..set_timer..on_errorrcsr_dSr$)rrr)rr r!rrr on_completedSszmtimeout_with_mapper_..timeout_with_mapper..subscribe..set_timer..on_completedr)r rr Exceptionr)rr"r&r()rrr rr!timer)rrrr set_timer>szWtimeout_with_mapper_..timeout_with_mapper..subscribe..set_timercs }|rdd7<|S)Nrr)res)rswitchedrr observer_wins]sz[timeout_with_mapper_..timeout_with_mapper..subscribe..observer_winsrc slrh|d}zr"|nt}Wn2tk r^}z|WYdSd}~XYnX|dSr$)r" reactivexneverr)r&)rrr#)rr/r+r rrr"ds   zUtimeout_with_mapper_..timeout_with_mapper..subscribe..on_next)errorrcsr|dSr$r%)r2rr/rrr&tszVtimeout_with_mapper_..timeout_with_mapper..subscribe..on_errorr'csrdSr$)r(rr3rrr(xszZtimeout_with_mapper_..timeout_with_mapper..subscribe..on_completedr) r r rrrr r)rr)rroriginalr"r&r()first_timeout_r rr )rrr/rr+r!r.r*rr1s&"zDtimeout_with_mapper_..timeout_with_mapper..subscribe)N)rZ ObserverBaser rZ SchedulerBaseZDisposableBaser)rrr5r r )rrtimeout_with_mapper0sPz1timeout_with_mapper_..timeout_with_mapper)r0r1throwr)rr )r r rr7rr6rtimeout_with_mapper_s  Sr9)NNN)typingrrrrr0rrZreactivex.disposablerr r r r9__all__rrrrs   x