Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update utils.py #19

Open
wants to merge 1 commit into
base: old_main
Choose a base branch
from

Conversation

YoussephAhmed
Copy link

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)

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)
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't last_modified be named mtime? That way it's by default empty (on line 18), and becomes reassigned to the local file's last modified time (on line 20).

As it's written now, last_modified always equals "" on line 34, so the if statement does nothing.

@escesare
Copy link
Contributor

escesare commented Feb 20, 2023

After reading this code more carefully, much of it doesn't make sense too me.

Neither of these variables are being used: mtime, headers["if-modified-since"]

My guess is that the intention is to compare them against the response file's modified time, but it's not doing that.

Also I don't see "last-modified" as a key in response.headers, but maybe that's system dependent?

@monk1337 monk1337 added bug Something isn't working models issue related to models labels Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working models issue related to models
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants