wcwidth 0.2.13__py2.py3-none-any.whl → 0.2.14__py2.py3-none-any.whl
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/__init__.py +1 -1
- wcwidth/table_vs15.py +103 -0
- wcwidth/table_vs16.py +2 -2
- wcwidth/table_wide.py +260 -2
- wcwidth/table_zero.py +691 -20
- wcwidth/unicode_versions.py +3 -1
- wcwidth/wcwidth.py +15 -34
- {wcwidth-0.2.13.dist-info → wcwidth-0.2.14.dist-info}/METADATA +29 -9
- wcwidth-0.2.14.dist-info/RECORD +13 -0
- {wcwidth-0.2.13.dist-info → wcwidth-0.2.14.dist-info}/WHEEL +1 -1
- wcwidth-0.2.13.dist-info/RECORD +0 -12
- {wcwidth-0.2.13.dist-info → wcwidth-0.2.14.dist-info/licenses}/LICENSE +0 -0
- {wcwidth-0.2.13.dist-info → wcwidth-0.2.14.dist-info}/top_level.txt +0 -0
- {wcwidth-0.2.13.dist-info → wcwidth-0.2.14.dist-info}/zip-safe +0 -0
wcwidth/unicode_versions.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Exports function list_versions() for unicode version level support.
|
|
3
3
|
|
|
4
|
-
This code generated by wcwidth/bin/update-tables.py on
|
|
4
|
+
This code generated by wcwidth/bin/update-tables.py on 2025-09-15 16:57:50 UTC.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
|
|
@@ -35,4 +35,6 @@ def list_versions():
|
|
|
35
35
|
"14.0.0",
|
|
36
36
|
"15.0.0",
|
|
37
37
|
"15.1.0",
|
|
38
|
+
"16.0.0",
|
|
39
|
+
"17.0.0",
|
|
38
40
|
)
|
wcwidth/wcwidth.py
CHANGED
|
@@ -60,12 +60,11 @@ http://www.unicode.org/unicode/reports/tr11/
|
|
|
60
60
|
|
|
61
61
|
Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
|
|
62
62
|
"""
|
|
63
|
-
from __future__ import division
|
|
64
63
|
|
|
65
64
|
# std imports
|
|
66
65
|
import os
|
|
67
|
-
import sys
|
|
68
66
|
import warnings
|
|
67
|
+
from functools import lru_cache
|
|
69
68
|
|
|
70
69
|
# local
|
|
71
70
|
from .table_vs16 import VS16_NARROW_TO_WIDE
|
|
@@ -73,17 +72,6 @@ from .table_wide import WIDE_EASTASIAN
|
|
|
73
72
|
from .table_zero import ZERO_WIDTH
|
|
74
73
|
from .unicode_versions import list_versions
|
|
75
74
|
|
|
76
|
-
try:
|
|
77
|
-
# std imports
|
|
78
|
-
from functools import lru_cache
|
|
79
|
-
except ImportError:
|
|
80
|
-
# lru_cache was added in Python 3.2
|
|
81
|
-
# 3rd party
|
|
82
|
-
from backports.functools_lru_cache import lru_cache
|
|
83
|
-
|
|
84
|
-
# global cache
|
|
85
|
-
_PY3 = sys.version_info[0] >= 3
|
|
86
|
-
|
|
87
75
|
|
|
88
76
|
def _bisearch(ucs, table):
|
|
89
77
|
"""
|
|
@@ -186,11 +174,11 @@ def wcswidth(pwcs, n=None, unicode_version='auto'):
|
|
|
186
174
|
last_measured_char = None
|
|
187
175
|
while idx < end:
|
|
188
176
|
char = pwcs[idx]
|
|
189
|
-
if char ==
|
|
177
|
+
if char == '\u200D':
|
|
190
178
|
# Zero Width Joiner, do not measure this or next character
|
|
191
179
|
idx += 2
|
|
192
180
|
continue
|
|
193
|
-
if char ==
|
|
181
|
+
if char == '\uFE0F' and last_measured_char:
|
|
194
182
|
# on variation selector 16 (VS16) following another character,
|
|
195
183
|
# conditionally add '1' to the measured width if that character is
|
|
196
184
|
# known to be converted from narrow to wide by the VS16 character.
|
|
@@ -250,8 +238,7 @@ def _wcmatch_version(given_version):
|
|
|
250
238
|
``UNICODE_VERSION``. If the environment variable is not set, then the
|
|
251
239
|
latest is used.
|
|
252
240
|
:rtype: str
|
|
253
|
-
:returns: unicode string
|
|
254
|
-
when given ``version`` is also type ``str``.
|
|
241
|
+
:returns: unicode string.
|
|
255
242
|
"""
|
|
256
243
|
# Design note: the choice to return the same type that is given certainly
|
|
257
244
|
# complicates it for python 2 str-type, but allows us to define an api that
|
|
@@ -261,30 +248,24 @@ def _wcmatch_version(given_version):
|
|
|
261
248
|
# That, along with the string-to-numeric and comparisons of earliest,
|
|
262
249
|
# latest, matching, or nearest, greatly complicates this function.
|
|
263
250
|
# Performance is somewhat curbed by memoization.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if _return_str:
|
|
267
|
-
# avoid list-comprehension to work around a coverage issue:
|
|
268
|
-
# https://github.com/nedbat/coveragepy/issues/753
|
|
269
|
-
unicode_versions = list(map(lambda ucs: ucs.encode(), list_versions()))
|
|
270
|
-
else:
|
|
271
|
-
unicode_versions = list_versions()
|
|
251
|
+
|
|
252
|
+
unicode_versions = list_versions()
|
|
272
253
|
latest_version = unicode_versions[-1]
|
|
273
254
|
|
|
274
|
-
if given_version
|
|
255
|
+
if given_version == 'auto':
|
|
275
256
|
given_version = os.environ.get(
|
|
276
257
|
'UNICODE_VERSION',
|
|
277
|
-
'latest'
|
|
258
|
+
'latest')
|
|
278
259
|
|
|
279
|
-
if given_version
|
|
260
|
+
if given_version == 'latest':
|
|
280
261
|
# default match, when given as 'latest', use the most latest unicode
|
|
281
262
|
# version specification level supported.
|
|
282
|
-
return latest_version
|
|
263
|
+
return latest_version
|
|
283
264
|
|
|
284
265
|
if given_version in unicode_versions:
|
|
285
266
|
# exact match, downstream has specified an explicit matching version
|
|
286
267
|
# matching any value of list_versions().
|
|
287
|
-
return given_version
|
|
268
|
+
return given_version
|
|
288
269
|
|
|
289
270
|
# The user's version is not supported by ours. We return the newest unicode
|
|
290
271
|
# version level that we support below their given value.
|
|
@@ -298,7 +279,7 @@ def _wcmatch_version(given_version):
|
|
|
298
279
|
"supported unicode version {latest_version!r} has been "
|
|
299
280
|
"inferred.".format(given_version=given_version,
|
|
300
281
|
latest_version=latest_version))
|
|
301
|
-
return latest_version
|
|
282
|
+
return latest_version
|
|
302
283
|
|
|
303
284
|
# given version is less than any available version, return earliest
|
|
304
285
|
# version.
|
|
@@ -314,7 +295,7 @@ def _wcmatch_version(given_version):
|
|
|
314
295
|
"version level, {earliest_version!r}".format(
|
|
315
296
|
given_version=given_version,
|
|
316
297
|
earliest_version=earliest_version))
|
|
317
|
-
return earliest_version
|
|
298
|
+
return earliest_version
|
|
318
299
|
|
|
319
300
|
# create list of versions which are less than our equal to given version,
|
|
320
301
|
# and return the tail value, which is the highest level we may support,
|
|
@@ -328,7 +309,7 @@ def _wcmatch_version(given_version):
|
|
|
328
309
|
cmp_next_version = _wcversion_value(unicode_versions[idx + 1])
|
|
329
310
|
except IndexError:
|
|
330
311
|
# at end of list, return latest version
|
|
331
|
-
return latest_version
|
|
312
|
+
return latest_version
|
|
332
313
|
|
|
333
314
|
# Maybe our given version has less parts, as in tuple(8, 0), than the
|
|
334
315
|
# next compare version tuple(8, 0, 0). Test for an exact match by
|
|
@@ -338,7 +319,7 @@ def _wcmatch_version(given_version):
|
|
|
338
319
|
|
|
339
320
|
# Or, if any next value is greater than our given support level
|
|
340
321
|
# version, return the current value in index. Even though it must
|
|
341
|
-
# be less than the given value,
|
|
322
|
+
# be less than the given value, it's our closest possible match. That
|
|
342
323
|
# is, 4.1 is returned for given 4.9.9, where 4.1 and 5.0 are available.
|
|
343
324
|
if cmp_next_version > cmp_given:
|
|
344
325
|
return unicode_version
|
|
@@ -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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
wcwidth/__init__.py,sha256=5RiBcbmILHnDStKPOr1jA_31LMgbwTZmv7UoSf1c1-A,1076
|
|
2
|
+
wcwidth/table_vs15.py,sha256=Xl7hsr04XJ4vvxe37LvaL0ex93rWUvzYIpX1vJiHyYQ,5170
|
|
3
|
+
wcwidth/table_vs16.py,sha256=STRpUr9FNE3B2aOKtIy-a3wix4eMUSyOg65ZCIHY4qM,6857
|
|
4
|
+
wcwidth/table_wide.py,sha256=DL-zI2JGLcJkEMPcaMvqBYLQDbhheOL3pGYpzvHTQPU,117873
|
|
5
|
+
wcwidth/table_zero.py,sha256=YcdDVx4WuXVdlJGSOvOZ99Msn8KeRVLIDDz4Om9DXOI,409071
|
|
6
|
+
wcwidth/unicode_versions.py,sha256=XprVckZk9FOFrmQaSxEnDqa8G-q8h36j7zRnFUj6V4I,887
|
|
7
|
+
wcwidth/wcwidth.py,sha256=Sx85FzyPmJzXPSOSZvq3IDqS6cZrp_f6n1jHdS4Ox7s,13551
|
|
8
|
+
wcwidth-0.2.14.dist-info/licenses/LICENSE,sha256=cLmKlaIUTrcK-AF_qMbZXOJH5AhnQ26LxknhN_4T0ho,1322
|
|
9
|
+
wcwidth-0.2.14.dist-info/METADATA,sha256=zOIuk0LOo4aPc1wHTJfSNJASCiSzRkq_EMHRsLsWK1M,15629
|
|
10
|
+
wcwidth-0.2.14.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
11
|
+
wcwidth-0.2.14.dist-info/top_level.txt,sha256=LLjS8SFiXXuLEcD2BNdFdGhpKWe5opHtvn7KNj9AIRI,8
|
|
12
|
+
wcwidth-0.2.14.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
13
|
+
wcwidth-0.2.14.dist-info/RECORD,,
|
wcwidth-0.2.13.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
wcwidth/__init__.py,sha256=ecZx3UVoktZuAvatG6NetByVFgENkKl9htmk0ZasTmA,1076
|
|
2
|
-
wcwidth/table_vs16.py,sha256=hPbuoFxmxrGfuBaeoheMTAGmgB2a4EudhxYsYokLf6o,6857
|
|
3
|
-
wcwidth/table_wide.py,sha256=vUHjEOuRw1WGyUcIw2L9GymZsYvC2I3dc858mlYyTYM,100896
|
|
4
|
-
wcwidth/table_zero.py,sha256=4ZeihLZDH8obgrwA6ct-vu2lxc4t_DsfyiB9p9Ovxbo,359450
|
|
5
|
-
wcwidth/unicode_versions.py,sha256=7nShgeRYrvZFkGpREdr-PkUeXnuM-WxeOmGYj6QNaaE,851
|
|
6
|
-
wcwidth/wcwidth.py,sha256=TLzyH1ahdEDDPOIMcqVO4U0gyKwSyZdzAsSgEPuVFGY,14512
|
|
7
|
-
wcwidth-0.2.13.dist-info/LICENSE,sha256=cLmKlaIUTrcK-AF_qMbZXOJH5AhnQ26LxknhN_4T0ho,1322
|
|
8
|
-
wcwidth-0.2.13.dist-info/METADATA,sha256=wBs2ALubn0kTdhEFDXc1gZBU_zf4rlfNgv1YS02jzLQ,14992
|
|
9
|
-
wcwidth-0.2.13.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
|
10
|
-
wcwidth-0.2.13.dist-info/top_level.txt,sha256=LLjS8SFiXXuLEcD2BNdFdGhpKWe5opHtvn7KNj9AIRI,8
|
|
11
|
-
wcwidth-0.2.13.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
12
|
-
wcwidth-0.2.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|