Fix unzip_file() to directory issue (#6666)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2023-11-30 00:32:51 +01:00 committed by GitHub
parent f89bfd7e01
commit 7c0e853237
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View file

@ -196,11 +196,13 @@ def check_version(current: str = '0.0.0',
if not required: # if required is '' or None
return True
op = ''
version = ''
result = True
c = parse_version(current) # '1.2.3' -> (1, 2, 3)
for r in required.strip(',').split(','):
op, v = re.match(r'([^0-9]*)([\d.]+)', r).groups() # split '>=22.04' -> ('>=', '22.04')
v = parse_version(v) # '1.2.3' -> (1, 2, 3)
op, version = re.match(r'([^0-9]*)([\d.]+)', r).groups() # split '>=22.04' -> ('>=', '22.04')
v = parse_version(version) # '1.2.3' -> (1, 2, 3)
if op == '==' and c != v:
result = False
elif op == '!=' and c == v:
@ -214,12 +216,11 @@ def check_version(current: str = '0.0.0',
elif op == '<' and not (c < v):
result = False
if not result:
warning_message = \
f'WARNING ⚠️ {name}{op}{required} is required, but {name}=={current} is currently installed {msg}'
warning = f'WARNING ⚠️ {name}{op}{version} is required, but {name}=={current} is currently installed {msg}'
if hard:
raise ModuleNotFoundError(emojis(warning_message)) # assert version requirements met
raise ModuleNotFoundError(emojis(warning)) # assert version requirements met
if verbose:
LOGGER.warning(warning_message)
LOGGER.warning(warning)
return result