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

Fix isascii() method calls for python 3.6 #4958

Merged
merged 2 commits into from
Sep 28, 2021

Conversation

d57montes
Copy link
Contributor

@d57montes d57montes commented Sep 28, 2021

The str.isascii() method was introduced in python3.7, so this changes it back to using the utils function is_ascii to continue supporting python3.6.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhancement in string character encoding checks and annotations in YOLOv5.

📊 Key Changes

  • Implemented a new function is_ascii to check if a string is composed only of ASCII characters.
  • Replaced the direct .isascii() string method with the new is_ascii function within the annotation class Annotator.

🎯 Purpose & Impact

  • Purpose: The introduction of is_ascii aims to provide compatibility for Python versions older than 3.7, which do not have the .isascii() method for strings.
  • Impact: Users working on environments with older Python versions will benefit from this update, ensuring that character encoding issues are handled seamlessly across different Python versions. Visual annotations on images will work correctly regardless of the character set being used in the labels.

@glenn-jocher glenn-jocher changed the title Fix isascii() method calls for python3.6 Fix isascii() method calls for python 3.6 Sep 28, 2021
@glenn-jocher glenn-jocher merged commit c1bed60 into ultralytics:master Sep 28, 2021
@glenn-jocher
Copy link
Member

@d57montes good catch! PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

CesarBazanAV pushed a commit to CesarBazanAV/yolov5 that referenced this pull request Sep 29, 2021
* fix isascii for python3.6

* update comment with python 3.7 note

Co-authored-by: Glenn Jocher <[email protected]>
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* fix isascii for python3.6

* update comment with python 3.7 note

Co-authored-by: Glenn Jocher <[email protected]>
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.

2 participants