def create(): def predicate(x): invoked[0] += 1 if invoked[0] == 3: raise Exception(ex) return is_prime(x) return xs.pipe(ops.skip_while(predicate))
def skip_while_indexed_( predicate: typing.PredicateIndexed[_T], ) -> Callable[[Observable[_T]], Observable[_T]]: def indexer(x: _T, i: int) -> Tuple[_T, int]: return (x, i) def skipper(x: Tuple[_T, int]) -> bool: return predicate(*x) def mapper(x: Tuple[_T, int]) -> _T: return x[0] return compose( ops.map_indexed(indexer), ops.skip_while(skipper), ops.map(mapper), )
def create(): def predicate(x): invoked[0] += 1 return is_prime(x) return xs.pipe(ops.skip_while(predicate))