Skip to content
Snippets Groups Projects
Commit 28768e34 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Fix python 3 imports

parent 6201591a
No related branches found
No related tags found
1 merge request!82Add a function to read features with generators
Pipeline #
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment