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 dataloaders.py #8714

Merged
merged 2 commits into from
Jul 25, 2022
Merged

Update dataloaders.py #8714

merged 2 commits into from
Jul 25, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Jul 25, 2022

General cleanup and refactoring

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved code simplicity and robustness in file management and image processing functions of the Ultralytics YOLOv5 repo.

📊 Key Changes

  • Utilized contextlib.suppress to streamline handling of exceptions in exif_size, removing verbose try-except blocks.
  • Simplified code in the flatten_recursive function by eliminating the redundant create_folder method.
  • Updated string paths to use formatted strings (f-strings) for better readability and efficiency.
  • Streamlined the _unzip function by reordering checks and assertions for clarity.

🎯 Purpose & Impact

  • Enhances code readability and maintainability, making it easier for developers to navigate and contribute.
  • Reduces the risk of errors by having less complex exception handling and more straightforward file operations.
  • The use of modern Python features (context managers and formatted strings) aligns the code with contemporary best practices.
  • Users can expect smoother operation due to the refined error handling and more robust file directory manipulations.

@glenn-jocher glenn-jocher self-assigned this Jul 25, 2022
@glenn-jocher glenn-jocher merged commit a6f197a into master Jul 25, 2022
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch July 25, 2022 14:52
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* Update dataloaders.py

* Update dataloaders.py
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.

1 participant