Skip to content

Fix Python formatting issues#28

Merged
pderrenger merged 2 commits into
mainfrom
update-format-headers-redirects-20260612201348
Jun 12, 2026
Merged

Fix Python formatting issues#28
pderrenger merged 2 commits into
mainfrom
update-format-headers-redirects-20260612201348

Conversation

@pderrenger

@pderrenger pderrenger commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • remove an unused image shape unpack in utils/datasets.py
  • apply the repository Python formatting and docstring style to the touched file

Tests

  • python -m ruff check --extend-select F,I,D,UP,RUF,FA --target-version py39 --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413,RUF001,RUF002,RUF012 utils/datasets.py
  • python -m ruff format --line-length 120 utils/datasets.py
  • ultralytics-actions-format-python-docstrings utils/datasets.py
  • python -m py_compile utils/datasets.py
  • git diff --check

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

🧹 This PR is a code cleanup update that improves readability and consistency in dataset and utility helpers without changing core functionality.

📊 Key Changes

  • ✏️ Simplified several docstrings in utils/datasets.py and utils/utils.py to make function purposes clearer and more concise.
  • 📐 Reformatted long function calls and conditional expressions across dataset loading and augmentation code for better line spacing and readability.
  • 🧩 Cleaned up the random_affine() function signature formatting to make its arguments easier to scan and maintain.
  • 🗂️ Improved formatting in iterator logic for dataset batching, weighted image sampling, and label selection.
  • 🧼 Removed an unused variable (h, w, _ = img1.shape) from dataset processing code.

🎯 Purpose & Impact

  • 👀 Makes the codebase easier for contributors and maintainers to read, review, and modify.
  • 🛠️ Reduces small sources of confusion, such as overly long docstrings and unused variables.
  • ✅ Helps maintain code quality and consistency without affecting model behavior or training results.
  • 🚀 Low user-facing impact: this is mainly a developer-experience and maintainability improvement rather than a feature or performance change.

@UltralyticsAssistant UltralyticsAssistant added documentation Improvements or additions to documentation fixed Bug has been resolved priority: low Low urgency; can wait behind higher-priority work. labels Jun 12, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @pderrenger, thank you for submitting a ultralytics/xview-docker 🚀 PR! This is an automated message to help with review readiness, and an engineer will assist you soon. Please review the checklist below for smooth integration 😊

  • 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/xview-docker 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. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

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

Clean formatting-only PR. The changes shown are limited to docstring shortening, line reflow, and removal of an unused local assignment, with no obvious behavioral regressions in the diff.

@pderrenger pderrenger merged commit 1a65b2a into main Jun 12, 2026
4 checks passed
@pderrenger pderrenger deleted the update-format-headers-redirects-20260612201348 branch June 12, 2026 20:28
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🎉 Merged! Huge thanks to @pderrenger for this thoughtful cleanup pass, with contributions from @glenn-jocher.

“Simplicity is the ultimate sophistication.” — Leonardo da Vinci

This PR reflects that well: clearer docstrings, cleaner formatting, and removal of small inconsistencies all make the codebase easier to read, review, and maintain without changing behavior. These kinds of improvements quietly strengthen the foundation for everyone building on top of it.

Really appreciate the care and attention to detail here 🙌

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

Labels

documentation Improvements or additions to documentation fixed Bug has been resolved priority: low Low urgency; can wait behind higher-priority work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants