U vi @ s d dl mZmZmZmZmZ d dlmZmZ d dl m Z edZedZedZ de eef ee ee f eee geeee f f dd d Zd gZdS ) )CallableDictOptionalTypeVarcast) Observableabc)Mapper_T_TKey_TValueN) key_mapperelement_mapperreturnc s* t t t tttf d fdd}|S )N)sourcer c s: dt jtttf tt j t jd fdd }t|S )a Converts the observable sequence to a Map if it exists. Args: source: Source observable to convert. Returns: An observable sequence with a single value of a dictionary containing the values from the observable sequence. N)observer schedulerr c sH t td d fdd}d d fdd}j|j||dS )N)xr c s z| }W n2 t k r> } z| W Y d S d }~X Y nX rz | }W q t k r } z| W Y d S d }~X Y qX n tt| }||<