nrel.hive.util.fp
Module Contents
Functions
|
helper that throws an io result if it contains a Failure |
|
helper to throw or return the inner value of a ResultE type |
helper to apply an operation to a sequence safely |
Attributes
- nrel.hive.util.fp.throw_on_failure(io_result)[source]
helper that throws an io result if it contains a Failure
should only be used in the hive.app module (at the “end-of-the-world”).
- Parameters:
io_result – a result from some IO operation
- Raises:
any error result
- nrel.hive.util.fp.T
- nrel.hive.util.fp.throw_or_return(result: returns.result.ResultE[T]) T[source]
helper to throw or return the inner value of a ResultE type
- Parameters:
result – The result to check
- nrel.hive.util.fp.Accumulator
- nrel.hive.util.fp.Item
- nrel.hive.util.fp.apply_op_to_accumulator(op: Callable[[Item], Callable[[Accumulator], returns.result.ResultE[Accumulator]]], sequence: Iterable[Item], initial: Accumulator) returns.result.ResultE[Accumulator][source]
helper to apply an operation to a sequence safely
- Parameters:
op – the operation to apply
sequence – the sequence to apply the operation to
initial – the initial value of the accumulator