glenn-jocher commited on
Commit
f984cce
·
unverified ·
1 Parent(s): a2b3c71

Fix `check_suffix()` (#4712)

Browse files

Fix a bug when `file=''`

Files changed (1) hide show
  1. utils/general.py +2 -2
utils/general.py CHANGED
@@ -244,7 +244,7 @@ def check_imshow():
244
 
245
  def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
246
  # Check file(s) for acceptable suffixes
247
- if any(suffix):
248
  if isinstance(suffix, str):
249
  suffix = [suffix]
250
  for f in file if isinstance(file, (list, tuple)) else [file]:
@@ -258,7 +258,7 @@ def check_yaml(file, suffix=('.yaml', '.yml')):
258
 
259
  def check_file(file, suffix=''):
260
  # Search/download file (if necessary) and return path
261
- check_suffix(file, suffix)
262
  file = str(file) # convert to str()
263
  if Path(file).is_file() or file == '': # exists
264
  return file
 
244
 
245
  def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
246
  # Check file(s) for acceptable suffixes
247
+ if file and suffix:
248
  if isinstance(suffix, str):
249
  suffix = [suffix]
250
  for f in file if isinstance(file, (list, tuple)) else [file]:
 
258
 
259
  def check_file(file, suffix=''):
260
  # Search/download file (if necessary) and return path
261
+ check_suffix(file, suffix) # optional
262
  file = str(file) # convert to str()
263
  if Path(file).is_file() or file == '': # exists
264
  return file