sndata.utils.wrappers¶
The wrappers
contains function or object wrappers used by the
parent package.
-
sndata.utils.wrappers.
build_pbar
(data: iter, verbose: Union[bool, dict])[source]¶ Cast an iterable into a progress bar
If verbose is False, return
data
unchanged.Parameters: - data – An iterable object
- verbose – Arguments for tqdm.tqdm
-
sndata.utils.wrappers.
ignore_warnings_wrapper
(func: callable) → callable[source]¶ Ignores warnings issued by the wrapped function call
-
sndata.utils.wrappers.
lru_copy_cache
(maxsize: int = 128, typed: bool = False, copy: bool = True)[source]¶ Decorator to cache the return of a function
Similar to
functools.lru_cache
, but allows a copy of the cached value to be returned, thus preventing mutation of the cache.Parameters: - maxsize – Maximum size of the cache
- typed – Cache objects of different types separately (Default: False)
- copy – Return a copy of the cached item (Default: True)
Returns: A decorator