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

GitHub API rate limit fix #1894

Merged
merged 1 commit into from
Jan 10, 2021
Merged

GitHub API rate limit fix #1894

merged 1 commit into from
Jan 10, 2021

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Jan 10, 2021

This PR updates attempt_download() in google_utils.py to only query the GitHub API for missing files rather than in all cases (currently), fixing issue #1890.

All functions in this file have also been updated with Path objects now.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhancement in the GitHub and Google Drive download functions within the Ultralytics YOLOv5 codebase.

📊 Key Changes

  • Refactored gsutil_getsize function to use an f-string for string interpolation.
  • Simplified attempt_download function for clarity and removed redundant code.
  • Replaced string concatenation with f-strings across the file for consistency and readability.
  • Changed exception handling to offer more detailed error messages and clean up of partial downloads.
  • Modified gdrive_download to use Path objects for file manipulations and unlink method for removing files with an option to suppress FileNotFoundError if the file does not exist.

🎯 Purpose & Impact

  • 🚀 Improved code readability and maintainability by utilizing modern Python string formatting.
  • 📁 Streamlined file download processes, potentially enhancing the user experience when downloading YOLOv5 assets.
  • 💥 More informative error handling could help users and developers troubleshoot download issues quicker.
  • 🧼 Clean-up code ensures no partial or corrupted downloads are left, saving disk space and reducing confusion.

@glenn-jocher glenn-jocher linked an issue Jan 10, 2021 that may be closed by this pull request
@glenn-jocher glenn-jocher merged commit d06ad3b into master Jan 10, 2021
@glenn-jocher glenn-jocher deleted the api_rate_limit_fix branch January 10, 2021 19:42
glenn-jocher added a commit that referenced this pull request Jan 10, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
taicaile pushed a commit to taicaile/yolov5 that referenced this pull request Oct 12, 2021
taicaile pushed a commit to taicaile/yolov5 that referenced this pull request Oct 12, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with github api rate limiting
1 participant