From 57ef628138050732d72e982344545b1c5dd29f40 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Mon, 10 Mar 2025 09:13:38 +0100 Subject: [PATCH] Make get_first and get_last safe --- facefusion/common_helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/facefusion/common_helper.py b/facefusion/common_helper.py index bdccf54..96150c1 100644 --- a/facefusion/common_helper.py +++ b/facefusion/common_helper.py @@ -1,5 +1,5 @@ import platform -from typing import Any, Optional, Sequence, List +from typing import Any, Optional, Sequence, Iterable, Reversible def is_linux() -> bool: @@ -73,12 +73,12 @@ def cast_bool(value : Any) -> Optional[bool]: def get_first(__list__ : Any) -> Any: - if isinstance(__list__, list): + if isinstance(__list__, Iterable): return next(iter(__list__), None) return None def get_last(__list__ : Any) -> Any: - if isinstance(__list__, list): + if isinstance(__list__, Reversible): return next(reversed(__list__), None) return None