U vi @ sb d dl mZmZmZ d dlmZmZ edZdee eee geee f dddZdgZ dS ) )CallableOptionalTypeVar) Observableabc_TN) default_valuereturnc s$ t t t tt d fdd}|S )N)sourcer c s4 dt jtt tt j t jd fdd }t|S )a Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty. Examples: >>> obs = default_if_empty(source) Args: source: Source observable. Returns: An observable sequence that contains the specified default value if the source is empty otherwise, the elements of the source. N)observer schedulerr c s> dg t d fdd} fdd}j|j||dS )NFxc s d d<