| Total Complexity | 2 |
| Total Lines | 18 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from ..protocol import Observable |
||
| 2 | from .rx_reduce import rx_reduce |
||
| 3 | |||
| 4 | __all__ = ["rx_count"] |
||
| 5 | |||
| 6 | |||
| 7 | def rx_count(observable: Observable) -> Observable: |
||
| 8 | """Create an observable wich counts the emissions on the source and emits result. |
||
| 9 | |||
| 10 | Args: |
||
| 11 | observable (observable): the observable source |
||
| 12 | |||
| 13 | Returns: |
||
| 14 | (Observable): observable instance |
||
| 15 | |||
| 16 | """ |
||
| 17 | return rx_reduce(observable=observable, accumulator=lambda emit, item: emit + 1, seed=0) |
||
| 18 |