From 5afb46f69f164913a792b614ee187a5dfd6b3efa Mon Sep 17 00:00:00 2001 From: Youssef Ahmed Date: Sun, 5 Feb 2023 19:06:24 +0200 Subject: [PATCH] Update utils.py fixed 2 typos here: 1- if last_modified == response.headers.get("last-modified") (line:34) 2- declare the "last_modified" variable before calling it (line:18) --- promptify/models/nlp/utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/promptify/models/nlp/utils/utils.py b/promptify/models/nlp/utils/utils.py index e2f46a5..12e1fe9 100644 --- a/promptify/models/nlp/utils/utils.py +++ b/promptify/models/nlp/utils/utils.py @@ -15,7 +15,7 @@ def download(url, destination_file): os.makedirs(path) destination_file = os.path.join(path, destination_file) - + last_modified = "" if os.path.exists(destination_file): mtime = os.path.getmtime(destination_file) headers["if-modified-since"] = formatdate(mtime, usegmt=True) @@ -31,7 +31,7 @@ def download(url, destination_file): for chunk in response.iter_content(chunk_size=1048576): f.write(chunk) - if last_modified := response.headers.get("last-modified"): + if last_modified == response.headers.get("last-modified"): new_mtime = parsedate_to_datetime(last_modified).timestamp() os.utime(destination_file, times=(datetime.now().timestamp(), new_mtime)) return destination_file