glenn-jocher
commited on
Commit
•
7ee5aed
1
Parent(s):
0be58f1
Improved check_suffix() robustness to `''` and `""` (#5192)
Browse files* Improved check_suffix() robustness to `''` and `""`
* Cleanup
- utils/general.py +4 -2
utils/general.py
CHANGED
@@ -293,12 +293,14 @@ def check_imshow():
|
|
293 |
|
294 |
|
295 |
def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
|
296 |
-
# Check file(s) for acceptable
|
297 |
if file and suffix:
|
298 |
if isinstance(suffix, str):
|
299 |
suffix = [suffix]
|
300 |
for f in file if isinstance(file, (list, tuple)) else [file]:
|
301 |
-
|
|
|
|
|
302 |
|
303 |
|
304 |
def check_yaml(file, suffix=('.yaml', '.yml')):
|
|
|
293 |
|
294 |
|
295 |
def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
|
296 |
+
# Check file(s) for acceptable suffix
|
297 |
if file and suffix:
|
298 |
if isinstance(suffix, str):
|
299 |
suffix = [suffix]
|
300 |
for f in file if isinstance(file, (list, tuple)) else [file]:
|
301 |
+
s = Path(f).suffix.lower() # file suffix
|
302 |
+
if len(s):
|
303 |
+
assert s in suffix, f"{msg}{f} acceptable suffix is {suffix}"
|
304 |
|
305 |
|
306 |
def check_yaml(file, suffix=('.yaml', '.yml')):
|