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

Metadata length validation: count graphemes #176

Merged
merged 2 commits into from
Jul 4, 2024
Merged

Metadata length validation: count graphemes #176

merged 2 commits into from
Jul 4, 2024

Conversation

benoit74
Copy link
Collaborator

@benoit74 benoit74 commented Jul 2, 2024

Fix #158
Fix #177

Changes

  • Use regex module to count graphemes, it looks like the most stable and maintained package for our need
  • Add utility function grapheme_count so that it can be easily reused + fixed in the future if needed
  • Fix tests to exhibit the problem of graphemes vs codepoints
  • Fixed type hints for images function calling PIL/pillow, which has updated its type hints in 10.4.0 and is now raising a pyright issue

@benoit74 benoit74 self-assigned this Jul 2, 2024
@benoit74 benoit74 force-pushed the graphemes branch 2 times, most recently from 8a3d822 to 34a1192 Compare July 2, 2024 06:42
@benoit74
Copy link
Collaborator Author

benoit74 commented Jul 2, 2024

Edit: also had to add commit using Jeena instance just like in #175 to let the CI pass

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7ab3fcd) to head (a2c1892).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #176   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         1448      1452    +4     
  Branches       251       251           
=========================================
+ Hits          1448      1452    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benoit74 benoit74 marked this pull request as ready for review July 2, 2024 06:51
@benoit74 benoit74 requested a review from rgaudin July 2, 2024 06:51
Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

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

Thank you ; please check suggestion/comment

pyproject.toml Show resolved Hide resolved
src/zimscraperlib/zim/metadata.py Outdated Show resolved Hide resolved
src/zimscraperlib/zim/metadata.py Outdated Show resolved Hide resolved
@benoit74
Copy link
Collaborator Author

benoit74 commented Jul 4, 2024

Requested changes applied, beware I did a fixup! commit which will need to be squashed before merging.

@benoit74 benoit74 requested a review from rgaudin July 4, 2024 08:56
@benoit74 benoit74 merged commit 6aa458b into main Jul 4, 2024
10 checks passed
@benoit74 benoit74 deleted the graphemes branch July 4, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants