Skip to content

Commit b770246

Browse files
committed
simplified caching logic
1 parent 6025c2a commit b770246

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

audioread/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ def available_backends(flush_cache=False):
6969
If the parameter `flush_cache` is set to `True`, then the cache
7070
will be flushed and the backend list will be reconstructed.
7171
"""
72-
if flush_cache:
73-
BACKENDS.clear()
7472

75-
if BACKENDS:
73+
if BACKENDS and not flush_cache:
7674
return BACKENDS
7775

7876
# Standard-library WAV and AIFF readers.
@@ -99,7 +97,7 @@ def available_backends(flush_cache=False):
9997
result.append(ffdec.FFmpegAudioFile)
10098

10199
# Cache the backends we found
102-
BACKENDS.extend(result)
100+
BACKENDS[:] = result
103101

104102
return BACKENDS
105103

0 commit comments

Comments
 (0)