Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
606ae324
Unverified
Commit
606ae324
authored
Apr 03, 2020
by
moto
Committed by
GitHub
Apr 03, 2020
Browse files
Fix flake8-bugbear lint errors (#505)
parent
78a4a027
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
test/compliance/generate_fbank_data.py
test/compliance/generate_fbank_data.py
+1
-1
test/compliance/generate_test_stft_data.py
test/compliance/generate_test_stft_data.py
+1
-1
test/test_datasets.py
test/test_datasets.py
+1
-1
test/test_transforms.py
test/test_transforms.py
+1
-1
torchaudio/__init__.py
torchaudio/__init__.py
+3
-3
No files found.
test/compliance/generate_fbank_data.py
View file @
606ae324
...
@@ -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
)
...
...
test/compliance/generate_test_stft_data.py
View file @
606ae324
...
@@ -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'
,
...
...
test/test_datasets.py
View file @
606ae324
...
@@ -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
):
...
...
test/test_transforms.py
View file @
606ae324
...
@@ -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
())
...
...
torchaudio/__init__.py
View file @
606ae324
...
@@ -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"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment