def iload(files, load_func, **kwargs):
"""
Create a stream of arrays from files, which are loaded lazily.
Parameters
----------
pattern : iterable of str or str
Either an iterable of filenames or a glob-like pattern str.
load_func : callable, optional
Function taking a filename as its first arguments
kwargs
Keyword arguments are passed to ``load_func``.
Yields
------
arr: `~numpy.ndarray`
Loaded data.
"""
if isinstance(files, str):
files = iglob(files)
files = iter(files)
yield from map(partial(load_func, **kwargs), files)
# pmap does not support local functions
评论列表
文章目录