Utilities¶
Warning
External usage of internal utility functions and modules should be kept to a minimum as they may be altered, refactored or moved to other locations without notice (and without the typical deprecation cycle).
Async¶
Banner¶
Eventlet¶
Iterators¶
-
taskflow.utils.iter_utils.
fill
(it, *args, **kwargs)[source]¶ Iterates over a provided iterator up to the desired length.
If the source iterator does not have enough values then the filler value is yielded until the desired length is reached.
-
taskflow.utils.iter_utils.
count
(it, *args, **kwargs)[source]¶ Returns how many values in the iterator (depletes the iterator).
-
taskflow.utils.iter_utils.
generate_delays
(delay, max_delay, multiplier=2)[source]¶ Generator/iterator that provides back delays values.
The values it generates increments by a given multiple after each iteration (using the max delay as a upper bound). Negative values will never be generated... and it will iterate forever (ie it will never stop generating values).
-
taskflow.utils.iter_utils.
unique_seen
(its, seen_selector=None)[source]¶ Yields unique values from iterator(s) (and retains order).
-
taskflow.utils.iter_utils.
find_first_match
(it, *args, **kwargs)[source]¶ Searches iterator for first value that matcher callback returns true.
Kazoo¶
Kombu¶
-
class
taskflow.utils.kombu_utils.
DelayedPretty
(message)[source]¶ Bases:
object
Wraps a message and delays prettifying it until requested.
TODO(harlowja): remove this when https://github.com/celery/kombu/pull/454/ is merged and a release is made that contains it (since that pull request is equivalent and/or better than this).
Miscellaneous¶
Mixins¶
-
class
taskflow.utils.mixins.
StrMixin
[source]¶ Bases:
object
Mixin that helps deal with the PY2 and PY3 method differences.
http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/ explains why this is quite useful...