wcwidth 0.2.13__tar.gz → 0.2.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of wcwidth might be problematic. Click here for more details.
- {wcwidth-0.2.13/wcwidth.egg-info → wcwidth-0.2.14}/PKG-INFO +29 -9
- {wcwidth-0.2.13 → wcwidth-0.2.14}/README.rst +14 -4
- {wcwidth-0.2.13 → wcwidth-0.2.14}/bin/update-tables.py +19 -5
- {wcwidth-0.2.13 → wcwidth-0.2.14}/bin/verify-table-integrity.py +1 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/bin/wcwidth-browser.py +9 -14
- {wcwidth-0.2.13 → wcwidth-0.2.14}/bin/wcwidth-libc-comparator.py +3 -18
- {wcwidth-0.2.13 → wcwidth-0.2.14}/docs/conf.py +1 -2
- {wcwidth-0.2.13 → wcwidth-0.2.14}/docs/intro.rst +14 -4
- wcwidth-0.2.14/docs/requirements.txt +60 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/docs/specs.rst +3 -2
- {wcwidth-0.2.13 → wcwidth-0.2.14}/docs/unicode_version.rst +15 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/requirements-docs.in +1 -1
- {wcwidth-0.2.13 → wcwidth-0.2.14}/requirements-tests37.txt +2 -2
- wcwidth-0.2.14/requirements-tests39.in +4 -0
- wcwidth-0.2.14/requirements-tests39.txt +38 -0
- wcwidth-0.2.14/requirements-update.txt +27 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/setup.cfg +0 -3
- {wcwidth-0.2.13 → wcwidth-0.2.14}/setup.py +4 -5
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/test_core.py +47 -49
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/test_emojis.py +39 -46
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/test_table_integrity.py +4 -1
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/test_ucslevel.py +6 -7
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tox.ini +17 -45
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth/__init__.py +1 -1
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth/table_vs16.py +2 -2
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth/table_wide.py +260 -2
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth/table_zero.py +691 -20
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth/unicode_versions.py +3 -1
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth/wcwidth.py +15 -34
- {wcwidth-0.2.13 → wcwidth-0.2.14/wcwidth.egg-info}/PKG-INFO +29 -9
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth.egg-info/SOURCES.txt +0 -2
- wcwidth-0.2.13/docs/requirements.txt +0 -57
- wcwidth-0.2.13/requirements-tests39.in +0 -15
- wcwidth-0.2.13/requirements-tests39.txt +0 -98
- wcwidth-0.2.13/requirements-update.txt +0 -26
- wcwidth-0.2.13/wcwidth.egg-info/requires.txt +0 -3
- {wcwidth-0.2.13 → wcwidth-0.2.14}/LICENSE +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/MANIFEST.in +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/bin/new-wide-by-version.py +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/code_templates/python_table.py.j2 +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/code_templates/unicode_version.rst.j2 +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/code_templates/unicode_versions.py.j2 +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/docs/api.rst +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/docs/index.rst +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/requirements-develop.txt +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/requirements-tests36.txt +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/requirements-tests37.in +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/requirements-update.in +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/__init__.py +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/emoji-variation-sequences.txt +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/tests/emoji-zwj-sequences.txt +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth.egg-info/dependency_links.txt +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth.egg-info/top_level.txt +0 -0
- {wcwidth-0.2.13 → wcwidth-0.2.14}/wcwidth.egg-info/zip-safe +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: wcwidth
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Measures the displayed width of unicode strings in a terminal
|
|
5
5
|
Home-page: https://github.com/jquast/wcwidth
|
|
6
6
|
Author: Jeff Quast
|
|
@@ -13,8 +13,6 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
13
13
|
Classifier: Environment :: Console
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
15
|
Classifier: Operating System :: POSIX
|
|
16
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.6
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.7
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -22,12 +20,24 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
22
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
23
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
25
|
Classifier: Topic :: Software Development :: Libraries
|
|
26
26
|
Classifier: Topic :: Software Development :: Localization
|
|
27
27
|
Classifier: Topic :: Software Development :: Internationalization
|
|
28
28
|
Classifier: Topic :: Terminals
|
|
29
|
+
Requires-Python: >=3.6
|
|
29
30
|
License-File: LICENSE
|
|
30
|
-
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: keywords
|
|
37
|
+
Dynamic: license
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: requires-python
|
|
40
|
+
Dynamic: summary
|
|
31
41
|
|
|
32
42
|
|pypi_downloads| |codecov| |license|
|
|
33
43
|
|
|
@@ -126,7 +136,7 @@ Briefly, return values of function ``wcwidth()`` are:
|
|
|
126
136
|
Function ``wcswidth()`` simply returns the sum of all values for each character
|
|
127
137
|
along a string, or ``-1`` when it occurs anywhere along a string.
|
|
128
138
|
|
|
129
|
-
Full API Documentation at https://wcwidth.readthedocs.
|
|
139
|
+
Full API Documentation at https://wcwidth.readthedocs.io
|
|
130
140
|
|
|
131
141
|
==========
|
|
132
142
|
Developing
|
|
@@ -136,9 +146,9 @@ Install wcwidth in editable mode::
|
|
|
136
146
|
|
|
137
147
|
pip install -e .
|
|
138
148
|
|
|
139
|
-
Execute unit tests using tox_::
|
|
149
|
+
Execute unit tests using tox_ for all supported Python versions::
|
|
140
150
|
|
|
141
|
-
tox -e
|
|
151
|
+
tox -e py36,py37,py38,py39,py310,py311,py312,py313,py314
|
|
142
152
|
|
|
143
153
|
Updating Unicode Version
|
|
144
154
|
------------------------
|
|
@@ -248,6 +258,13 @@ Other Languages
|
|
|
248
258
|
History
|
|
249
259
|
=======
|
|
250
260
|
|
|
261
|
+
0.2.14 *2025-09-22*
|
|
262
|
+
* **Drop Support** for Python 2.7 and 3.5. `PR #117`_.
|
|
263
|
+
* **Update** tables to include Unicode Specifications 16.0.0 and 17.0.0.
|
|
264
|
+
`PR #146`_.
|
|
265
|
+
* **Bugfix** U+00AD SOFT HYPHEN should measure as 1, versions 0.2.9 through
|
|
266
|
+
0.2.13 measured as 0. `PR #149`_.
|
|
267
|
+
|
|
251
268
|
0.2.13 *2024-01-06*
|
|
252
269
|
* **Bugfix** zero-width support for Hangul Jamo (Korean)
|
|
253
270
|
|
|
@@ -290,7 +307,7 @@ History
|
|
|
290
307
|
Environment variable ``UNICODE_VERSION``, such as ``13.0``, or ``6.3.0``.
|
|
291
308
|
See the `jquast/ucs-detect`_ CLI utility for automatic detection.
|
|
292
309
|
* **Enhancement**:
|
|
293
|
-
API Documentation is published to readthedocs.
|
|
310
|
+
API Documentation is published to readthedocs.io.
|
|
294
311
|
* **Updated** tables for *all* Unicode Specifications with files
|
|
295
312
|
published in a programmatically consumable format, versions 4.1.0
|
|
296
313
|
through 13.0
|
|
@@ -368,6 +385,9 @@ https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c::
|
|
|
368
385
|
.. _`PR #97`: https://github.com/jquast/wcwidth/pull/97
|
|
369
386
|
.. _`PR #98`: https://github.com/jquast/wcwidth/pull/98
|
|
370
387
|
.. _`PR #100`: https://github.com/jquast/wcwidth/pull/100
|
|
388
|
+
.. _`PR #117`: https://github.com/jquast/wcwidth/pull/117
|
|
389
|
+
.. _`PR #146`: https://github.com/jquast/wcwidth/pull/146
|
|
390
|
+
.. _`PR #149`: https://github.com/jquast/wcwidth/pull/149
|
|
371
391
|
.. _`Issue #101`: https://github.com/jquast/wcwidth/issues/101
|
|
372
392
|
.. _`jquast/blessed`: https://github.com/jquast/blessed
|
|
373
393
|
.. _`selectel/pyte`: https://github.com/selectel/pyte
|
|
@@ -95,7 +95,7 @@ Briefly, return values of function ``wcwidth()`` are:
|
|
|
95
95
|
Function ``wcswidth()`` simply returns the sum of all values for each character
|
|
96
96
|
along a string, or ``-1`` when it occurs anywhere along a string.
|
|
97
97
|
|
|
98
|
-
Full API Documentation at https://wcwidth.readthedocs.
|
|
98
|
+
Full API Documentation at https://wcwidth.readthedocs.io
|
|
99
99
|
|
|
100
100
|
==========
|
|
101
101
|
Developing
|
|
@@ -105,9 +105,9 @@ Install wcwidth in editable mode::
|
|
|
105
105
|
|
|
106
106
|
pip install -e .
|
|
107
107
|
|
|
108
|
-
Execute unit tests using tox_::
|
|
108
|
+
Execute unit tests using tox_ for all supported Python versions::
|
|
109
109
|
|
|
110
|
-
tox -e
|
|
110
|
+
tox -e py36,py37,py38,py39,py310,py311,py312,py313,py314
|
|
111
111
|
|
|
112
112
|
Updating Unicode Version
|
|
113
113
|
------------------------
|
|
@@ -217,6 +217,13 @@ Other Languages
|
|
|
217
217
|
History
|
|
218
218
|
=======
|
|
219
219
|
|
|
220
|
+
0.2.14 *2025-09-22*
|
|
221
|
+
* **Drop Support** for Python 2.7 and 3.5. `PR #117`_.
|
|
222
|
+
* **Update** tables to include Unicode Specifications 16.0.0 and 17.0.0.
|
|
223
|
+
`PR #146`_.
|
|
224
|
+
* **Bugfix** U+00AD SOFT HYPHEN should measure as 1, versions 0.2.9 through
|
|
225
|
+
0.2.13 measured as 0. `PR #149`_.
|
|
226
|
+
|
|
220
227
|
0.2.13 *2024-01-06*
|
|
221
228
|
* **Bugfix** zero-width support for Hangul Jamo (Korean)
|
|
222
229
|
|
|
@@ -259,7 +266,7 @@ History
|
|
|
259
266
|
Environment variable ``UNICODE_VERSION``, such as ``13.0``, or ``6.3.0``.
|
|
260
267
|
See the `jquast/ucs-detect`_ CLI utility for automatic detection.
|
|
261
268
|
* **Enhancement**:
|
|
262
|
-
API Documentation is published to readthedocs.
|
|
269
|
+
API Documentation is published to readthedocs.io.
|
|
263
270
|
* **Updated** tables for *all* Unicode Specifications with files
|
|
264
271
|
published in a programmatically consumable format, versions 4.1.0
|
|
265
272
|
through 13.0
|
|
@@ -337,6 +344,9 @@ https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c::
|
|
|
337
344
|
.. _`PR #97`: https://github.com/jquast/wcwidth/pull/97
|
|
338
345
|
.. _`PR #98`: https://github.com/jquast/wcwidth/pull/98
|
|
339
346
|
.. _`PR #100`: https://github.com/jquast/wcwidth/pull/100
|
|
347
|
+
.. _`PR #117`: https://github.com/jquast/wcwidth/pull/117
|
|
348
|
+
.. _`PR #146`: https://github.com/jquast/wcwidth/pull/146
|
|
349
|
+
.. _`PR #149`: https://github.com/jquast/wcwidth/pull/149
|
|
340
350
|
.. _`Issue #101`: https://github.com/jquast/wcwidth/issues/101
|
|
341
351
|
.. _`jquast/blessed`: https://github.com/jquast/blessed
|
|
342
352
|
.. _`selectel/pyte`: https://github.com/selectel/pyte
|
|
@@ -21,7 +21,7 @@ import unicodedata
|
|
|
21
21
|
from pathlib import Path
|
|
22
22
|
from dataclasses import field, fields, dataclass
|
|
23
23
|
|
|
24
|
-
from typing import Any, Mapping, Iterable, Iterator, Sequence,
|
|
24
|
+
from typing import Any, Mapping, Iterable, Iterator, Sequence, Collection
|
|
25
25
|
|
|
26
26
|
try:
|
|
27
27
|
from typing import Self
|
|
@@ -90,7 +90,7 @@ def _bisearch(ucs, table):
|
|
|
90
90
|
|
|
91
91
|
@dataclass(order=True, frozen=True)
|
|
92
92
|
class UnicodeVersion:
|
|
93
|
-
"""A class for
|
|
93
|
+
"""A class for comparable unicode version."""
|
|
94
94
|
major: int
|
|
95
95
|
minor: int
|
|
96
96
|
micro: int | None
|
|
@@ -372,6 +372,21 @@ def fetch_table_zero_data() -> UnicodeTableRenderCtx:
|
|
|
372
372
|
|
|
373
373
|
# Add Hangul Jamo Vowels and Hangul Trailing Consonants
|
|
374
374
|
table[version].values.update(HANGUL_JAMO_ZEROWIDTH)
|
|
375
|
+
|
|
376
|
+
# Remove u+00AD categoryCode=Cf name="SOFT HYPHEN",
|
|
377
|
+
# > https://www.unicode.org/faq/casemap_charprop.html
|
|
378
|
+
#
|
|
379
|
+
# > Q: Unicode now treats the SOFT HYPHEN as format control (Cf)
|
|
380
|
+
# > character when formerly it was a punctuation character (Pd).
|
|
381
|
+
# > Doesn't this break ISO 8859-1 compatibility?
|
|
382
|
+
#
|
|
383
|
+
# > [..] In a terminal emulation environment, particularly in
|
|
384
|
+
# > ISO-8859-1 contexts, one could display the SOFT HYPHEN as a hyphen
|
|
385
|
+
# > in all circumstances.
|
|
386
|
+
#
|
|
387
|
+
# This value was wrongly measured as a width of '0' in this wcwidth
|
|
388
|
+
# versions 0.2.9 - 0.2.13. Fixed in 0.2.14
|
|
389
|
+
table[version].values.discard(0x00AD) # SOFT HYPHEN
|
|
375
390
|
return UnicodeTableRenderCtx('ZERO_WIDTH', table)
|
|
376
391
|
|
|
377
392
|
|
|
@@ -394,7 +409,6 @@ def fetch_table_vs16_data() -> UnicodeTableRenderCtx:
|
|
|
394
409
|
For that reason, and that these values are not expected to change,
|
|
395
410
|
only this single shared table is exported.
|
|
396
411
|
|
|
397
|
-
|
|
398
412
|
One example, where v3.2 became v1.1 ("-" 12.0, "+" 15.1)::
|
|
399
413
|
|
|
400
414
|
-2620 FE0F ; Basic_Emoji ; skull and crossbones # 3.2 [1] (☠️)
|
|
@@ -497,7 +511,7 @@ def parse_unicode_table(file: Iterable[str]) -> Iterator[TableEntry]:
|
|
|
497
511
|
|
|
498
512
|
|
|
499
513
|
def parse_vs16_table(fp: Iterable[str]) -> Iterator[TableEntry]:
|
|
500
|
-
"""Parse emoji-variation-sequences.txt for codepoints that
|
|
514
|
+
"""Parse emoji-variation-sequences.txt for codepoints that precede 0xFE0F."""
|
|
501
515
|
hex_str_vs16 = 'FE0F'
|
|
502
516
|
for line in fp:
|
|
503
517
|
data, _, comment = line.partition('#')
|
|
@@ -511,7 +525,7 @@ def parse_vs16_table(fp: Iterable[str]) -> Iterator[TableEntry]:
|
|
|
511
525
|
continue
|
|
512
526
|
code_points = code_points_str.split()
|
|
513
527
|
if len(code_points) == 2 and code_points[1] == hex_str_vs16:
|
|
514
|
-
#
|
|
528
|
+
# yield a single "code range" entry for a single value that precedes FE0F
|
|
515
529
|
yield TableEntry((int(code_points[0], 16), int(code_points[0], 16)), tuple(properties), comment)
|
|
516
530
|
|
|
517
531
|
|
|
@@ -22,7 +22,6 @@ Options:
|
|
|
22
22
|
# Invalid constant name "echo"
|
|
23
23
|
# Invalid constant name "flushout" (col 4)
|
|
24
24
|
# Invalid module name "wcwidth-browser"
|
|
25
|
-
from __future__ import division, print_function
|
|
26
25
|
|
|
27
26
|
# std imports
|
|
28
27
|
import sys
|
|
@@ -44,7 +43,7 @@ flushout = functools.partial(print, end='', flush=True)
|
|
|
44
43
|
|
|
45
44
|
#: printable length of highest unicode character description
|
|
46
45
|
LIMIT_UCS = 0x3fffd
|
|
47
|
-
UCS_PRINTLEN = len('{
|
|
46
|
+
UCS_PRINTLEN = len(f'{LIMIT_UCS:0x}')
|
|
48
47
|
|
|
49
48
|
|
|
50
49
|
def readline(term, width):
|
|
@@ -69,7 +68,7 @@ def readline(term, width):
|
|
|
69
68
|
return text
|
|
70
69
|
|
|
71
70
|
|
|
72
|
-
class WcWideCharacterGenerator
|
|
71
|
+
class WcWideCharacterGenerator:
|
|
73
72
|
"""Generator yields unicode characters of the given ``width``."""
|
|
74
73
|
|
|
75
74
|
# pylint: disable=R0903
|
|
@@ -101,7 +100,7 @@ class WcWideCharacterGenerator(object):
|
|
|
101
100
|
return (ucs, name)
|
|
102
101
|
|
|
103
102
|
|
|
104
|
-
class WcCombinedCharacterGenerator
|
|
103
|
+
class WcCombinedCharacterGenerator:
|
|
105
104
|
"""Generator yields unicode characters with combining."""
|
|
106
105
|
|
|
107
106
|
# pylint: disable=R0903
|
|
@@ -148,11 +147,8 @@ class WcCombinedCharacterGenerator(object):
|
|
|
148
147
|
continue
|
|
149
148
|
return (ucs, name)
|
|
150
149
|
|
|
151
|
-
# python 2.6 - 3.3 compatibility
|
|
152
|
-
next = __next__
|
|
153
150
|
|
|
154
|
-
|
|
155
|
-
class Style(object):
|
|
151
|
+
class Style:
|
|
156
152
|
"""Styling decorator class instance for terminal output."""
|
|
157
153
|
|
|
158
154
|
# pylint: disable=R0903
|
|
@@ -184,7 +180,7 @@ class Style(object):
|
|
|
184
180
|
setattr(self, key, val)
|
|
185
181
|
|
|
186
182
|
|
|
187
|
-
class Screen
|
|
183
|
+
class Screen:
|
|
188
184
|
"""Represents terminal style, data dimensions, and drawables."""
|
|
189
185
|
|
|
190
186
|
intro_msg_fmt = ('Delimiters ({delim}) should align, '
|
|
@@ -217,8 +213,7 @@ class Screen(object):
|
|
|
217
213
|
"""Text of a single column heading."""
|
|
218
214
|
delimiter = self.style.attr_minor(self.style.delimiter)
|
|
219
215
|
hint = self.style.header_hint * self.wide
|
|
220
|
-
heading =
|
|
221
|
-
.format(delimiter=delimiter, hint=hint))
|
|
216
|
+
heading = f'{delimiter}{hint}{delimiter}'
|
|
222
217
|
|
|
223
218
|
def alignment(*args):
|
|
224
219
|
if self.style.alignment == 'right':
|
|
@@ -264,7 +259,7 @@ class Screen(object):
|
|
|
264
259
|
return self.num_rows * self.num_columns
|
|
265
260
|
|
|
266
261
|
|
|
267
|
-
class Pager
|
|
262
|
+
class Pager:
|
|
268
263
|
"""A less(1)-like browser for browsing unicode characters."""
|
|
269
264
|
# pylint: disable=too-many-instance-attributes
|
|
270
265
|
|
|
@@ -570,10 +565,10 @@ class Pager(object):
|
|
|
570
565
|
if idx == self.last_page:
|
|
571
566
|
last_end = '(END)'
|
|
572
567
|
else:
|
|
573
|
-
last_end = '/{
|
|
568
|
+
last_end = f'/{self.last_page}'
|
|
574
569
|
txt = ('Page {idx}{last_end} - '
|
|
575
570
|
'{q} to quit, [keys: {keyset}]'
|
|
576
|
-
.format(idx=style.attr_minor('{
|
|
571
|
+
.format(idx=style.attr_minor(f'{idx}'),
|
|
577
572
|
last_end=style.attr_major(last_end),
|
|
578
573
|
keyset=style.attr_major('kjfbvc12-='),
|
|
579
574
|
q=style.attr_minor('q')))
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# coding: utf-8
|
|
3
2
|
"""
|
|
4
3
|
Manual tests comparing wcwidth.py to libc's wcwidth(3) and wcswidth(3).
|
|
5
4
|
|
|
@@ -18,7 +17,6 @@ level for our library to use when comparing to libc.
|
|
|
18
17
|
# Invalid module name "wcwidth-libc-comparator"
|
|
19
18
|
|
|
20
19
|
# standard imports
|
|
21
|
-
from __future__ import print_function
|
|
22
20
|
|
|
23
21
|
# std imports
|
|
24
22
|
import sys
|
|
@@ -64,25 +62,12 @@ def report_ucs_msg(ucs, wcwidth_libc, wcwidth_local):
|
|
|
64
62
|
.decode('ascii')
|
|
65
63
|
.upper()
|
|
66
64
|
.lstrip('0'))
|
|
67
|
-
url = "http://codepoints.net/U+{}"
|
|
65
|
+
url = f"http://codepoints.net/U+{ucp}"
|
|
68
66
|
name = unicodedata.name(ucs)
|
|
69
|
-
return (
|
|
67
|
+
return ("libc,ours={},{} [--o{}o--] name={} val={} {}"
|
|
70
68
|
" ".format(wcwidth_libc, wcwidth_local, ucs, name, ord(ucs), url))
|
|
71
69
|
|
|
72
70
|
|
|
73
|
-
# use chr() for py3.x,
|
|
74
|
-
# unichr() for py2.x
|
|
75
|
-
try:
|
|
76
|
-
_ = unichr(0)
|
|
77
|
-
except NameError as err:
|
|
78
|
-
if err.args[0] == "name 'unichr' is not defined":
|
|
79
|
-
# pylint: disable=W0622
|
|
80
|
-
# Redefining built-in 'unichr' (col 8)
|
|
81
|
-
|
|
82
|
-
unichr = chr
|
|
83
|
-
else:
|
|
84
|
-
raise
|
|
85
|
-
|
|
86
71
|
if sys.maxunicode < 1114111:
|
|
87
72
|
warnings.warn('narrow Python build, only a small subset of '
|
|
88
73
|
'characters may be tested.')
|
|
@@ -108,7 +93,7 @@ def main(using_locale=('en_US', 'UTF-8',)):
|
|
|
108
93
|
report a detailed AssertionError to stdout.
|
|
109
94
|
"""
|
|
110
95
|
all_ucs = (ucs for ucs in
|
|
111
|
-
[
|
|
96
|
+
[chr(val) for val in range(sys.maxunicode)]
|
|
112
97
|
if is_named(ucs) and is_not_combining(ucs))
|
|
113
98
|
|
|
114
99
|
libc_name = ctypes.util.find_library('c')
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
#
|
|
4
3
|
# wcwidth documentation build configuration file, created by
|
|
5
4
|
# sphinx-quickstart on Fri Oct 20 15:18:02 2017.
|
|
@@ -69,7 +68,7 @@ release = version = wcwidth.__version__
|
|
|
69
68
|
#
|
|
70
69
|
# This is also used if you do content translation via gettext catalogs.
|
|
71
70
|
# Usually you set "language" from the command line for these cases.
|
|
72
|
-
language =
|
|
71
|
+
language = 'en'
|
|
73
72
|
|
|
74
73
|
# List of patterns, relative to source directory, that match files and
|
|
75
74
|
# directories to ignore when looking for source files.
|
|
@@ -95,7 +95,7 @@ Briefly, return values of function ``wcwidth()`` are:
|
|
|
95
95
|
Function ``wcswidth()`` simply returns the sum of all values for each character
|
|
96
96
|
along a string, or ``-1`` when it occurs anywhere along a string.
|
|
97
97
|
|
|
98
|
-
Full API Documentation at https://wcwidth.readthedocs.
|
|
98
|
+
Full API Documentation at https://wcwidth.readthedocs.io
|
|
99
99
|
|
|
100
100
|
==========
|
|
101
101
|
Developing
|
|
@@ -105,9 +105,9 @@ Install wcwidth in editable mode::
|
|
|
105
105
|
|
|
106
106
|
pip install -e .
|
|
107
107
|
|
|
108
|
-
Execute unit tests using tox_::
|
|
108
|
+
Execute unit tests using tox_ for all supported Python versions::
|
|
109
109
|
|
|
110
|
-
tox -e
|
|
110
|
+
tox -e py36,py37,py38,py39,py310,py311,py312,py313,py314
|
|
111
111
|
|
|
112
112
|
Updating Unicode Version
|
|
113
113
|
------------------------
|
|
@@ -217,6 +217,13 @@ Other Languages
|
|
|
217
217
|
History
|
|
218
218
|
=======
|
|
219
219
|
|
|
220
|
+
0.2.14 *2025-09-22*
|
|
221
|
+
* **Drop Support** for Python 2.7 and 3.5. `PR #117`_.
|
|
222
|
+
* **Update** tables to include Unicode Specifications 16.0.0 and 17.0.0.
|
|
223
|
+
`PR #146`_.
|
|
224
|
+
* **Bugfix** U+00AD SOFT HYPHEN should measure as 1, versions 0.2.9 through
|
|
225
|
+
0.2.13 measured as 0. `PR #149`_.
|
|
226
|
+
|
|
220
227
|
0.2.13 *2024-01-06*
|
|
221
228
|
* **Bugfix** zero-width support for Hangul Jamo (Korean)
|
|
222
229
|
|
|
@@ -259,7 +266,7 @@ History
|
|
|
259
266
|
Environment variable ``UNICODE_VERSION``, such as ``13.0``, or ``6.3.0``.
|
|
260
267
|
See the `jquast/ucs-detect`_ CLI utility for automatic detection.
|
|
261
268
|
* **Enhancement**:
|
|
262
|
-
API Documentation is published to readthedocs.
|
|
269
|
+
API Documentation is published to readthedocs.io.
|
|
263
270
|
* **Updated** tables for *all* Unicode Specifications with files
|
|
264
271
|
published in a programmatically consumable format, versions 4.1.0
|
|
265
272
|
through 13.0
|
|
@@ -337,6 +344,9 @@ https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c::
|
|
|
337
344
|
.. _`PR #97`: https://github.com/jquast/wcwidth/pull/97
|
|
338
345
|
.. _`PR #98`: https://github.com/jquast/wcwidth/pull/98
|
|
339
346
|
.. _`PR #100`: https://github.com/jquast/wcwidth/pull/100
|
|
347
|
+
.. _`PR #117`: https://github.com/jquast/wcwidth/pull/117
|
|
348
|
+
.. _`PR #146`: https://github.com/jquast/wcwidth/pull/146
|
|
349
|
+
.. _`PR #149`: https://github.com/jquast/wcwidth/pull/149
|
|
340
350
|
.. _`Issue #101`: https://github.com/jquast/wcwidth/issues/101
|
|
341
351
|
.. _`jquast/blessed`: https://github.com/jquast/blessed
|
|
342
352
|
.. _`selectel/pyte`: https://github.com/selectel/pyte
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.12
|
|
3
|
+
# by the following command:
|
|
4
|
+
#
|
|
5
|
+
# pip-compile --allow-unsafe --cert=None --client-cert=None --index-url=None --no-emit-index-url --output-file=docs/requirements.txt --pip-args=None --strip-extras requirements-docs.in
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
alabaster==1.0.0
|
|
9
|
+
# via sphinx
|
|
10
|
+
babel==2.17.0
|
|
11
|
+
# via sphinx
|
|
12
|
+
certifi==2025.8.3
|
|
13
|
+
# via requests
|
|
14
|
+
charset-normalizer==3.4.3
|
|
15
|
+
# via requests
|
|
16
|
+
docutils==0.21.2
|
|
17
|
+
# via
|
|
18
|
+
# sphinx
|
|
19
|
+
# sphinx-rtd-theme
|
|
20
|
+
idna==3.10
|
|
21
|
+
# via requests
|
|
22
|
+
imagesize==1.4.1
|
|
23
|
+
# via sphinx
|
|
24
|
+
jinja2==3.1.6
|
|
25
|
+
# via sphinx
|
|
26
|
+
markupsafe==3.0.2
|
|
27
|
+
# via jinja2
|
|
28
|
+
packaging==25.0
|
|
29
|
+
# via sphinx
|
|
30
|
+
pygments==2.19.2
|
|
31
|
+
# via sphinx
|
|
32
|
+
requests==2.32.5
|
|
33
|
+
# via sphinx
|
|
34
|
+
roman-numerals-py==3.1.0
|
|
35
|
+
# via sphinx
|
|
36
|
+
snowballstemmer==3.0.1
|
|
37
|
+
# via sphinx
|
|
38
|
+
sphinx==8.2.3
|
|
39
|
+
# via
|
|
40
|
+
# -r requirements-docs.in
|
|
41
|
+
# sphinx-rtd-theme
|
|
42
|
+
# sphinxcontrib-jquery
|
|
43
|
+
sphinx-rtd-theme==3.0.2
|
|
44
|
+
# via -r requirements-docs.in
|
|
45
|
+
sphinxcontrib-applehelp==2.0.0
|
|
46
|
+
# via sphinx
|
|
47
|
+
sphinxcontrib-devhelp==2.0.0
|
|
48
|
+
# via sphinx
|
|
49
|
+
sphinxcontrib-htmlhelp==2.1.0
|
|
50
|
+
# via sphinx
|
|
51
|
+
sphinxcontrib-jquery==4.1
|
|
52
|
+
# via sphinx-rtd-theme
|
|
53
|
+
sphinxcontrib-jsmath==1.0.1
|
|
54
|
+
# via sphinx
|
|
55
|
+
sphinxcontrib-qthelp==2.0.0
|
|
56
|
+
# via sphinx
|
|
57
|
+
sphinxcontrib-serializinghtml==2.0.0
|
|
58
|
+
# via sphinx
|
|
59
|
+
urllib3==2.5.0
|
|
60
|
+
# via requests
|
|
@@ -26,7 +26,7 @@ Any characters defined by category codes in `DerivedGeneralCategory.txt`_ files:
|
|
|
26
26
|
- 'Me': Enclosing Combining Mark, aprox. 13 characters.
|
|
27
27
|
- 'Mn': Nonspacing Combining Mark, aprox. 1,839 characters.
|
|
28
28
|
- 'Mc': Spacing Mark, aprox. 443 characters.
|
|
29
|
-
- 'Cf': Format control
|
|
29
|
+
- 'Cf': Format control characters excluding `U+00AD` SOFT HYPHEN, aprox. 160 characters.
|
|
30
30
|
- 'Zl': `U+2028`_ LINE SEPARATOR only
|
|
31
31
|
- 'Zp': `U+2029`_ PARAGRAPH SEPARATOR only
|
|
32
32
|
- 'Sk': Modifier Symbol, aprox. 4 characters of only those where phrase
|
|
@@ -66,6 +66,7 @@ Any character in sequence with `U+FE0F`_ (Variation Selector 16) defined by
|
|
|
66
66
|
.. _`U+001F`: https://codepoints.net/U+001F
|
|
67
67
|
.. _`U+007F`: https://codepoints.net/U+007F
|
|
68
68
|
.. _`U+00A0`: https://codepoints.net/U+00A0
|
|
69
|
+
.. _`U+00AD`: https://codepoints.net/U+00AD
|
|
69
70
|
.. _`U+1160`: https://codepoints.net/U+1160
|
|
70
71
|
.. _`U+11FF`: https://codepoints.net/U+11FF
|
|
71
72
|
.. _`U+200D`: https://codepoints.net/U+200D
|
|
@@ -75,5 +76,5 @@ Any character in sequence with `U+FE0F`_ (Variation Selector 16) defined by
|
|
|
75
76
|
.. _`U+D7FF`: https://codepoints.net/U+D7FF
|
|
76
77
|
.. _`U+FE0F`: https://codepoints.net/U+FE0F
|
|
77
78
|
.. _`DerivedGeneralCategory.txt`: https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedGeneralCategory.txt
|
|
78
|
-
.. _`EastAsianWidth.txt`: https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
|
|
79
|
+
.. _`EastAsianWidth.txt`: https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
|
|
79
80
|
.. _`emoji-variation-sequences.txt`: https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-variation-sequences.txt
|
|
@@ -64,6 +64,12 @@ release files:
|
|
|
64
64
|
``DerivedGeneralCategory-15.1.0.txt``
|
|
65
65
|
*Date: 2023-07-28, 23:34:02 GMT*
|
|
66
66
|
|
|
67
|
+
``DerivedGeneralCategory-16.0.0.txt``
|
|
68
|
+
*Date: 2024-04-30, 21:48:17 GMT*
|
|
69
|
+
|
|
70
|
+
``DerivedGeneralCategory-17.0.0.txt``
|
|
71
|
+
*Date: 2025-07-24, 00:12:50 GMT*
|
|
72
|
+
|
|
67
73
|
``EastAsianWidth-4.1.0.txt``
|
|
68
74
|
*Date: 2005-03-17, 15:21:00 PST [KW]*
|
|
69
75
|
|
|
@@ -121,9 +127,18 @@ release files:
|
|
|
121
127
|
``EastAsianWidth-15.1.0.txt``
|
|
122
128
|
*Date: 2023-07-28, 23:34:08 GMT*
|
|
123
129
|
|
|
130
|
+
``EastAsianWidth-16.0.0.txt``
|
|
131
|
+
*Date: 2024-04-30, 21:48:20 GMT*
|
|
132
|
+
|
|
133
|
+
``EastAsianWidth-17.0.0.txt``
|
|
134
|
+
*Date: 2025-07-24, 00:12:54 GMT*
|
|
135
|
+
|
|
124
136
|
``emoji-variation-sequences-12.0.0.txt``
|
|
125
137
|
*Date: 2019-01-15, 12:10:05 GMT*
|
|
126
138
|
|
|
127
139
|
``emoji-variation-sequences-15.1.0.txt``
|
|
128
140
|
*Date: 2023-02-01, 02:22:54 GMT*
|
|
129
141
|
|
|
142
|
+
``emoji-variation-sequences-17.0.0.txt``
|
|
143
|
+
*Date: 2025-01-30, 21:48:29 GMT*
|
|
144
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Sphinx
|
|
1
|
+
Sphinx
|
|
2
2
|
sphinx_rtd_theme
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
# pip-compile --allow-unsafe --no-emit-index-url --output-file=requirements-tests37.txt --resolver=backtracking --strip-extras requirements-tests37.in
|
|
6
6
|
#
|
|
7
|
-
attrs==
|
|
7
|
+
attrs==24.2.0
|
|
8
8
|
# via pytest
|
|
9
9
|
coverage==5.5
|
|
10
10
|
# via
|
|
@@ -18,7 +18,7 @@ importlib-metadata==6.7.0 ; python_version < "3.8"
|
|
|
18
18
|
# pytest
|
|
19
19
|
iniconfig==2.0.0
|
|
20
20
|
# via pytest
|
|
21
|
-
packaging==
|
|
21
|
+
packaging==24.0
|
|
22
22
|
# via pytest
|
|
23
23
|
pluggy==1.2.0
|
|
24
24
|
# via pytest
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.9
|
|
3
|
+
# by the following command:
|
|
4
|
+
#
|
|
5
|
+
# pip-compile --allow-unsafe --no-emit-index-url --output-file=requirements-tests39.txt --strip-extras requirements-tests39.in
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
coverage==7.10.6
|
|
9
|
+
# via pytest-cov
|
|
10
|
+
exceptiongroup==1.3.0
|
|
11
|
+
# via pytest
|
|
12
|
+
iniconfig==2.1.0
|
|
13
|
+
# via pytest
|
|
14
|
+
packaging==25.0
|
|
15
|
+
# via pytest
|
|
16
|
+
pluggy==1.6.0
|
|
17
|
+
# via
|
|
18
|
+
# pytest
|
|
19
|
+
# pytest-cov
|
|
20
|
+
py-cpuinfo==9.0.0
|
|
21
|
+
# via pytest-benchmark
|
|
22
|
+
pygments==2.19.2
|
|
23
|
+
# via pytest
|
|
24
|
+
pytest==8.4.2
|
|
25
|
+
# via
|
|
26
|
+
# -r requirements-tests39.in
|
|
27
|
+
# pytest-benchmark
|
|
28
|
+
# pytest-cov
|
|
29
|
+
pytest-benchmark==5.1.0
|
|
30
|
+
# via -r requirements-tests39.in
|
|
31
|
+
pytest-cov==7.0.0
|
|
32
|
+
# via -r requirements-tests39.in
|
|
33
|
+
tomli==2.2.1
|
|
34
|
+
# via
|
|
35
|
+
# coverage
|
|
36
|
+
# pytest
|
|
37
|
+
typing-extensions==4.15.0
|
|
38
|
+
# via exceptiongroup
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.12
|
|
3
|
+
# by the following command:
|
|
4
|
+
#
|
|
5
|
+
# pip-compile --allow-unsafe --cert=None --client-cert=None --index-url=None --no-emit-index-url --output-file=requirements-update.txt --pip-args=None --strip-extras requirements-update.in
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
certifi==2025.8.3
|
|
9
|
+
# via requests
|
|
10
|
+
charset-normalizer==3.4.3
|
|
11
|
+
# via requests
|
|
12
|
+
idna==3.10
|
|
13
|
+
# via requests
|
|
14
|
+
jinja2==3.1.6
|
|
15
|
+
# via -r requirements-update.in
|
|
16
|
+
markupsafe==3.0.2
|
|
17
|
+
# via jinja2
|
|
18
|
+
python-dateutil==2.9.0.post0
|
|
19
|
+
# via -r requirements-update.in
|
|
20
|
+
requests==2.32.5
|
|
21
|
+
# via -r requirements-update.in
|
|
22
|
+
six==1.17.0
|
|
23
|
+
# via python-dateutil
|
|
24
|
+
typing-extensions==4.15.0
|
|
25
|
+
# via -r requirements-update.in
|
|
26
|
+
urllib3==2.5.0
|
|
27
|
+
# via requests
|