Procházet zdrojové kódy

Improved check_suffix() robustness to `''` and `""` (#5192)

* Improved check_suffix() robustness to `''` and `""`

* Cleanup
modifyDataloader
Glenn Jocher GitHub před 2 roky
rodič
revize
7ee5aed0b3
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. +4
    -2
      utils/general.py

+ 4
- 2
utils/general.py Zobrazit soubor

@@ -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')):

Načítá se…
Zrušit
Uložit