U vi @ s d dl mZ d dlmZmZmZmZmZ d dlm Z m Z d dlmZm Z d dlmZ d dlmZ edZedZe e eege e f eege e f ee e ge eeef f d d dZdgZdS ) )OrderedDict)AnyCallableOptionalTupleTypeVar) Observableabc)CompositeDisposableSingleAssignmentDisposable)noop)take_T1_T2)rightleft_duration_mapperright_duration_mapperreturnc s, t t t tttf d fdd}|S )N)sourcer c s@ | dt jtttf tt j t jd fdd }t|S )a@ Correlates the elements of two sequences based on overlapping durations. Args: source: Source observable. Return: An observable sequence that contains elements combined into a tuple from source elements that have an overlapping duration. N)observer schedulerr c s t dt ddt dtd fdd}d dfdd} j|j|d td fd d}fdd } j|j|d S )NFr )valuec s d } d7 t | <