General Utilities¶
-
class
findig.utils.
DataPipe
(*funcs)[source]¶ An object that folds data over a set of functions.
Parameters: funcs – A variable list of functions. Each function must take one parameter and return a single value. Calling this object with data will pass the data through each one of the functions that is has collected, using the result of one function as the argument for the next function. For example, if the data pipe
dpipe
contains the functions[f1, f2, ..., fn]
, thendpipe(data)
is equivalent tofn(...(f2(f1(data))))
.
-
class
findig.utils.
extremum
(direction=1)[source]¶ A class whose instances are always ordered at one extreme.
Parameters: direction – If positive, always order as greater than every other object. If negative, orders as less than every other object.
-
findig.utils.
tryeach
(funcs, *args, **kwargs)[source]¶ Call every item in a list a functions with the same arguments, until one of them does not throw an error. If all of the functions raise an error, then the error from the last function will be re-raised.
Parameters: funcs – An iterable of callables.