diff --git a/bob/bio/base/utils/io.py b/bob/bio/base/utils/io.py index d1f43cb9498a28497e133a7e3afa5c44c21ca194..bafd215bbb923ba53f91ec480c3fe7aa278adc8d 100644 --- a/bob/bio/base/utils/io.py +++ b/bob/bio/base/utils/io.py @@ -1,7 +1,10 @@ import os import tempfile import tarfile -import collections # this is needed for the sphinx documentation +try: # this is needed for the sphinx documentation + from collections.abc import Callable, Iterable +except ImportError: + from collections import Callable, Iterable import functools # this is needed for the sphinx documentation import numpy import logging @@ -182,9 +185,9 @@ def _generate_features(reader, paths): Parameters ---------- - reader : collections.Callable + reader : Callable See the documentation of :py:func:`vstack_features`. - paths : collections.Iterable + paths : Iterable See the documentation of :py:func:`vstack_features`. Yields @@ -270,14 +273,14 @@ def vstack_features(reader, paths, same_size=False): Parameters ---------- - reader : collections.Callable + reader : Callable The function to load the features. The function should only take one argument being the path to the features. Use :any:`functools.partial` to accommodate your reader to this format. The features returned by ``reader`` are expected to have the same :py:class:`numpy.dtype` and the same shape except for their first dimension. First dimension is should correspond to the number of samples. - paths : collections.Iterable + paths : Iterable An iterable of paths to iterate on. Whatever is inside path is given to ``reader``. If ``same_size`` is ``True``, ``len(paths)`` must be valid. same_size : :obj:`bool`, optional