ultralytics 8.0.33 security updates and fixes (#896)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mert Can Demir <validatedev@gmail.com>
This commit is contained in:
Glenn Jocher 2023-02-10 01:37:57 +04:00 committed by GitHub
parent a5a3ce88b3
commit 254adfa652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 87 additions and 61 deletions

View file

@ -6,7 +6,6 @@ import os
import urllib
from datetime import datetime
from pathlib import Path
from zipfile import ZipFile
class WorkingDirectory(contextlib.ContextDecorator):
@ -57,16 +56,6 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
return path
def unzip_file(file, path=None, exclude=('.DS_Store', '__MACOSX')):
# Unzip a *.zip file to path/, excluding files containing strings in exclude list
if path is None:
path = Path(file).parent # default path
with ZipFile(file) as zipObj:
for f in zipObj.namelist(): # list all archived filenames in the zip
if all(x not in f for x in exclude):
zipObj.extract(f, path=path)
def file_age(path=__file__):
# Return days since last file update
dt = (datetime.now() - datetime.fromtimestamp(Path(path).stat().st_mtime)) # delta