U vi @ s d dl mZ d dlmZmZmZmZ d dlmZ d dl m Z mZ d dlm Z mZmZ edddZerrd d lmZ nG d d dZG dd d eje ejZdS ) )annotations) TYPE_CHECKINGCallableOptionalTypeVar)abc) default_errornoop)OnCompletedOnErrorOnNext_T_inT) contravariant)Notificationc @ s e Zd ZdS )r N)__name__ __module____qualname__ r r L/opt/alt/python38/lib/python3.8/site-packages/reactivex/observer/observer.pyr s r c @ s e Zd ZdZd)ddddddd Zd dddd Zd ddddZdddddZdddddZddddZ ddddZ ddddZddddd Zdddd!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_erroron_completedreturnc C s( d| _ |pt| _|pt| _|p t| _d S )NF) is_stoppedr _handler_on_nextr _handler_on_error_handler_on_completed)selfr r r r r r __init__ s zObserver.__init__r )valuer c C s | j s| | dS )z5Notify the observer of a new element in the sequence.N)r _on_next_corer r! r r r r $ s zObserver.on_nextc C s | | dS )ztFor Subclassing purpose. This method is called by `on_next()` method until the observer is stopped. N)r r# r r r r" ) s zObserver._on_next_core Exception)errorr c C s | j sd| _ | | dS )zwNotify the observer that an exception has occurred. Args: error: The error that occurred. TNr _on_error_corer r% r r r r / s zObserver.on_errorc C s | | dS )zuFor Subclassing purpose. This method is called by `on_error()` method until the observer is stopped. N)r r( r r r r' : s zObserver._on_error_core)r c C s | j sd| _ | dS )z1Notifies the observer of the end of the sequence.TN)r _on_completed_corer r r r r @ s zObserver.on_completedc C s | dS )zyFor Subclassing purpose. This method is called by `on_completed()` method until the observer is stopped. N)r r* r r r r) G s zObserver._on_completed_corec C s d| _ dS )zMDisposes the observer, causing it to transition to the stopped state.TN)r r* r r r disposeM s zObserver.disposebool)exnr c C s | j sd| _ | | dS dS )NTFr&