Skip to content

Commit 49b8b6b

Browse files
authored
Merge pull request #88 from descriptinc/al/readtext
[R-4298] Update from deprecated importlib_resources.read_text to new files api
2 parents 48c7a29 + 1fc25dc commit 49b8b6b

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: [3.7, 3.8]
17+
python-version: [3.7, 3.8, 3.9]
1818

1919
steps:
2020
- uses: actions/checkout@v2

audiotools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.7.1"
1+
__version__ = "0.7.2"
22
from .core import AudioSignal
33
from .core import STFTParams
44
from .core import Meter

audiotools/core/ffmpeg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def ffmpeg_resample(self, sample_rate: int, quiet: bool = True):
136136
command += " -hide_banner -loglevel error"
137137
subprocess.check_call(shlex.split(command))
138138
resampled = AudioSignal(f_out)
139+
Path.unlink(Path(f_out))
139140
return resampled
140141

141142
@classmethod

audiotools/core/playback.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
from .util import _close_temp_files
1717
from .util import format_figure
1818

19-
headers = pkg_resources.read_text(templates, "headers.html")
20-
widget = pkg_resources.read_text(templates, "widget.html")
19+
headers = pkg_resources.files(templates).joinpath("headers.html").read_text()
20+
widget = pkg_resources.files(templates).joinpath("widget.html").read_text()
2121

2222
DEFAULT_EXTENSION = ".wav"
2323

audiotools/ml/layers/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ def save_to_folder(
238238
self,
239239
folder: typing.Union[str, Path],
240240
extra_data: dict = None,
241+
package: bool = True,
241242
):
242243
"""Dumps a model into a folder, as both a package
243244
and as weights, as well as anything specified in
@@ -271,10 +272,11 @@ def save_to_folder(
271272
target_base = Path(f"{folder}/{model_name}/")
272273
target_base.mkdir(exist_ok=True, parents=True)
273274

274-
package_path = target_base / f"package.pth"
275-
weights_path = target_base / f"weights.pth"
275+
if package:
276+
package_path = target_base / f"package.pth"
277+
self.save(package_path)
276278

277-
self.save(package_path)
279+
weights_path = target_base / f"weights.pth"
278280
self.save(weights_path, package=False)
279281

280282
for path, obj in extra_data.items():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="descript-audiotools",
9-
version="0.7.1",
9+
version="0.7.2",
1010
classifiers=[
1111
"Intended Audience :: Developers",
1212
"Intended Audience :: Education",

0 commit comments

Comments
 (0)