Ignore:
Timestamp:
May 16, 2016, 5:08:18 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
a6f9ebf
Parents:
58a5fb9
Message:

python/tests: fix most prospect warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/utils.py

    r58a5fb9 r0b6d23d  
    11#! /usr/bin/env python
    22
     3import os
     4import glob
     5import numpy as np
     6from tempfile import mkstemp
     7
    38def array_from_text_file(filename, dtype = 'float'):
    4     import os.path
    5     from numpy import array
    69    filename = os.path.join(os.path.dirname(__file__), filename)
    710    with open(filename) as f:
    811        lines = f.readlines()
    9     return array([line.split() for line in lines],
     12    return np.array([line.split() for line in lines],
    1013            dtype = dtype)
    1114
    1215def list_all_sounds(rel_dir):
    13     import os.path, glob
    1416    datadir = os.path.join(os.path.dirname(__file__), rel_dir)
    1517    return glob.glob(os.path.join(datadir,'*.*'))
     
    2325
    2426def get_tmp_sink_path():
    25     from tempfile import mkstemp
    26     import os
    2727    fd, path = mkstemp()
    2828    os.close(fd)
     
    3030
    3131def del_tmp_sink_path(path):
    32     import os
    3332    os.unlink(path)
    3433
     
    4645    total_frames = 0
    4746    while True:
    48         samples, read = s()
     47        _, read = s()
    4948        total_frames += read
    5049        if read < hopsize: break
     
    5251
    5352def count_samples_in_directory(samples_dir):
    54     import os
    5553    total_frames = 0
    5654    for f in os.walk(samples_dir):
     
    6361
    6462def count_files_in_directory(samples_dir):
    65     import os
    6663    total_files = 0
    6764    for f in os.walk(samples_dir):
Note: See TracChangeset for help on using the changeset viewer.