Skip to content

Add unicodedata.east_asian_width#4523

Merged
youknowone merged 2 commits intoRustPython:mainfrom
xiaozhiyan:add-unicodedata-east_asian_width
Feb 19, 2023
Merged

Add unicodedata.east_asian_width#4523
youknowone merged 2 commits intoRustPython:mainfrom
xiaozhiyan:add-unicodedata-east_asian_width

Conversation

@xiaozhiyan
Copy link
Contributor

@xiaozhiyan xiaozhiyan commented Feb 18, 2023

Closes #4522

This PR is a draft for further discussion.
Update: In this PR, we've adopted ucd crate to implement unicodedata.east_asian_width using database v9.0.0, while leaving unicodedata.ucd_3_2_0.unidata_version referring to unicodedata.east_asian_width as is for now.

Python Document

https://docs.python.org/3/library/unicodedata.html#unicodedata.east_asian_width

Expectation (as in CPython 3.11)

>>> import unicodedata
>>> unicodedata.unidata_version
'14.0.0'
>>> unicodedata.east_asian_width('\u231a')
'W'
>>> unicodedata.ucd_3_2_0.unidata_version
'3.2.0'
>>> unicodedata.ucd_3_2_0.east_asian_width('\u231a')
'N'

Status

Reason

Extra Information

Possible Solution

Example Commits

Related Tests

  • cargo run --release -- -m test test_unicodedata -v
  • cargo run --release -- extra_tests/snippets/builtin_str_unicode.py

@xiaozhiyan xiaozhiyan force-pushed the add-unicodedata-east_asian_width branch from d5857f0 to 38eaa75 Compare February 18, 2023 23:40
@xiaozhiyan xiaozhiyan marked this pull request as draft February 19, 2023 08:55
@xiaozhiyan xiaozhiyan changed the title [DRAFT] Add unicodedata.east_asian_width Add unicodedata.east_asian_width Feb 19, 2023
Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you. Do you have more concerns not to make this ready?

@xiaozhiyan xiaozhiyan force-pushed the add-unicodedata-east_asian_width branch from 38eaa75 to 7661fab Compare February 19, 2023 11:47
@xiaozhiyan xiaozhiyan marked this pull request as ready for review February 19, 2023 11:56
@xiaozhiyan
Copy link
Contributor Author

Looks great. Thank you. Do you have more concerns not to make this ready?

I've updated the PR (as in commit 7661fab) and made it ready. Please help to merge it.

Copy link
Member

@youknowone youknowone 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!

@youknowone youknowone merged commit 3b8d670 into RustPython:main Feb 19, 2023
@xiaozhiyan xiaozhiyan deleted the add-unicodedata-east_asian_width branch February 20, 2023 04:11
@youknowone youknowone added z-ls-2023 Tag to track Line OSS Sprint 2023 A-stdlib labels Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-stdlib z-ls-2023 Tag to track Line OSS Sprint 2023

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Python function unicodedata.east_asian_width

2 participants