def contains_( value: _T, comparer: Optional[typing.Comparer[_T]] = None ) -> Callable[[Observable[_T]], Observable[bool]]: comparer_ = comparer or default_comparer def predicate(v: _T) -> bool: return comparer_(v, value) return compose( ops.filter(predicate), ops.some(), )
def all_( predicate: Predicate[_T] ) -> Callable[[Observable[_T]], Observable[bool]]: def filter(v: _T): return not predicate(v) def mapping(b: bool) -> bool: return not b return compose( ops.filter(filter), ops.some(), ops.map(mapping), )
def is_empty_() -> Callable[[Observable[Any]], Observable[bool]]: """Determines whether an observable sequence is empty. Returns: An observable sequence containing a single element determining whether the source sequence is empty. """ def mapper(b: bool) -> bool: return not b return compose( ops.some(), ops.map(mapper), )
def create(): return xs.pipe(ops.some(lambda x: x > 0))
def create(): return xs.pipe(ops.some())