U
vi: @ s d dl mZmZmZmZ d dlmZmZm Z d dlm Z d dl
mZ edZd
e j
eej eee gee f ddd Zd gZdS ) )AnyCallableOptionalTypeVar)
Observableabctyping)CompositeDisposable)TimeoutScheduler_TN)duration schedulerreturnc s" t t t t d fdd}|S )N)sourcer c s2 dt jt tt j t jd fdd
}t|S )a Takes elements for the specified duration from the start of
the observable source sequence.
Example:
>>> res = take_with_time(source)
This operator accumulates a queue with a length enough to store
elements received during the initial duration window. As more
elements are received, elements older than the specified
duration are taken from the queue and produced on the result
sequence. This causes elements to be delayed with duration.
Args:
source: Source observable to take elements from.
Returns:
An observable sequence with the elements taken during the
specified duration from the start of the source sequence.
N)observer
scheduler_r c sH p|pt }dtjtd fdd
}||}t|j |dS )Nr
statec s d S )N)Zon_completedr r R/opt/alt/python38/lib/python3.8/site-packages/reactivex/operators/_takewithtime.pyaction( s zJtake_with_time_.