File: _combinelatest.py

package info (click to toggle)
python-rx 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,204 kB
  • sloc: python: 39,525; javascript: 77; makefile: 24
file content (30 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import Any, Callable

import reactivex
from reactivex import Observable


def combine_latest_(
    *others: Observable[Any],
) -> Callable[[Observable[Any]], Observable[Any]]:
    def combine_latest(source: Observable[Any]) -> Observable[Any]:
        """Merges the specified observable sequences into one
        observable sequence by creating a tuple whenever any
        of the observable sequences produces an element.

        Examples:
            >>> obs = combine_latest(source)

        Returns:
            An observable sequence containing the result of combining
            elements of the sources into a tuple.
        """

        sources = (source,) + others

        return reactivex.combine_latest(*sources)

    return combine_latest


__all__ = ["combine_latest_"]