Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jquast committed Sep 30, 2023
1 parent f03bdad commit fc58ea3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 27 deletions.
3 changes: 2 additions & 1 deletion bin/update-tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ def main() -> None:
# code.
def get_codegen_definitions() -> Iterator[RenderDefinition]:
yield UnicodeVersionPyRenderDef.new(
UnicodeVersionPyRenderCtx(versions=fetch_unicode_versions())
UnicodeVersionPyRenderCtx(fetch_unicode_versions())
)
yield UnicodeVersionRstRenderDef.new(fetch_source_headers())
yield UnicodeTableRenderDef.new('table_wide.py', fetch_table_wide_data())
yield UnicodeTableRenderDef.new('table_zero.py', fetch_table_zero_data())
Expand Down
23 changes: 23 additions & 0 deletions code_templates/emoji_zwj_sequences.py.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Exports {{ variable_name }} sequences keyed by supporting emoji version.

This code generated by {{this_filepath}} on {{utc_now}}.

This module is used only for testing purposes, it is not imported or used by the
public API.
"""
{{ variable_name }} = {
{%- for table_version, table_def in table.items() %}
'{{ table_version }}': {
# Source: {{ table_def.filename }}
# Date: {{ table_def.date }}
#
{%- for sequence_length, sequences in table_def.sequences.items() %}
# sequences of length {{ sequence_length }},
{%- for hex_sequence, description in sequences %}
({{ hex_sequence|join(', ') }}), {% if description|length %}# {{description}} {% endif %}
{%- endfor %}
{%- endfor %}
},
{%- endfor %}
}
12 changes: 0 additions & 12 deletions code_templates/unicode_versions.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,3 @@ def list_versions():
"{{version}}",
{%- endfor %}
)

def list_zwj_versions():
"""
Return Unicode Emoji version levels supported by this module release.

:rtype: list[str]
"""
return (
{%- for zjw_version in zjw_versions %}
"{{zjw_version}}",
{%- endfor %}
)
2 changes: 1 addition & 1 deletion wcwidth/table_wide.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Exports WIDE_EASTASIAN table keyed by supporting unicode version level.
This code generated by wcwidth/bin/update-tables.py on 2023-09-30 05:01:27 UTC.
This code generated by wcwidth/bin/update-tables.py on 2023-09-30 06:18:01 UTC.
"""
WIDE_EASTASIAN = {
'4.1.0': (
Expand Down
2 changes: 1 addition & 1 deletion wcwidth/table_zero.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Exports ZERO_WIDTH table keyed by supporting unicode version level.
This code generated by wcwidth/bin/update-tables.py on 2023-09-30 05:01:27 UTC.
This code generated by wcwidth/bin/update-tables.py on 2023-09-30 06:18:01 UTC.
"""
ZERO_WIDTH = {
'4.1.0': (
Expand Down
11 changes: 1 addition & 10 deletions wcwidth/unicode_versions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Exports function list_versions() for unicode version level support.
This code generated by wcwidth/bin/update-tables.py on 2023-09-30 05:01:27 UTC.
This code generated by wcwidth/bin/update-tables.py on 2023-09-30 06:18:01 UTC.
"""


Expand Down Expand Up @@ -36,12 +36,3 @@ def list_versions():
"15.0.0",
"15.1.0",
)

def list_zwj_versions():
"""
Return Unicode Emoji version levels supported by this module release.
:rtype: list[str]
"""
return (
)
4 changes: 2 additions & 2 deletions wcwidth/wcwidth.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
# local
from .table_wide import WIDE_EASTASIAN
from .table_zero import ZERO_WIDTH
from .unicode_versions import list_versions, list_zwj_versions
from .unicode_versions import list_versions

try:
# std imports
Expand Down Expand Up @@ -217,7 +217,7 @@ def wcwidth(wc, unicode_version='auto'):
- C1 control characters and DEL (U+07F through U+0A0).
The following have a column width of 0, by Unicode General Category code:
The following have a column width of 0, by general category code of:
- ``Me``: an enclosing combining mark
- ``Mn``: a nonspacing combining mark (zero advance width)
- ``Cf``: a format control character
Expand Down

0 comments on commit fc58ea3

Please sign in to comment.