Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -45,6 +45,7 @@ def get_audio_duration(*, y: npt.NDArray[np.floating], sr: float = 22050) -> flo
|
||||
|
||||
Returns:
|
||||
Duration of the audio in seconds.
|
||||
|
||||
"""
|
||||
n_samples = y.shape[-1]
|
||||
return float(n_samples) / sr
|
||||
@@ -71,6 +72,7 @@ class AudioSpec:
|
||||
(no normalization). 1 = mono, 2 = stereo, etc.
|
||||
channel_reduction: Method to reduce channels when input has more
|
||||
channels than target. Only used when reducing channels.
|
||||
|
||||
"""
|
||||
|
||||
target_channels: int | None = 1
|
||||
@@ -119,6 +121,7 @@ def normalize_audio(
|
||||
Raises:
|
||||
ValueError: If audio has unsupported dimensions or channel expansion
|
||||
is requested (e.g., mono to stereo).
|
||||
|
||||
"""
|
||||
if not spec.needs_normalization:
|
||||
return audio
|
||||
@@ -195,6 +198,7 @@ def resample_audio_pyav(
|
||||
|
||||
Returns:
|
||||
Resampled audio with the same shape as the input (1D → 1D, 2D → 2D).
|
||||
|
||||
"""
|
||||
orig_sr_int = int(round(orig_sr))
|
||||
target_sr_int = int(round(target_sr))
|
||||
@@ -312,6 +316,7 @@ def resample_audio_torchaudio(
|
||||
|
||||
Returns:
|
||||
Resampled audio with the same shape as the input (1D → 1D, 2D → 2D).
|
||||
|
||||
"""
|
||||
orig_sr_int = int(round(orig_sr))
|
||||
target_sr_int = int(round(target_sr))
|
||||
@@ -431,6 +436,7 @@ def split_audio(
|
||||
... )
|
||||
>>> len(chunks)
|
||||
3
|
||||
|
||||
"""
|
||||
if audio_data.ndim > 1:
|
||||
raise ValueError(
|
||||
@@ -500,6 +506,7 @@ def find_split_point(
|
||||
... )
|
||||
>>> 16000 <= split_idx <= 17600
|
||||
True
|
||||
|
||||
"""
|
||||
segment = wav[start_idx:end_idx]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user