U viL(@sRddlmZddlmZmZmZmZmZmZm Z m Z m Z ddl m Z mZddlmZddlmZddlmZddlmZmZmZdd lmZdd lmZmZdd lmZe d Ze d Ze dZ e dZ!e dZ"e dZ#e dZ$e dZ%e dZ&e dZ'e dZ(e dZ)eeeedddZ*dege!fee!eefee eedfeedddZ+eeeedd d!Z,eeeeedd"d#Z-ej.eeed$d%d&Z/e ee#ee$eee#e$fd'd(d)Z0e ee#ee$ee%eee#e$e%fd*d+d)Z0e ee#ee$ee%ee&eee#e$e%e&fd,d-d)Z0eeeed.d/d)Z0eeeedd0d1Z1eeeeedd2d3Z2ee j3ge eedffeed4d5d6Z4dee j3eed7d8d9Z5eeej6eee fee d:d;d<Z7e ee#ee$eee#e$fd'd=d>Z8e ee#ee$ee%eee#e$e%fd*d?d>Z8e ee#ee$ee%ee&eee#e$e%e&fd,d@d>Z8e ee#ee$ee%ee&ee'eee#e$e%e&e'fdAdBd>Z8eeeeddCd>Z8degefee j3eedDdEdFZ9dedGedHfeej6eefegeefdIdJdKZ:deedLdMdNZ;deeee j3eedOdPdQZde?ej@ee j3eee e?eAfefeeBeedVdWdXZCedYdZeCZDe"ejEe"ej6e"e"fee"gej@fee"d[d\d]ZFe"ejEe"ej6e"e"fee"d^d_d`ZGde?ej@ejHee j3eee e?eAfefeeBeedbdcddZIdegeJfe eedfe deedfeededfdgZKdej@ee j3eeLdhdidjZMeeeeddkdlZNeedmdndoZOeeedpdqdrZPe eedeeeBgeeffeeddsdtZQdeLeeLeeLee j3eeLdudvdwZRdeee j3eedxdydzZSed{d|eSZTdeeeLeed}d~dZUdegefee j3eedddZVegdfeedddZWde e?eBfee j3eedddZXdejHeej@ee j3eeLdddZYdedGefee j3edGeefdddZZegee j[feee j[geefeedddZ\eeeeedGfdddZ]eeeeedGfdpddZ^dddd!d#d&d)dd1d3dd6d9d>dFdKdNdQddoddtdrdddzddwddddddddddddg(Z_dS))Future) AnyCallableIterableMappingOptionalTupleTypeVarUnionoverload)abctyping) __version__)alias) Notification)ConnectableObservableGroupedObservable Observable)Observer)composepipe)Subject_T_T1_T2_TKey_TState_A_B_C_D_E_F_G)sourcesreturncGsddlm}||S)a Propagates the observable sequence that emits first. .. marble:: :alt: amb ---8--6--9-----------| --1--2--3---5--------| ----------10-20-30---| [ amb() ] --1--2--3---5--------| Example: >>> winner = reactivex.amb(xs, ys, zs) Args: sources: Sequence of observables to monitor for first emission. Returns: An observable sequence that surfaces any of the given sequences, whichever emitted the first element. r )amb_)Zobservable.ambr')r%r'r(C/opt/alt/python38/lib/python3.8/site-packages/reactivex/__init__.pyamb(s r*Nz Future[_T])mapperr%default_sourcer&cCsddlm}||||S)ayUses mapper to determine which source in sources to use. .. marble:: :alt: case --1---------------| a--1--2--3--4--| b--10-20-30---| [case(mapper, { 1: a, 2: b })] ---1--2--3--4--| Examples: >>> res = reactivex.case(mapper, { '1': obs1, '2': obs2 }) >>> res = reactivex.case(mapper, { '1': obs1, '2': obs2 }, obs0) Args: mapper: The function which extracts the value for to test in a case statement. sources: An object which has keys which correspond to the case statement labels. default_source: [Optional] The observable sequence or Future that will be run if the sources are not matched. If this is not provided, it defaults to :func:`empty`. Returns: An observable sequence which is determined by a case statement. r )case_)Zobservable.caser-)r+r%r,r-r(r(r)caseDs! r.cGsddlm}||S)a5Continues observable sequences which are terminated with an exception by switching over to the next observable sequence. .. marble:: :alt: catch ---1---2---3-* a-7-8-| [ catch(a) ] ---1---2---3---7-8-| Examples: >>> res = reactivex.catch(xs, ys, zs) Args: sources: Sequence of observables. Returns: An observable sequence containing elements from consecutive observables from the sequence of sources until one of them terminates successfully. r catch_with_iterable_Zobservable.catchr0r%r0r(r(r)catchjs r3cCsddlm}||S)aContinues observable sequences that are terminated with an exception by switching over to the next observable sequence. .. marble:: :alt: catch ---1---2---3-* a-7-8-| [ catch(a) ] ---1---2---3---7-8-| Examples: >>> res = reactivex.catch([xs, ys, zs]) >>> res = reactivex.catch(src for src in [xs, ys, zs]) Args: sources: An Iterable of observables; thus, a generator can also be used here. Returns: An observable sequence containing elements from consecutive observables from the sequence of sources until one of them terminates successfully. r r/r1r2r(r(r)catch_with_iterables r4) subscriber&cCst|S)afCreates an observable sequence object from the specified subscription function. .. marble:: :alt: create [ create(a) ] ---1---2---3---4---| Args: subscribe: Subscription function. Returns: An observable sequence that can be subscribed to via the given subscription function. )r)r5r(r(r)createsr6)__a__br&cCsdSNr(r7r8r(r(r)combine_latestsr;)r7r8__cr&cCsdSr9r(r7r8r<r(r(r)r;s)r7r8r<__dr&cCsdSr9r(r7r8r<r>r(r(r)r;s) __sourcesr&cGsddlm}||S)aDMerges the specified observable sequences into one observable sequence by creating a tuple whenever any of the observable sequences emits an element. .. marble:: :alt: combine_latest ---a-----b--c------| --1---2--------3---| [ combine_latest() ] ---a1-a2-b2-c2-c3--| Examples: >>> obs = rx.combine_latest(obs1, obs2, obs3) Args: sources: Sequence of observables. Returns: An observable sequence containing the result of combining elements from each source in given sequence. r )combine_latest_)Zobservable.combinelatestrA)r@rAr(r(r)r;s cGsddlm}||S)aConcatenates all of the specified observable sequences. .. marble:: :alt: concat ---1--2--3--| --6--8--| [ concat() ] ---1--2--3----6--8-| Examples: >>> res = reactivex.concat(xs, ys, zs) Args: sources: Sequence of observables. Returns: An observable sequence that contains the elements of each source in the given sequence, in sequential order. r concat_with_iterable_Zobservable.concatrCr%rCr(r(r)concats rFcCsddlm}||S)aGConcatenates all of the specified observable sequences. .. marble:: :alt: concat ---1--2--3--| --6--8--| [ concat() ] ---1--2--3----6--8-| Examples: >>> res = reactivex.concat_with_iterable([xs, ys, zs]) >>> res = reactivex.concat_with_iterable(for src in [xs, ys, zs]) Args: sources: An Iterable of observables; thus, a generator can also be used here. Returns: An observable sequence that contains the elements of each given sequence, in sequential order. r rBrDrEr(r(r)concat_with_iterables rG)factoryr&cCsddlm}||S)aReturns an observable sequence that invokes the specified factory function whenever a new observer subscribes. .. marble:: :alt: defer [ defer(1,2,3) ] ---1--2--3--| ---1--2--3--| Example: >>> res = reactivex.defer(lambda scheduler: of(1, 2, 3)) Args: factory: Observable factory function to invoke for each observer which invokes :func:`subscribe() ` on the resulting sequence. The factory takes a single argument, the scheduler used. Returns: An observable sequence whose observers trigger an invocation of the given factory function. r )defer_)Zobservable.deferrI)rHrIr(r(r)defer s rJ) schedulerr&cCsddlm}||S)aReturns an empty observable sequence. .. marble:: :alt: empty [ empty() ] --| Example: >>> obs = reactivex.empty() Args: scheduler: [Optional] Scheduler instance to send the termination call on. By default, this will use an instance of :class:`ImmediateScheduler `. Returns: An observable sequence with no elements. r )empty_)Zobservable.emptyrL)rKrLr(r(r)empty@s rM)valuesr+r&cCst||}t|S)aConcatenates the observable sequences obtained by running the specified result mapper for each element in the specified values. .. marble:: :alt: for_in a--1--2-| b--10--20-| [for_in((a, b), lambda i: i+1)] ---2--3--11--21-| Note: This is just a wrapper for :func:`reactivex.concat(map(mapper, values)) ` Args: values: An Iterable of values to turn into an observable source. mapper: A function to apply to each item in the values list to turn it into an observable sequence; this should return instances of :class:`reactivex.Observable`. Returns: An observable sequence from the concatenated observable sequences. )maprG)rNr+Zmappedr(r(r)for_inZs rPcCsdSr9r(r:r(r(r) fork_join}srQcCsdSr9r(r=r(r(r)rQscCsdSr9r(r?r(r(r)rQs)r7r8r<r>__er&cCsdSr9r()r7r8r<r>rRr(r(r)rQscGsddlm}||S)aWait for observables to complete and then combine last values they emitted into a tuple. Whenever any of that observables completes without emitting any value, result sequence will complete at that moment as well. .. marble:: :alt: fork_join ---a-----b--c---d-| --1---2------3-4---| -a---------b---| [ fork_join() ] --------------------d4b| Examples: >>> obs = reactivex.fork_join(obs1, obs2, obs3) Args: sources: Sequence of observables. Returns: An observable sequence containing the result of combining last element from each source in given sequence. r ) fork_join_)Zobservable.forkjoinrS)r%rSr(r(r)rQs )supplierrKr&cCsddlm}|||S)anReturns an observable sequence that contains a single element generated by the given supplier, using the specified scheduler to send out observer messages. .. marble:: :alt: from_callable [ from_callable() ] --1--| Examples: >>> res = reactivex.from_callable(lambda: calculate_value()) >>> res = reactivex.from_callable(lambda: 1 / 0) # emits an error Args: supplier: Function which is invoked to obtain the single element. scheduler: [Optional] Scheduler instance to schedule the values on. If not specified, the default is to use an instance of :class:`CurrentThreadScheduler `. Returns: An observable sequence containing the single element obtained by invoking the given supplier function. r )from_callable_)observable.returnvaluerU)rTrKrUr(r(r) from_callables rW.).N)funcr+r&cCsddlm}|||S)aConverts a callback function to an observable sequence. Args: func: Function with a callback as the last argument to convert to an Observable sequence. mapper: [Optional] A mapper which takes the arguments from the callback to produce a single item to yield on next. Returns: A function, when executed with the required arguments minus the callback, produces an Observable sequence with a single value of the arguments to the callback as a list. r )from_callback_)Zobservable.fromcallbackrY)rXr+rYr(r(r) from_callbacks rZ)futurer&cCsddlm}||S)asConverts a Future to an Observable sequence .. marble:: :alt: from_future [ from_future() ] ------1| Args: future: A Python 3 compatible future. https://docs.python.org/3/library/asyncio-task.html#future Returns: An observable sequence which wraps the existing future success and failure. r ) from_future_)Zobservable.fromfuturer\)r[r\r(r(r) from_futures r])iterablerKr&cCsddlm}|||S)aConverts an iterable to an observable sequence. .. marble:: :alt: from_iterable [ from_iterable(1,2,3) ] ---1--2--3--| Example: >>> reactivex.from_iterable([1,2,3]) Args: iterable: An Iterable to change into an observable sequence. scheduler: [Optional] Scheduler instance to schedule the values on. If not specified, the default is to use an instance of :class:`CurrentThreadScheduler `. Returns: The observable sequence whose elements are pulled from the given iterable sequence. r )from_iterable_)Zobservable.fromiterabler_)r^rKr_r(r(r) from_iterables r`from_z*Alias for :func:`reactivex.from_iterable`. from_list皙?)stringtimespanrKlookuperrorr&cCsddlm}||||||dS)a Convert a marble diagram string to a cold observable sequence, using an optional scheduler to enumerate the events. .. marble:: :alt: from_marbles [ from_marbles(-1-2-3-) ] -1-2-3-| Each character in the string will advance time by timespan (except for space). Characters that are not special (see the table below) will be interpreted as a value to be emitted. Numbers will be cast to int or float. Special characters: +------------+--------------------------------------------------------+ | :code:`-` | advance time by timespan | +------------+--------------------------------------------------------+ | :code:`#` | on_error() | +------------+--------------------------------------------------------+ | :code:`|` | on_completed() | +------------+--------------------------------------------------------+ | :code:`(` | open a group of marbles sharing the same timestamp | +------------+--------------------------------------------------------+ | :code:`)` | close a group of marbles | +------------+--------------------------------------------------------+ | :code:`,` | separate elements in a group | +------------+--------------------------------------------------------+ | | used to align multiple diagrams, does not advance time | +------------+--------------------------------------------------------+ In a group of elements, the position of the initial :code:`(` determines the timestamp at which grouped elements will be emitted. E.g. :code:`--(12,3,4)--` will emit 12, 3, 4 at 2 * timespan and then advance virtual time by 8 * timespan. Examples: >>> from_marbles('--1--(2,3)-4--|') >>> from_marbles('a--b--c-', lookup={'a': 1, 'b': 2, 'c': 3}) >>> from_marbles('a--b---#', error=ValueError('foo')) Args: string: String with marble diagram timespan: [Optional] Duration of each character in seconds. If not specified, defaults to :code:`0.1`. scheduler: [Optional] Scheduler to run the the input sequence on. If not specified, defaults to the subscribe scheduler if defined, else to an instance of :class:`NewThreadScheduler >> res = reactivex.generate_with_relative_time( 0, lambda x: True, lambda x: x + 1, lambda x: 0.5 ) Args: initial_state: Initial state. condition: Condition to terminate generation (upon returning :code:`False`). iterate: Iteration step function. time_mapper: Time mapper function to control the speed of values being produced each iteration, returning relative times, i.e. either a :class:`float` denoting seconds, or an instance of :class:`timedelta`. Returns: The generated sequence. r )generate_with_relative_time_)Z#observable.generatewithrelativetimerp)rlrmrnrorpr(r(r)generate_with_relative_timews! rq)rlrmrnr&cCsddlm}||||S)aGenerates an observable sequence by running a state-driven loop producing the sequence's elements. .. marble:: :alt: generate [ generate() ] -1-2-3-4-| Example: >>> res = reactivex.generate(0, lambda x: x < 10, lambda x: x + 1) Args: initial_state: Initial state. condition: Condition to terminate generation (upon returning :code:`False`). iterate: Iteration step function. Returns: The generated sequence. r ) generate_)Zobservable.generaterr)rlrmrnrrr(r(r)generates rs)rdreduetimerKrfrgr&cCs ddlm}|||||||dS)a Convert a marble diagram string to a hot observable sequence, using an optional scheduler to enumerate the events. .. marble:: :alt: hot [ from_marbles(-1-2-3-) ] -1-2-3-| -2-3-| Each character in the string will advance time by timespan (except for space). Characters that are not special (see the table below) will be interpreted as a value to be emitted. Numbers will be cast to int or float. Special characters: +------------+--------------------------------------------------------+ | :code:`-` | advance time by timespan | +------------+--------------------------------------------------------+ | :code:`#` | on_error() | +------------+--------------------------------------------------------+ | :code:`|` | on_completed() | +------------+--------------------------------------------------------+ | :code:`(` | open a group of elements sharing the same timestamp | +------------+--------------------------------------------------------+ | :code:`)` | close a group of elements | +------------+--------------------------------------------------------+ | :code:`,` | separate elements in a group | +------------+--------------------------------------------------------+ | | used to align multiple diagrams, does not advance time | +------------+--------------------------------------------------------+ In a group of elements, the position of the initial :code:`(` determines the timestamp at which grouped elements will be emitted. E.g. :code:`--(12,3,4)--` will emit 12, 3, 4 at 2 * timespan and then advance virtual time by 8 * timespan. Examples: >>> hot("--1--(2,3)-4--|") >>> hot("a--b--c-", lookup={'a': 1, 'b': 2, 'c': 3}) >>> hot("a--b---#", error=ValueError("foo")) Args: string: String with marble diagram timespan: [Optional] Duration of each character in seconds. If not specified, defaults to :code:`0.1`. duetime: [Optional] Absolute datetime or timedelta from now that determines when to start the emission of elements. scheduler: [Optional] Scheduler to run the the input sequence on. If not specified, defaults to an instance of :class:`NewThreadScheduler `. lookup: [Optional] A dict used to convert an element into a specified value. If not specified, defaults to :code:`{}`. error: [Optional] Exception that will be use in place of the :code:`#` symbol. If not specified, defaults to :code:`Exception('error')`. Returns: The observable sequence whose elements are pulled from the given marble diagram string. r )hotri)rjrv)rdrerurKrfrgZ_hotr(r(r)rvsE rv)rm then_source else_sourcer&cCsddlm}||||S)aDetermines whether an observable collection contains values. .. marble:: :alt: if_then ---1--2--3--| --6--8--| [ if_then() ] ---1--2--3--| Examples: >>> res = reactivex.if_then(condition, obs1) >>> res = reactivex.if_then(condition, obs1, obs2) Args: condition: The condition which determines if the then_source or else_source will be run. then_source: The observable sequence or :class:`Future` that will be run if the condition function returns :code:`True`. else_source: [Optional] The observable sequence or :class:`Future` that will be run if the condition function returns :code:`False`. If this is not provided, it defaults to :func:`empty() `. Returns: An observable sequence which is either the then_source or else_source. r )if_then_)Zobservable.ifthenry)rmrwrxryr(r(r)if_thens! rz)periodrKr&cCsddlm}|||S)aReturns an observable sequence that produces a value after each period. .. marble:: :alt: interval [ interval() ] ---1---2---3---4---> Example: >>> res = reactivex.interval(1.0) Args: period: Period for producing the values in the resulting sequence (specified as a :class:`float` denoting seconds or an instance of :class:`timedelta`). scheduler: Scheduler to run the interval on. If not specified, an instance of :class:`TimeoutScheduler ` is used. Returns: An observable sequence that produces a value after each period. r ) interval_)Zobservable.intervalr|)r{rKr|r(r(r)interval.s r}cGsddlm}||S)aMerges all the observable sequences into a single observable sequence. .. marble:: :alt: merge ---1---2---3---4-| -a---b---c---d--| [ merge() ] -a-1-b-2-c-3-d-4-| Example: >>> res = reactivex.merge(obs1, obs2, obs3) Args: sources: Sequence of observables. Returns: The observable sequence that merges the elements of the observable sequences. r )merge_)Zobservable.merger~)r%r~r(r(r)mergeLs r)r&cCsddlm}|S)a,Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). .. marble:: :alt: never [ never() ] --> Returns: An observable sequence whose observers will never get called. r never_)Zobservable.neverrrr(r(r)neverfs r)argsr&cGst|S)aThis method creates a new observable sequence whose elements are taken from the arguments. .. marble:: :alt: of [ of(1,2,3) ] ---1--2--3--| Note: This is just a wrapper for :func:`reactivex.from_iterable(args) ` Example: >>> res = reactivex.of(1,2,3) Args: args: The variable number elements to emit from the observable. Returns: The observable sequence whose elements are pulled from the given arguments )r`)rr(r(r)ofxsrcGsddlm}||S)aContinues an observable sequence that is terminated normally or by an exception with the next observable sequence. .. marble:: :alt: on_error_resume_next --1--2--* a--3--4--* b--6-| [on_error_resume_next(a,b)] --1--2----3--4----6-| Examples: >>> res = reactivex.on_error_resume_next(xs, ys, zs) Args: sources: Sequence of sources, each of which is expected to be an instance of either :class:`Observable` or :class:`Future`. Returns: An observable sequence that concatenates the source sequences, even if a sequence terminates with an exception. r )on_error_resume_next_)Zobservable.onerrorresumenextr)r%rr(r(r)on_error_resume_nexts r)startstopsteprKr&cCsddlm}|||||S)aGenerates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages. .. marble:: :alt: range [ range(4) ] --0--1--2--3--| Examples: >>> res = reactivex.range(10) >>> res = reactivex.range(0, 10) >>> res = reactivex.range(0, 10, 1) Args: start: The value of the first integer in the sequence. stop: [Optional] Generate number up to (exclusive) the stop value. Default is `sys.maxsize`. step: [Optional] The step to be used (default is 1). scheduler: [Optional] The scheduler to schedule the values on. If not specified, the default is to use an instance of :class:`CurrentThreadScheduler `. Returns: An observable sequence that contains a range of sequential integral numbers. r )range_)Zobservable.ranger)rrrrKrr(r(r)ranges# r)valuerKr&cCsddlm}|||S)a Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages. There is an alias called 'just'. .. marble:: :alt: return_value [ return_value(4) ] -4-| Examples: >>> res = reactivex.return_value(42) >>> res = reactivex.return_value(42, timeout_scheduler) Args: value: Single element in the resulting observable sequence. Returns: An observable sequence containing the single specified element. r ) return_value_)rVr)rrKrr(r(r) return_values rjustz)Alias for :func:`reactivex.return_value`.)r repeat_countr&cCsddlm}|||S)aKGenerates an observable sequence that repeats the given element the specified number of times. .. marble:: :alt: repeat_value [ repeat_value(4) ] -4-4-4-4-> Examples: >>> res = reactivex.repeat_value(42) >>> res = reactivex.repeat_value(42, 4) Args: value: Element to repeat. repeat_count: [Optional] Number of times to repeat the element. If not specified, repeats indefinitely. Returns: An observable sequence that repeats the given element the specified number of times. r ) repeat_value_)Zobservable.repeatr)rrrr(r(r) repeat_values r)rXrKr&cCsddlm}|||S)aInvokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence. .. marble:: :alt: start [ start(lambda i: return 4) ] -4-| -4-| Note: The function is called immediately, not during the subscription of the resulting sequence. Multiple subscriptions to the resulting sequence can observe the function's result. Example: >>> res = reactivex.start(lambda: pprint('hello')) >>> res = reactivex.start(lambda: pprint('hello'), rx.Scheduler.timeout) Args: func: Function to run asynchronously. scheduler: [Optional] Scheduler to run the function on. If not specified, defaults to an instance of :class:`TimeoutScheduler `. Returns: An observable sequence exposing the function's result value, or an exception. r )start_)Zobservable.startr)rXrKrr(r(r)rs r)function_asyncr&cCsddlm}||S)aInvokes the asynchronous function, surfacing the result through an observable sequence. .. marble:: :alt: start_async [ start_async() ] ------1| Args: function_async: Asynchronous function which returns a :class:`Future` to run. Returns: An observable sequence exposing the function's result value, or an exception. r ) start_async_)Zobservable.startasyncr)rrr(r(r) start_async<s r) exceptionrKr&cCsddlm}|||S)aReturns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message. .. marble:: :alt: throw [ throw() ] -* Example: >>> res = reactivex.throw(Exception('Error')) Args: exception: An object used for the sequence's termination. scheduler: [Optional] Scheduler to schedule the error notification on. If not specified, the default is to use an instance of :class:`ImmediateScheduler `. Returns: The observable sequence that terminates exceptionally with the specified exception object. r )throw_)Zobservable.throwr)rrKrr(r(r)throwSs r)rur{rKr&cCsddlm}||||S)a|Returns an observable sequence that produces a value after duetime has elapsed and then after each period. .. marble:: :alt: timer [ timer(2) ] --0-| Examples: >>> res = reactivex.timer(datetime(...)) >>> res = reactivex.timer(datetime(...), 0.1) >>> res = reactivex.timer(5.0) >>> res = reactivex.timer(5.0, 1.0) Args: duetime: Absolute (specified as a datetime object) or relative time (specified as a float denoting seconds or an instance of timedelta) at which to produce the first value. period: [Optional] Period to produce subsequent values (specified as a float denoting seconds or an instance of timedelta). If not specified, the resulting timer is not recurring. scheduler: [Optional] Scheduler to run the timer on. If not specified, the default is to use an instance of :class:`TimeoutScheduler `. Returns: An observable sequence that produces a value after due time has elapsed and then each period. r )timer_)Zobservable.timerr)rur{rKrr(r(r)timerqs# rcCsddlm}|||S)a_Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler. .. marble:: :alt: to_async [ to_async()() ] ------1| Examples: >>> res = reactivex.to_async(lambda x, y: x + y)(4, 3) >>> res = reactivex.to_async(lambda x, y: x + y, Scheduler.timeout)(4, 3) >>> res = reactivex.to_async(lambda x: log.debug(x), Scheduler.timeout)('hello') Args: func: Function to convert to an asynchronous function. scheduler: [Optional] Scheduler to run the function on. If not specified, defaults to an instance of :class:`TimeoutScheduler `. Returns: Asynchronous function. r ) to_async_)Zobservable.toasyncr)rXrKrr(r(r)to_asyncs r)resource_factoryobservable_factoryr&cCsddlm}|||S)a?Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. Example: >>> res = reactivex.using(lambda: AsyncSubject(), lambda: s: s) Args: resource_factory: Factory function to obtain a resource object. observable_factory: Factory function to obtain an observable sequence that depends on the obtained resource. Returns: An observable sequence whose lifetime controls the lifetime of the dependent resource object. r )using_)Zobservable.usingr)rrrr(r(r)usings rcGsddlm}||S)aMerges the specified observable sequences into one observable sequence by creating a :class:`tuple` only when the first observable sequence produces an element. .. marble:: :alt: with_latest_from ---1---2---3----4-| --a-----b----c-d----| [with_latest_from() ] ---1,a-2,a-3,b--4,d-| Examples: >>> obs = rx.with_latest_from(obs1) >>> obs = rx.with_latest_from([obs1, obs2, obs3]) Args: sources: Sequence of observables. Returns: An observable sequence containing the result of combining elements of the sources into a :class:`tuple`. r )with_latest_from_)Zobservable.withlatestfromr)r%rr(r(r)with_latest_froms rcGsddlm}||S)aVMerges the specified observable sequences into one observable sequence by creating a :class:`tuple` whenever all of the observable sequences have produced an element at a corresponding index. .. marble:: :alt: zip --1--2---3-----4---| -a----b----c-d------| [ zip() ] --1,a-2,b--3,c-4,d-| Example: >>> res = rx.zip(obs1, obs2) Args: args: Observable sources to zip. Returns: An observable sequence containing the result of combining elements of the sources as a :class:`tuple`. r )zip_)Zobservable.zipr)rrr(r(r)zips rr rrrrrrrrrr)N)N)N)N)N)rcNNN)rcrtNNN)N)N)NNN)N)N)N)N)NN)N)`asynciorrrrrrrrr r r r _versionrZinternal.utilsrZ notificationrZ observablerrrZobserverrrrsubjectrrrrrrrrr r!r"r#r$r*r.r3r4Z Subscriptionr6r;rFrGZ SchedulerBaserJrMZMapperrPrQrWrZr]r`rarbstrZ RelativeTimefloat ExceptionrhrkZ PredicaterqrsZAbsoluteOrRelativeTimervboolrzintr}rrrrrrrrrrrrrZDisposableBaserrr__all__r(r(r(r)s ,        &  #   $    I   '  ! O  '  # )    %   )  "