Skip to content

Commit

Permalink
docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentqb committed Mar 30, 2020
1 parent d5751bb commit cde66ff
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ def AudioBackendScope(new_backend):


def filter_backends_with_mp3(backends):
# Filter out backends that do not support mp3

test_dirpath, _ = create_temp_assets_dir()
test_filepath = os.path.join(
test_dirpath, "assets", "steam-train-whistle-daniel_simon.mp3"
)

backends_mp3 = []

for backend in backends:
def supports_mp3(backend):
try:
with AudioBackendScope(backend):
torchaudio.load(test_filepath)
backends_mp3.append(backend)
return True
except RuntimeError:
pass
return False

return backends_mp3
return [backend for backend in backends if supports_mp3(backend)]


BACKENDS_MP3 = filter_backends_with_mp3(BACKENDS)

0 comments on commit cde66ff

Please sign in to comment.