Skip to content

Commit 44ee5b1

Browse files
committed
Use cast instead of Any
1 parent c44af43 commit 44ee5b1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

auto_editor/render/audio.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from fractions import Fraction
44
from io import BytesIO
55
from pathlib import Path
6-
from typing import TYPE_CHECKING
6+
from typing import TYPE_CHECKING, cast
77

88
import bv
99
import numpy as np
@@ -22,7 +22,6 @@
2222

2323
if TYPE_CHECKING:
2424
from collections.abc import Iterator
25-
from typing import Any
2625

2726
from auto_editor.__main__ import Args
2827

@@ -436,10 +435,12 @@ def get(self, start: int, end: int) -> np.ndarray:
436435
return result # Return NumPy array with shape (channels, samples)
437436

438437

439-
def _make_new_audio(tl: v3, fmt: bv.AudioFormat, args: Args, log: Log) -> list[Any]:
438+
def _make_new_audio(
439+
tl: v3, fmt: bv.AudioFormat, args: Args, log: Log
440+
) -> list[str | Iterator[AudioFrame]]:
440441
sr = tl.sr
441442
tb = tl.tb
442-
output: list[Any] = []
443+
output: list[str | Iterator[AudioFrame]] = []
443444
samples: dict[tuple[FileInfo, int], Getter] = {}
444445

445446
norm = parse_norm(args.audio_normalize, log)
@@ -511,7 +512,9 @@ def _make_new_audio(tl: v3, fmt: bv.AudioFormat, args: Args, log: Log) -> list[A
511512

512513
if args.mix_audio_streams and len(output) > 1:
513514
new_a_file = f"{Path(log.temp, 'new_audio.wav')}"
514-
mix_audio_files(sr, output, new_a_file)
515+
# When mix_audio_streams is True, output only contains strings
516+
audio_paths = cast(list[str], output)
517+
mix_audio_files(sr, audio_paths, new_a_file)
515518
return [new_a_file]
516519

517520
return output

0 commit comments

Comments
 (0)