Unverified Commit 606ae324 authored by moto's avatar moto Committed by GitHub
Browse files

Fix flake8-bugbear lint errors (#505)

parent 78a4a027
...@@ -10,7 +10,7 @@ import utils ...@@ -10,7 +10,7 @@ import utils
def run(exe_path, scp_path, out_dir, wave_len, num_outputs, remove_files, log_level): def run(exe_path, scp_path, out_dir, wave_len, num_outputs, remove_files, log_level):
logging.basicConfig(level=log_level) logging.basicConfig(level=log_level)
for i in range(num_outputs): for _ in range(num_outputs):
try: try:
nyquist = 16000 // 2 nyquist = 16000 // 2
high_freq = random.randint(1, nyquist) high_freq = random.randint(1, nyquist)
......
...@@ -8,7 +8,7 @@ import utils ...@@ -8,7 +8,7 @@ import utils
def run(exe_path, scp_path, out_dir, wave_len, num_outputs, remove_files, log_level): def run(exe_path, scp_path, out_dir, wave_len, num_outputs, remove_files, log_level):
logging.basicConfig(level=log_level) logging.basicConfig(level=log_level)
for i in range(num_outputs): for _ in range(num_outputs):
inputs = { inputs = {
'blackman_coeff': '%.4f' % (random.random() * 5), 'blackman_coeff': '%.4f' % (random.random() * 5),
'dither': '0', 'dither': '0',
......
...@@ -46,7 +46,7 @@ class TestDatasets(unittest.TestCase): ...@@ -46,7 +46,7 @@ class TestDatasets(unittest.TestCase):
path = os.path.join(self.path, "commonvoice") path = os.path.join(self.path, "commonvoice")
data = COMMONVOICE(path, "train.tsv", "tatar") data = COMMONVOICE(path, "train.tsv", "tatar")
data = bg_iterator(data, 5) data = bg_iterator(data, 5)
for d in data: for _ in data:
pass pass
def test_ljspeech(self): def test_ljspeech(self):
......
...@@ -24,7 +24,7 @@ class Tester(unittest.TestCase): ...@@ -24,7 +24,7 @@ class Tester(unittest.TestCase):
test_filepath = os.path.join(test_dirpath, 'assets', test_filepath = os.path.join(test_dirpath, 'assets',
'steam-train-whistle-daniel_simon.wav') 'steam-train-whistle-daniel_simon.wav')
def scale(self, waveform, factor=float(2**31)): def scale(self, waveform, factor=2.0**31):
# scales a waveform by a factor # scales a waveform by a factor
if not waveform.is_floating_point(): if not waveform.is_floating_point():
waveform = waveform.to(torch.get_default_dtype()) waveform = waveform.to(torch.get_default_dtype())
......
...@@ -73,7 +73,7 @@ def load(filepath, ...@@ -73,7 +73,7 @@ def load(filepath,
""" """
return getattr(_get_audio_backend_module(), 'load')( return _get_audio_backend_module().load(
filepath, filepath,
out=out, out=out,
normalization=normalization, normalization=normalization,
...@@ -116,7 +116,7 @@ def save(filepath, src, sample_rate, precision=16, channels_first=True): ...@@ -116,7 +116,7 @@ def save(filepath, src, sample_rate, precision=16, channels_first=True):
Default: ``True``) Default: ``True``)
""" """
return getattr(_get_audio_backend_module(), 'save')( return _get_audio_backend_module().save(
filepath, src, sample_rate, precision=precision, channels_first=channels_first filepath, src, sample_rate, precision=precision, channels_first=channels_first
) )
...@@ -208,7 +208,7 @@ def info(filepath): ...@@ -208,7 +208,7 @@ def info(filepath):
>>> rate, channels, encoding = si.rate, si.channels, ei.encoding >>> rate, channels, encoding = si.rate, si.channels, ei.encoding
""" """
return getattr(_get_audio_backend_module(), 'info')(filepath) return _get_audio_backend_module().info(filepath)
@_audio_backend_guard("sox") @_audio_backend_guard("sox")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment