Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-4298] Update from deprecated importlib_resources.read_text to new files api #88

Merged
merged 5 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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