Skip to content

Commit

Permalink
Merge pull request #88 from descriptinc/al/readtext
Browse files Browse the repository at this point in the history
[R-4298] Update from deprecated importlib_resources.read_text to new files api
  • Loading branch information
aluebs authored Jul 12, 2023
2 parents 48c7a29 + 1fc25dc commit 49b8b6b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion audiotools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.7.1"
__version__ = "0.7.2"
from .core import AudioSignal
from .core import STFTParams
from .core import Meter
Expand Down
1 change: 1 addition & 0 deletions audiotools/core/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def ffmpeg_resample(self, sample_rate: int, quiet: bool = True):
command += " -hide_banner -loglevel error"
subprocess.check_call(shlex.split(command))
resampled = AudioSignal(f_out)
Path.unlink(Path(f_out))
return resampled

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions audiotools/core/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from .util import _close_temp_files
from .util import format_figure

headers = pkg_resources.read_text(templates, "headers.html")
widget = pkg_resources.read_text(templates, "widget.html")
headers = pkg_resources.files(templates).joinpath("headers.html").read_text()
widget = pkg_resources.files(templates).joinpath("widget.html").read_text()

DEFAULT_EXTENSION = ".wav"

Expand Down
8 changes: 5 additions & 3 deletions audiotools/ml/layers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def save_to_folder(
self,
folder: typing.Union[str, Path],
extra_data: dict = None,
package: bool = True,
):
"""Dumps a model into a folder, as both a package
and as weights, as well as anything specified in
Expand Down Expand Up @@ -271,10 +272,11 @@ def save_to_folder(
target_base = Path(f"{folder}/{model_name}/")
target_base.mkdir(exist_ok=True, parents=True)

package_path = target_base / f"package.pth"
weights_path = target_base / f"weights.pth"
if package:
package_path = target_base / f"package.pth"
self.save(package_path)

self.save(package_path)
weights_path = target_base / f"weights.pth"
self.save(weights_path, package=False)

for path, obj in extra_data.items():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="descript-audiotools",
version="0.7.1",
version="0.7.2",
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Education",
Expand Down

0 comments on commit 49b8b6b

Please sign in to comment.