module documentation

General functional-style helpers for disttrial.

Function compose Create a function that calls one function with an argument and then another function with the result of the first function.
Function countingCalls Wrap a function with another that automatically passes an integer counter of the number of calls that have gone through the wrapper.
Function flip Create a function like another but with the order of the first two arguments flipped.
Function fromOptional Get a definite value from an optional value.
Async Function iterateWhile Call a function repeatedly until its result fails to satisfy a predicate.
Async Function sequence Wait for one action to complete and then another.
Function takeWhile No summary
Variable discardResult Undocumented
Constant _A Undocumented
Constant _B Undocumented
Constant _C Undocumented
def compose(fx, fy): (source)

Create a function that calls one function with an argument and then another function with the result of the first function.

Parameters
fx:Callable[[_B], _C]Undocumented
fy:Callable[[_A], _B]Undocumented
Returns
Callable[[_A], _C]Undocumented
def countingCalls(f): (source)

Wrap a function with another that automatically passes an integer counter of the number of calls that have gone through the wrapper.

Parameters
f:Callable[[int], _A]Undocumented
Returns
Callable[[], _A]Undocumented
def flip(f): (source)

Create a function like another but with the order of the first two arguments flipped.

Parameters
f:Callable[[_A, _B], _C]Undocumented
Returns
Callable[[_B, _A], _C]Undocumented
def fromOptional(default, optional): (source)

Get a definite value from an optional value.

Parameters
default:_AThe value to return if the optional value is missing.
optional:Optional[_A]The optional value to return if it exists.
Returns
_AUndocumented
async def iterateWhile(predicate, action): (source)

Call a function repeatedly until its result fails to satisfy a predicate.

Parameters
predicate:Callable[[_A], bool]The check to apply.
action:Callable[[], Awaitable[_A]]The function to call.
Returns
_AThe result of action which did not satisfy predicate.
async def sequence(a, b): (source)

Wait for one action to complete and then another.

If either action fails, failure is propagated. If the first action fails, the second action is not waited on.

Parameters
a:Awaitable[_A]Undocumented
b:Awaitable[_B]Undocumented
Returns
_BUndocumented
def takeWhile(condition, xs): (source)
Parameters
condition:Callable[[_A], bool]Undocumented
xs:Iterable[_A]Undocumented
Returns
Iterable[_A]Undocumented
discardResult: Callable[[Awaitable[_A]], Deferred[None]] = (source)

Undocumented

Undocumented

Value
TypeVar('_A')

Undocumented

Value
TypeVar('_B')

Undocumented

Value
TypeVar('_C')