Skip to content

Commit 4ff6344

Browse files
committed
Fix some type hints
1 parent d8457d2 commit 4ff6344

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

auto_editor/ffwrapper.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,13 @@ def initFileInfo(path: str, ffmpeg: FFmpeg, log: Log) -> FileInfo:
239239
log.debug("Unexpected ffprobe shape")
240240

241241
if v.sample_aspect_ratio is None:
242-
try:
243-
sar = Fraction(_sar.replace(":", "/"))
244-
except Exception:
242+
if _sar is None:
245243
sar = Fraction(1)
244+
else:
245+
try:
246+
sar = Fraction(_sar.replace(":", "/"))
247+
except Exception:
248+
sar = Fraction(1)
246249
else:
247250
sar = v.sample_aspect_ratio
248251

auto_editor/lang/palet.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def initOutPort(name: str) -> OutputPort | Literal[False]:
510510
return OutputPort(name, port, port.write, False)
511511

512512

513-
def raise_(msg: str) -> NoReturn:
513+
def raise_(msg: str | Exception) -> NoReturn:
514514
raise MyError(msg)
515515

516516

@@ -1470,7 +1470,10 @@ def edit_all() -> np.ndarray:
14701470

14711471

14721472
def edit_audio(
1473-
threshold: float = 0.04, stream: object = Sym("all"), mincut: int = 6, minclip: int = 3
1473+
threshold: float = 0.04,
1474+
stream: object = Sym("all"),
1475+
mincut: int = 6,
1476+
minclip: int = 3,
14741477
) -> np.ndarray:
14751478
if "@levels" not in env or "@filesetup" not in env:
14761479
raise MyError("Can't use `audio` if there's no input media")

auto_editor/render/video.py

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def make_image_cache(tl: v3) -> dict[tuple[FileInfo, int], np.ndarray]:
9797
for obj in clip:
9898
if isinstance(obj, TlImage) and obj.src not in img_cache:
9999
with av.open(obj.src.path) as cn:
100+
assert isinstance(cn, av.InputContainer)
100101
my_stream = cn.streams.video[0]
101102
for frame in cn.decode(my_stream):
102103
if obj.width != 0:

0 commit comments

Comments
 (0)