Skip to content

Commit

Permalink
Mod: Update various docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed Aug 29, 2023
1 parent d4cddf4 commit 5ca57c8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/aac_datasets/datasets/audiocaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def __init__(
) -> None:
"""
:param root: Dataset root directory.
The data will be stored in the 'AUDIOCAPS_{SAMPLE_RATE}' subdirectory.
The data will be stored in the 'AUDIOCAPS' subdirectory.
defaults to ".".
:param subset: The subset of AudioCaps to use. Can be one of :attr:`~AudioCapsCard.subsets`.
:param subset: The subset of AudioCaps to use. Can be one of :attr:`~AudioCapsCard.SUBSETS`.
defaults to "train".
:param download: Download the dataset if download=True and if the dataset is not already downloaded.
defaults to False.
Expand Down
2 changes: 1 addition & 1 deletion src/aac_datasets/datasets/clotho.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def __init__(
:param root: The parent of the dataset root directory.
Note: The data is stored in the 'CLOTHO_{version}' subdirectory.
defaults to ".".
:param subset: The subset of Clotho to use. Can be one of :attr:`~ClothoCard.subsets`.
:param subset: The subset of Clotho to use. Can be one of :attr:`~ClothoCard.SUBSETS`.
defaults to "dev".
:param download: Download the dataset if download=True and if the dataset is not already downloaded.
defaults to False.
Expand Down
1 change: 1 addition & 0 deletions src/aac_datasets/datasets/macs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class MACSCard(DatasetCard):
doi. = {10.5281/zenodo.5770113}
}
"""
DESCRIPTION = "Multi-Annotator Captioned Soundscapes dataset."
HOMEPAGE: str = "https://zenodo.org/record/5114771"
LANGUAGE: Tuple[str, ...] = ("en",)
LANGUAGE_DETAILS: Tuple[str, ...] = ("en-US",)
Expand Down
7 changes: 3 additions & 4 deletions src/aac_datasets/datasets/wavcaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ def __init__(
:param root: The parent of the dataset root directory.
The data will be stored in the 'MACS' subdirectory.
defaults to ".".
:param subset: The subset of the dataset. This parameter is here only to accept the same interface than the other datasets.
The only valid subset is "full" and other values will raise a ValueError.
:param subset: The subset of the dataset. Can be one of :attr:`~WavCapsCard.SUBSETS`.
defaults to "as".
:param download: Download the dataset if download=True and if the dataset is not already downloaded.
defaults to False.
Expand All @@ -181,8 +180,8 @@ def __init__(
:param hf_cache_dir: HuggingFace cache directory. If None, use the global value :variable:`~huggingface_hub.constants.HUGGINGFACE_HUB_CACHE`.
defaults to None.
:param revision: The HuggingFace revision tag.
defaults to WavCapsCard.DEFAULT_REVISION.
:param verbose: Verbose level to use. Can be 0 or 1.
defaults to :attr:`~WavCapsCard.DEFAULT_REVISION`.
:param verbose: Verbose level. Can be 0 or 1.
defaults to 0.
"""
if subset not in WavCapsCard.SUBSETS:
Expand Down
2 changes: 1 addition & 1 deletion src/aac_datasets/utils/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def list_dict_to_dict_list(
If "intersect", only the intersection of all keys will be used in output.
:returns: The dictionary of lists.
"""
if len(lst) == 0:
if len(lst) <= 0:
return {}
keys = set(lst[0].keys())
if key_mode == "same":
Expand Down
5 changes: 3 additions & 2 deletions src/aac_datasets/utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def safe_rmdir(
) -> List[str]:
"""Remove all empty sub-directories.
:param root: Root directory path.
:param rm_root: If True, remove the root directory. defaults to True.
:param error_on_non_empty_dir: If True, raises a RuntimeError if a subdirectory contains 1 file.
:returns: The list of directories paths deleted.
Expand All @@ -27,7 +28,7 @@ def safe_rmdir(
for dpath, dnames, fnames in os.walk(root, topdown=False):
if not rm_root and dpath == root:
continue
if len(dnames) == 0 and len(fnames) == 0:
elif len(dnames) == 0 and len(fnames) == 0:
os.rmdir(dpath)
deleted.append(dpath)
elif error_on_non_empty_dir:
Expand Down Expand Up @@ -59,7 +60,7 @@ def _hash_file(
) -> str:
"""Return the hash value for a file.
FROM https://github.com/pytorch/audio/blob/v0.13.0/torchaudio/datasets/utils.py#L110
BASED ON https://github.com/pytorch/audio/blob/v0.13.0/torchaudio/datasets/utils.py#L110
"""
if hash_type == "sha256":
hasher = hashlib.sha256()
Expand Down

0 comments on commit 5ca57c8

Please sign in to comment.