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

Add Ultralytics actions workflow in format.yml (Sourcery refactored) #72

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Jan 1, 2024

Pull Request #71 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the add-format-workflow-20240101030503 branch, then run:

git fetch origin sourcery/add-format-workflow-20240101030503
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved code efficiency and readability in JSON to YOLO conversion utilities.

📊 Key Changes

  • Updated file copy commands to use formatted strings for better clarity.
  • Streamlined the coco91_to_coco80_class function by directly returning the list instead of assigning it to a variable.

🎯 Purpose & Impact

  • These changes make the code more readable, which helps developers understand and contribute to the project more easily.
  • The direct return in coco91_to_coco80_class eliminates unnecessary lines of code, potentially improving execution efficiency.
  • No impact on functionality, maintaining the same output while enhancing the developer experience. 🛠️

Comment on lines -155 to +157
os.system("cp '%s' '%s'" % (json, json_new))
os.system("cp '%s' '%s'" % (image, image_new))
# cv2.imwrite(str(image_new), cv2.imread(str(image)))
os.system(f"cp '{json}' '{json_new}'")
os.system(f"cp '{image}' '{image_new}'")
# cv2.imwrite(str(image_new), cv2.imread(str(image)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function flatten_recursive_folders refactored with the following changes:

# https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/
x = [
return [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function coco91_to_coco80_class refactored with the following changes:

This removes the following comments ( why? ):

# https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/

@glenn-jocher glenn-jocher merged commit 9d25198 into add-format-workflow-20240101030503 Jan 1, 2024
@glenn-jocher glenn-jocher deleted the sourcery/add-format-workflow-20240101030503 branch January 1, 2024 02:17
glenn-jocher added a commit that referenced this pull request Jan 1, 2024
* Add format workflow`

* Auto-format by Ultralytics actions

* 'Refactored by Sourcery' (#72)

Co-authored-by: Sourcery AI <>

* Auto-format by Ultralytics actions

---------

Co-authored-by: glenn-jocher <glenn.jocher@ultralytics.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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.

None yet

1 participant