async_rx.observable.rx_count   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A rx_count() 0 11 2
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