Skip to content

Commit

Permalink
Depend on audeer>=2.0.0 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored Jan 25, 2024
1 parent 2bd8953 commit a1fb630
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion auglib/core/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def default_cache_root(augment: Augment = None) -> str:
root = os.environ.get("AUGLIB_CACHE_ROOT") or config.CACHE_ROOT
if augment is not None:
root = os.path.join(root, augment.short_id)
return audeer.path(root)
return audeer.path(root, follow_symlink=True)
18 changes: 1 addition & 17 deletions auglib/core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,6 @@
from auglib.core.seed import seed as seed_func


def _remove(path: str): # pragma: no cover
path = audeer.path(path)
if os.path.exists(path):
os.remove(path)


def _make_tree(files: typing.Sequence[str]): # pragma: no cover
dirs = set()
for f in files:
dirs.add(os.path.dirname(f))
for d in list(dirs):
audeer.mkdir(d)


class Augment(audinterface.Process, audobject.Object):
r"""Augmentation interface.
Expand Down Expand Up @@ -113,7 +99,6 @@ class Augment(audinterface.Process, audobject.Object):
Examples:
>>> import audb
>>> import audeer
>>> import audiofile
>>> import auglib
>>> db = audb.load(
Expand Down Expand Up @@ -302,7 +287,7 @@ def augment(

cache_root = default_cache_root()
else:
cache_root = audeer.path(cache_root)
cache_root = audeer.path(cache_root, follow_symlink=True)
cache_root = os.path.join(cache_root, self.short_id)

transform_path = os.path.join(cache_root, "transform.yaml")
Expand Down Expand Up @@ -572,7 +557,6 @@ def _augmented_files(
remove_root: str = None,
) -> typing.Sequence[str]:
r"""Return cache file names by joining with the cache directory."""
cache_root = audeer.path(cache_root)
if remove_root is None:

def join(path1: str, path2: str) -> str:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ classifiers = [
'Topic :: Scientific/Engineering',
]
dependencies = [
'audformat >=0.15.2',
'audeer >=2.0.0',
'audformat >=1.1.0',
'audinterface >=1.0.4',
'audmath >=1.3.0',
'audobject >=0.7.6',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def test_augment(


def test_augment_cache(tmpdir):
root = audeer.mkdir(os.path.join(tmpdir, "input"))
root = audeer.mkdir(tmpdir, "input")
cache_root = os.path.join(tmpdir, "cache")
transform = auglib.transform.PinkNoise()
augment = auglib.Augment(transform, seed=0)
Expand Down Expand Up @@ -601,7 +601,7 @@ def test_augment_cache_nat(
expected_index_nat,
expected_index_no_nat,
):
root = audeer.mkdir(os.path.join(tmpdir, "input"))
root = audeer.mkdir(tmpdir, "input")
cache_root = os.path.join(tmpdir, "cache")
augment_no_nat = auglib.Augment(
transform,
Expand Down

0 comments on commit a1fb630

Please sign in to comment.