def max_( comparer: Optional[Comparer[_T]] = None, ) -> Callable[[Observable[_T]], Observable[_T]]: """Returns the maximum value in an observable sequence according to the specified comparer. Examples: >>> op = max() >>> op = max(lambda x, y: x.value - y.value) Args: comparer: [Optional] Comparer used to compare elements. Returns: An operator function that takes an observable source and returns an observable sequence containing a single element with the maximum element in the source sequence. """ return compose( ops.max_by(identity, comparer), ops.map(first_only), )
def create(): def mapper(x): return x["key"] return xs.pipe(ops.max_by(mapper))
def create(): return xs.pipe(ops.max_by(lambda x: x["key"], reverse_comparer))
def create(): return xs.pipe(ops.max_by(lambda x: x["key"]))