コード例 #1
0
 def create():
     pfh = self.test_obs.pipe(pairwise_buffer, ops.map(lambda x: x[0]))
     w = pfh.pipe(
         ops.window(
             self.test_obs.pipe(pairwise_buffer,
                                ops.filter(lambda x: x[0] != x[1]))))
     return w.pipe(ops.flat_map(lambda x: x.pipe(ops.to_list())))
コード例 #2
0
 def create():
     def mapper(w, i):
         return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))
     return xs.pipe(
             ops.window(ys),
             ops.map_indexed(mapper),
             ops.merge_all(),
             )
コード例 #3
0
ファイル: test_window.py プロジェクト: wolf937/RxPY
        def create():
            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                ops.window(ys),
                ops.map_indexed(mapper),
                ops.merge_all(),
            )
コード例 #4
0
ファイル: test_window.py プロジェクト: wolf937/RxPY
        def create():
            def closing(x):
                raise Exception(ex)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                ops.window(ys, closing),
                ops.map_indexed(mapper),
                ops.merge_all(),
            )
コード例 #5
0
ファイル: test_window.py プロジェクト: wolf937/RxPY
        def create():
            def closing():
                return rx.throw(ex)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                ops.window(closing),
                ops.map_indexed(mapper),
                ops.merge_all(),
            )
コード例 #6
0
        def create():
            def closing(x):
                raise Exception(ex)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                    ops.window(ys, closing),
                    ops.map_indexed(mapper),
                    ops.merge_all(),
                    )
コード例 #7
0
        def create():
            def closing():
                return rx.throw(ex)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                    ops.window(closing),
                    ops.map_indexed(mapper),
                    ops.merge_all(),
                    )
コード例 #8
0
ファイル: test_window.py プロジェクト: wolf937/RxPY
        def create():
            def closing():
                curr = window[0]
                window[0] += 1
                return rx.timer(curr * 100)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                ops.window(closing),
                ops.map_indexed(mapper),
                ops.merge_all(),
            )
コード例 #9
0
ファイル: test_window.py プロジェクト: wolf937/RxPY
        def create():
            def closings():
                w = window[0]
                window[0] += 1
                return rx.timer(w * 100)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                ops.window(window_closing_mapper=closings),
                ops.map_indexed(mapper),
                ops.merge_all(),
            )
コード例 #10
0
        def create():
            def closing():
                curr = window[0]
                window[0] += 1
                return rx.timer(curr * 100)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                    ops.window(closing),
                    ops.map_indexed(mapper),
                    ops.merge_all(),
                    )
コード例 #11
0
        def create():
            def closings():
                w = window[0]
                window[0] += 1
                return rx.timer(w * 100)

            def mapper(w, i):
                return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x)))

            return xs.pipe(
                    ops.window(window_closing_mapper=closings),
                    ops.map_indexed(mapper),
                    ops.merge_all(),
                    )
コード例 #12
0
ファイル: buffer.py プロジェクト: wolf937/RxPY
def _buffer(buffer_openings=None,
            buffer_closing_mapper=None) -> Callable[[Observable], Observable]:
    """Projects each element of an observable sequence into zero or more
    buffers.

    Args:
        buffer_openings -- Observable sequence whose elements denote the
            creation of windows.
        buffer_closing_mapper -- [optional] A function invoked to define
            the closing of each produced window. If a closing mapper
            function is specified for the first parameter, this parameter is
            ignored.

    Returns:
        A function that takes an observable source and retuerns an
        observable sequence of windows.
    """

    return pipe(ops.window(buffer_openings, buffer_closing_mapper),
                ops.flat_map(pipe(ops.to_iterable(), ops.map(list))))
コード例 #13
0
ファイル: buffer.py プロジェクト: ReactiveX/RxPY
def _buffer(buffer_openings=None, buffer_closing_mapper=None) -> Callable[[Observable], Observable]:
    """Projects each element of an observable sequence into zero or more
    buffers.

    Args:
        buffer_openings -- Observable sequence whose elements denote the
            creation of windows.
        buffer_closing_mapper -- [optional] A function invoked to define
            the closing of each produced window. If a closing mapper
            function is specified for the first parameter, this parameter is
            ignored.

    Returns:
        A function that takes an observable source and retuerns an
        observable sequence of windows.
    """

    return pipe(
        ops.window(buffer_openings, buffer_closing_mapper),
        ops.flat_map(pipe(ops.to_iterable(), ops.map(list)))
    )
コード例 #14
0
ファイル: buffer.py プロジェクト: Panthera-onca/experiment3_1
def _buffer(boundaries: Observable) -> Callable[[Observable], Observable]:
    return pipe(ops.window(boundaries),
                ops.flat_map(pipe(ops.to_iterable(), ops.map(list))))