Skip to content

Ruff RUF refactor#103

Merged
glenn-jocher merged 2 commits into
mainfrom
glenn-jocher-patch-1
Oct 24, 2025
Merged

Ruff RUF refactor#103
glenn-jocher merged 2 commits into
mainfrom
glenn-jocher-patch-1

Conversation

@glenn-jocher
Copy link
Copy Markdown
Member

@glenn-jocher glenn-jocher commented Oct 24, 2025

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Minor refactors to improve code quality, readability, and linter compliance without changing functionality. ✅

📊 Key Changes

  • Tests: Renamed unused params to _params in tests/test_conv2d.py to silence linter warnings.
  • Exports: Reordered __all__ in thop/__init__.py (no change to what’s exported).
  • Conv2d profiling: Prefixed unused arguments with underscores in thop/fx_profile.py and b_shape -> _b_shape to indicate intentional non-use.
  • Logging: Slight f-string improvement in thop/profile.py ({m!s} instead of {str(m)}) for clarity.

🎯 Purpose & Impact

  • Cleaner code and fewer linter warnings (helps maintainability and CI stability) 🧹
  • No behavior changes or API breaks—safe for all users 🔒
  • Slightly clearer logging messages for developers inspecting hooks 🪵

glenn-jocher and others added 2 commits October 24, 2025 12:08
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@UltralyticsAssistant UltralyticsAssistant added the enhancement New feature or request label Oct 24, 2025
@UltralyticsAssistant
Copy link
Copy Markdown
Member

👋 Hello @username, thank you for submitting an ultralytics/thop 🚀 PR! To ensure a seamless integration of your work, please review the following checklist:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/thop main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. An engineer will review and assist shortly. Thank you for contributing to Ultralytics! 🚀

Copy link
Copy Markdown
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Thanks for aligning the codebase with Ruff’s expectations. I didn’t spot any functional or quality issues in these changes—everything looks good to merge.

@glenn-jocher glenn-jocher merged commit 8cd16d5 into main Oct 24, 2025
2 checks passed
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch October 24, 2025 10:12
@UltralyticsAssistant
Copy link
Copy Markdown
Member

🎉 Merged — thanks, @glenn-jocher!

“Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry. Your thoughtful refinements in PR #103 embody this: cleaner tests, clearer exports, intentional underscores, and sharper logging—all without changing behavior. These improvements reduce linter noise, boost maintainability, and keep CI happy.

Appreciate the craftsmanship and attention to detail—thanks for elevating the codebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants