Преглед на файлове

Fix `check_suffix()` (#4712)

Fix a bug when `file=''`
modifyDataloader
Glenn Jocher GitHub преди 3 години
родител
ревизия
f984cce52a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. +2
    -2
      utils/general.py

+ 2
- 2
utils/general.py Целия файл

@@ -244,7 +244,7 @@ def check_imshow():

def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
# Check file(s) for acceptable suffixes
if any(suffix):
if file and suffix:
if isinstance(suffix, str):
suffix = [suffix]
for f in file if isinstance(file, (list, tuple)) else [file]:
@@ -258,7 +258,7 @@ def check_yaml(file, suffix=('.yaml', '.yml')):

def check_file(file, suffix=''):
# Search/download file (if necessary) and return path
check_suffix(file, suffix)
check_suffix(file, suffix) # optional
file = str(file) # convert to str()
if Path(file).is_file() or file == '': # exists
return file

Loading…
Отказ
Запис