Skip to content

Commit

Permalink
Mod/Fix: Clean flake8 warnings and fix clotho preparation check again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed Jan 4, 2024
1 parent 5ca21b8 commit c1f74e9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/aac_datasets/datasets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def at(
)
elif idx.is_floating_point():
raise TypeError(
f"Invalid tensor dtype. (found floating-point tensor but expected integer tensor)"
"Invalid tensor dtype. (found floating-point tensor but expected integer tensor)"
)
idx = idx.tolist()

Expand Down
4 changes: 3 additions & 1 deletion src/aac_datasets/datasets/functional/clotho.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,10 @@ def _is_prepared_clotho(root: str, version: str, subset: str) -> bool:

if "audio_archive" in links:
audio_subset_dpath = _get_audio_subset_dpath(root, version, subset)
audio_fnames = os.listdir(audio_subset_dpath)
if not osp.isdir(audio_subset_dpath):
return False

audio_fnames = os.listdir(audio_subset_dpath)
if "captions" in links:
with open(captions_fpath, "r") as file:
reader = csv.DictReader(file)
Expand Down
6 changes: 3 additions & 3 deletions src/aac_datasets/datasets/functional/wavcaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def download_wavcaps_dataset(
ign_patterns = [
pattern
for source in ign_sources
for pattern in (f"json_files/{source}/*.json", f"Zip_files/*") # {source}/
for pattern in (f"json_files/{source}/*.json", "Zip_files/*") # {source}/
]
if verbose >= 2:
pylog.debug(f"ign_sources={ign_sources}")
Expand Down Expand Up @@ -467,7 +467,7 @@ def download_wavcaps_dataset(
)
file.extractall(audio_subset_dpath, missing_subnames)
if verbose >= 2:
pylog.debug(f"Extraction done.")
pylog.debug("Extraction done.")

src_fnames_found = (
dict.fromkeys(name for name in os.listdir(src_root))
Expand All @@ -485,7 +485,7 @@ def download_wavcaps_dataset(
tgt_fpath = osp.join(audio_subset_dpath, osp.basename(src_fpath))
os.rename(src_fpath, tgt_fpath)
if verbose >= 2:
pylog.debug(f"Move done.")
pylog.debug("Move done.")

if verify_files:
tgt_fnames_expected = [osp.basename(subname) for subname in flac_subnames]
Expand Down
2 changes: 1 addition & 1 deletion src/aac_datasets/datasets/wavcaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os.path as osp

from pathlib import Path
from typing import Callable, ClassVar, List, Optional, Tuple, Union
from typing import Callable, ClassVar, List, Optional, Union

from torch import Tensor
from typing_extensions import TypedDict
Expand Down

0 comments on commit c1f74e9

Please sign in to comment.