medcat.utils.iterutils
Attributes
Functions
|
|
|
Get an iterable with callback function to identify number of items. |
Module Contents
- medcat.utils.iterutils.T
- medcat.utils.iterutils._callback_iterator_iterable(identifier, data_iterator, callback)
- Parameters:
identifier (str)
data_iterator (Iterable[T])
callback (Callable[[str, int], None])
- Return type:
Iterable[T]
- medcat.utils.iterutils.callback_iterator(identifier, data_iterator, callback)
Get an iterable with callback function to identify number of items.
If the data has a size (i.e list or dict), the length of the data will be reported before iteration.
If the data doesn’t have a size (i.e a generator), the number of items iterated will be reported after the iteration is done.
- Parameters:
identifier (str) – The identifier / name for the iterator.
data_iterator (Iterable[T]) – The iterator.
callback (Callable[[str, int], None]) – The callback method.
- Returns:
Iterable[T] – The wrapped iterator.
- Return type:
Iterable[T]