From 3823fd6e5889b5424ea57787a9677cae3e82ec12 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 14 Oct 2021 12:00:39 -0700 Subject: [PATCH] Improved check_suffix() robustness to `''` and `""` (#5192) * Improved check_suffix() robustness to `''` and `""` * Cleanup --- utils/general.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/general.py b/utils/general.py index c2fcf5e9c7f9..02bc741ca3ba 100755 --- a/utils/general.py +++ b/utils/general.py @@ -293,12 +293,14 @@ def check_imshow(): def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''): - # Check file(s) for acceptable suffixes + # Check file(s) for acceptable suffix if file and suffix: if isinstance(suffix, str): suffix = [suffix] for f in file if isinstance(file, (list, tuple)) else [file]: - assert Path(f).suffix.lower() in suffix, f"{msg}{f} acceptable suffix is {suffix}" + s = Path(f).suffix.lower() # file suffix + if len(s): + assert s in suffix, f"{msg}{f} acceptable suffix is {suffix}" def check_yaml(file, suffix=('.yaml', '.yml')):