U vi @sddlmZddlmZmZmZmZddlZddlmZm Z ddl m Z m Z edZ ee eeee geee dffee dd d Zeee eeee gee ffeee gee fd d d Zd gZdS))Future)CallableOptionalTypeVarUnionN) Observableabc)SerialDisposableSingleAssignmentDisposable_Tz Future[_T])sourcehandlerreturncs0dtjtttjtjdfdd }t|S)N)observer schedulerrcsJt}t|_tddfdd }jj|jd|_S)N) exceptionrc szz|}Wn2tk r@}z|WYdSd}~XYnXt|trVt|n|}t}|_|jd|_dS)Nr) Exceptionon_error isinstancer reactivexZ from_futurer disposable subscribe)rresultexd)r rrr subscriptionK/opt/alt/python38/lib/python3.8/site-packages/reactivex/operators/_catch.pyrs z2catch_handler..subscribe..on_errorr)r r rrrZon_nextZ on_completed)rrZd1rr r )rrrrrsz catch_handler..subscribe)N)rZ ObserverBaser rZ SchedulerBaseZDisposableBaser)r r rrrr catch_handler sr )r rcs ttttdfdd }|S)N)r rcs"trt|St|SdS)aContinues an observable sequence that is terminated by an exception with the next observable sequence. Examples: >>> op = catch(ys) >>> op = catch(lambda ex, src: ys(ex)) Args: handler: Second observable sequence used to produce results when an error occurred in the first sequence, or an exception handler function that returns an observable sequence given the error and source observable that occurred in the first sequence. Returns: An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred. N)callabler rcatch)r r rrr"2s zcatch_..catch)rr )r r"rr#rcatch_-sr$)asynciortypingrrrrrrrZreactivex.disposabler r r rr r$__all__rrrrs  # !