Completed
Pull Request — master (#297)
by Bart
01:21
created

fuel.datasets.YouTubeAudio.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
1
from fuel.datasets.hdf5 import H5PYDataset
2
from fuel.utils import find_in_data_path
3
4
5
class YouTubeAudio(H5PYDataset):
6
    """Dataset of audio from YouTube video.
0 ignored issues
show
Bug introduced by
A suspicious escape sequence \* was found. Did you maybe forget to add an r prefix?

Escape sequences in Python are generally interpreted according to rules similar to standard C. Only if strings are prefixed with r or R are they interpreted as regular expressions.

The escape sequence that was used indicates that you might have intended to write a regular expression.

Learn more about the available escape sequences. in the Python documentation.

Loading history...
7
8
    Assumes the existence of a dataset file with the name
9
    `youtube_id.hdf5`. These datasets don't have any split; the entire
10
    audio sequence is considered training.
11
12
    Note that the data structured in the form `(batch, time, features)`
13
    where `features` are the audio channels (dimension 1 or 2) and batch is
14
    equal to 1 in this case (since there is only one audiotrack).
15
16
    Parameters
17
    ----------
18
    youtube_id : str
19
        11-character video ID (taken from YouTube URL)
20
    \*\*kwargs
21
        Passed to the `H5PYDataset` class.
22
23
    """
24
    def __init__(self, youtube_id, **kwargs):
25
        super(YouTubeAudio, self).__init__(
26
            file_or_path=find_in_data_path('{}.hdf5'.format(youtube_id)),
27
            which_sets=('train',), **kwargs
28
        )
29