U vi @sddlmZddlmZmZmZmZddlmZddl m Z m Z ddl m Z mZmZedddZerrdd lmZnGd d d ZGd d d ejeejZdS)) annotations) TYPE_CHECKINGCallableOptionalTypeVar)abc) default_errornoop) OnCompletedOnErrorOnNext_T_inT) contravariant) Notificationc@s eZdZdS)rN)__name__ __module__ __qualname__rrL/opt/alt/python38/lib/python3.8/site-packages/reactivex/observer/observer.pyrsrc@seZdZdZd)ddddddd Zd dd d d Zd dd ddZdddddZdddddZddddZ ddddZ ddddZ ddddd Z dddd!d"Z d#dd$d%Zd&dd'd(ZdS)*ObserverzBase class for implementations of the Observer class. This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages. NzOptional[OnNext[_T_in]]zOptional[OnError]zOptional[OnCompleted]None)on_nexton_error on_completedreturncCs(d|_|p t|_|pt|_|p t|_dS)NF) is_stoppedr _handler_on_nextr_handler_on_error_handler_on_completed)selfrrrrrr__init__s  zObserver.__init__r )valuercCs|js||dS)z5Notify the observer of a new element in the sequence.N)r _on_next_corerr!rrrr$szObserver.on_nextcCs||dS)ztFor Subclassing purpose. This method is called by `on_next()` method until the observer is stopped. N)rr#rrrr")szObserver._on_next_core Exception)errorrcCs|jsd|_||dS)zwNotify the observer that an exception has occurred. Args: error: The error that occurred. TNr_on_error_corerr%rrrr/szObserver.on_errorcCs||dS)zuFor Subclassing purpose. This method is called by `on_error()` method until the observer is stopped. N)rr(rrrr':szObserver._on_error_core)rcCs|jsd|_|dS)z1Notifies the observer of the end of the sequence.TN)r_on_completed_corerrrrr@szObserver.on_completedcCs |dS)zyFor Subclassing purpose. This method is called by `on_completed()` method until the observer is stopped. N)rr*rrrr)GszObserver._on_completed_corecCs d|_dS)zMDisposes the observer, causing it to transition to the stopped state.TN)rr*rrrdisposeMszObserver.disposebool)exnrcCs|jsd|_||dSdS)NTFr&)rr-rrrfailRs  z Observer.failcCsddl}||dS)Nr) traceback print_stack)rr%r/rrrthrowZszObserver.throwz%Callable[[Notification[_T_in]], None]csdddfdd }|S)zCreates a notification callback from an observer. Returns the action that forwards its input notification to the underlying observer.zNotification[_T_in]r)notifierrcs |S)N)accept)r2r*rrfuncfsz"Observer.to_notifier..funcr)rr4rr*r to_notifier`szObserver.to_notifierzabc.ObserverBase[_T_in]cCst|j|j|jS)zHides the identity of an observer. Returns an observer that hides the identity of the specified observer. )rrrrr*rrr as_observerkszObserver.as_observer)NNN)rrr__doc__r rr"rr'rr)r+r.r1r5r6rrrrrs    rN) __future__rtypingrrrrZ reactivexrZreactivex.internal.basicrr Zreactivex.typingr r r r Zreactivex.notificationrZ ObserverBaseZDisposableBaserrrrrs