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

Simplify logic #20

Merged
merged 6 commits into from
Jan 17, 2025
Merged

Simplify logic #20

merged 6 commits into from
Jan 17, 2025

Conversation

Y-T-G
Copy link
Contributor

@Y-T-G Y-T-G commented Jan 17, 2025

The logic can be even simpler.

๐Ÿ› ๏ธ PR Summary

Made with โค๏ธ by Ultralytics Actions

๐ŸŒŸ Summary

Improves Python module lazy-loading logic to enhance clarity and efficiency ๐ŸŽ‰.

๐Ÿ“Š Key Changes

  • Fixed module resolution logic by ensuring the correct return of the parent package for nested imports.
  • Simplified conditional checks for whether a module is already loaded in globals or sys.modules.
  • Improved code readability by reordering and enhancing comments.

๐ŸŽฏ Purpose & Impact

  • ๐Ÿ› ๏ธ Purpose: To fix and simplify incorrect and redundant logic in lazy-loading, ensuring clean module imports and reducing potential bugs.
  • ๐Ÿš€ Impact: This improves the stability and usability of the lazy-loading mechanism, benefiting developers working on performance-optimized dynamic imports.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jan 17, 2025

@Y-T-G nice! BTW I just realized there was no formatting going on in your PRs here because I hadn't enabled the Ultralytics App for this new repo and it's a fork PR.

I'll do that now.

EDIT: Is enabled now. When I merge this PR the App should do it's thing now.

@glenn-jocher glenn-jocher merged commit 7a20437 into ultralytics:main Jan 17, 2025
7 checks passed
@UltralyticsAssistant
Copy link
Member

๐ŸŽ‰ The PR is officially merged! Huge thanks to @Y-T-G for the thoughtful improvements and to @glenn-jocher for your insightful contributions. This refined lazy-loading logic makes our project cleaner, more efficient, and more developer-friendly. ๐Ÿš€

As Leonardo da Vinci once said, "Simplicity is the ultimate sophistication." Your work here exemplifies that beautifullyโ€”optimizing logic, eliminating redundancies, and ensuring stability. Thank you for making a lasting impact! ๐Ÿ™Œ

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.

3 participants