wcwidth 0.9.2__cp315-cp315t-win32.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.
- wcwidth/__init__.py +101 -0
- wcwidth/_clip.py +944 -0
- wcwidth/_constants.py +177 -0
- wcwidth/_wcswidth.py +446 -0
- wcwidth/_wcwidth.py +168 -0
- wcwidth/_wcwidth_c.cp315t-win32.pyd +0 -0
- wcwidth/_wcwidth_c.pyi +77 -0
- wcwidth/_width.py +518 -0
- wcwidth/align.py +223 -0
- wcwidth/bisearch.py +30 -0
- wcwidth/control_codes.py +46 -0
- wcwidth/escape_sequences.py +208 -0
- wcwidth/grapheme.py +425 -0
- wcwidth/hyperlink.py +142 -0
- wcwidth/py.typed +0 -0
- wcwidth/sgr_state.py +355 -0
- wcwidth/table_ambiguous.py +189 -0
- wcwidth/table_grapheme.py +2365 -0
- wcwidth/table_grapheme_overrides/__init__.py +37 -0
- wcwidth/table_grapheme_overrides/_known_058c7585.py +2642 -0
- wcwidth/table_grapheme_overrides/_known_2148ff29.py +1805 -0
- wcwidth/table_grapheme_overrides/_known_244dc88b.py +82 -0
- wcwidth/table_grapheme_overrides/_known_336a71a1.py +3590 -0
- wcwidth/table_grapheme_overrides/_known_33ac73f2.py +1969 -0
- wcwidth/table_grapheme_overrides/_known_3a1895d5.py +1207 -0
- wcwidth/table_grapheme_overrides/_known_59180a0d.py +2669 -0
- wcwidth/table_grapheme_overrides/_known_65c6beb5.py +2748 -0
- wcwidth/table_grapheme_overrides/_known_78f828e8.py +1225 -0
- wcwidth/table_grapheme_overrides/_known_8c2ae14d.py +2712 -0
- wcwidth/table_grapheme_overrides/_known_900356bf.py +115 -0
- wcwidth/table_grapheme_overrides/_known_97904ece.py +2571 -0
- wcwidth/table_grapheme_overrides/_known_a5880eeb.py +2570 -0
- wcwidth/table_grapheme_overrides/_known_b6d33cf4.py +3374 -0
- wcwidth/table_grapheme_overrides/_known_c57c295b.py +6422 -0
- wcwidth/table_grapheme_overrides/_known_cf02297d.py +1799 -0
- wcwidth/table_grapheme_overrides/_known_e18ac6a7.py +6674 -0
- wcwidth/table_grapheme_overrides/_known_e2b75ee3.py +42 -0
- wcwidth/table_grapheme_overrides/_known_fb5fd79b.py +2952 -0
- wcwidth/table_grapheme_overrides/_known_fdc99132.py +2642 -0
- wcwidth/table_grapheme_overrides/_registry.py +32 -0
- wcwidth/table_mc.py +209 -0
- wcwidth/table_overrides.py +979 -0
- wcwidth/table_term_programs.py +50 -0
- wcwidth/table_vs15.py +104 -0
- wcwidth/table_vs16.py +126 -0
- wcwidth/table_wide.py +141 -0
- wcwidth/table_zero.py +356 -0
- wcwidth/text_sizing.py +203 -0
- wcwidth/textwrap.py +671 -0
- wcwidth/unicode_versions.py +21 -0
- wcwidth/wcwidth.py +88 -0
- wcwidth-0.9.2.dist-info/METADATA +589 -0
- wcwidth-0.9.2.dist-info/RECORD +56 -0
- wcwidth-0.9.2.dist-info/WHEEL +5 -0
- wcwidth-0.9.2.dist-info/licenses/LICENSE +27 -0
- wcwidth-0.9.2.dist-info/top_level.txt +1 -0
wcwidth/__init__.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Python 'wcwidth' module.
|
|
3
|
+
|
|
4
|
+
https://github.com/jquast/wcwidth
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__lazy_modules__ = [
|
|
8
|
+
"wcwidth._clip",
|
|
9
|
+
"wcwidth._wcswidth",
|
|
10
|
+
"wcwidth._wcwidth",
|
|
11
|
+
"wcwidth._width",
|
|
12
|
+
"wcwidth.align",
|
|
13
|
+
"wcwidth.bisearch",
|
|
14
|
+
"wcwidth.escape_sequences",
|
|
15
|
+
"wcwidth.grapheme",
|
|
16
|
+
"wcwidth.hyperlink",
|
|
17
|
+
"wcwidth.sgr_state",
|
|
18
|
+
"wcwidth.table_ambiguous",
|
|
19
|
+
"wcwidth.table_vs16",
|
|
20
|
+
"wcwidth.table_wide",
|
|
21
|
+
"wcwidth.table_zero",
|
|
22
|
+
"wcwidth.text_sizing",
|
|
23
|
+
"wcwidth.textwrap",
|
|
24
|
+
"wcwidth.unicode_versions",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
# std imports
|
|
28
|
+
import os
|
|
29
|
+
from functools import lru_cache
|
|
30
|
+
|
|
31
|
+
# local
|
|
32
|
+
from ._clip import clip
|
|
33
|
+
# re-export common and outermost functions & definitions, even a few private ones. Some are for
|
|
34
|
+
# convenience and others for legacy, only the items in '__all__' are documented as public API
|
|
35
|
+
from .bisearch import bisearch as _bisearch
|
|
36
|
+
from .grapheme import iter_graphemes_reverse, grapheme_boundary_before
|
|
37
|
+
from .textwrap import SequenceTextWrapper, wrap
|
|
38
|
+
from .hyperlink import Hyperlink, HyperlinkParams
|
|
39
|
+
from ._constants import list_term_programs
|
|
40
|
+
from .table_vs16 import VS16_NARROW_TO_WIDE
|
|
41
|
+
from .table_wide import WIDE_EASTASIAN
|
|
42
|
+
from .table_zero import ZERO_WIDTH
|
|
43
|
+
from .text_sizing import TextSizing, TextSizingParams
|
|
44
|
+
from .table_ambiguous import AMBIGUOUS_EASTASIAN
|
|
45
|
+
from .escape_sequences import iter_sequences
|
|
46
|
+
from .unicode_versions import list_versions
|
|
47
|
+
|
|
48
|
+
# Optional C extension 'wcwidth._wcwidth_c', wrapping the C11 libwcwidth
|
|
49
|
+
# library; the Python implementations below are used when it is unavailable.
|
|
50
|
+
HAS_C_EXTENSION = False
|
|
51
|
+
if not os.environ.get('WCWIDTH_PYTHON', ''):
|
|
52
|
+
try:
|
|
53
|
+
# local
|
|
54
|
+
import wcwidth._wcwidth_c as _wcwidth_c # noqa: F401 pylint:disable=unused-import,consider-using-from-import
|
|
55
|
+
except ImportError:
|
|
56
|
+
pass
|
|
57
|
+
else:
|
|
58
|
+
HAS_C_EXTENSION = True
|
|
59
|
+
|
|
60
|
+
# Import order matters for legacy API compatibility (releases before 0.7.0).
|
|
61
|
+
#
|
|
62
|
+
# The first release (0.1) put _bisearch, wcwidth, and wcswidth in a single 'wcwidth.py' file, and
|
|
63
|
+
# while the top-level function importing, 'from wcwidth import wcwidth' was always preferred, the
|
|
64
|
+
# deeper 'from wcwidth.wcwidth import wcwidth' was always possible.
|
|
65
|
+
#
|
|
66
|
+
# Pre-import the legacy submodule so sys.modules['wcwidth.wcwidth'] is populated during package
|
|
67
|
+
# initialization: without it, a later ``import wcwidth.wcwidth`` discovers the file on disk and
|
|
68
|
+
# rebinds that name from the function to the module object. It must run before the 'wcwidth'
|
|
69
|
+
# binding below, because 'from . import wcwidth' loads the submodule while the package attribute
|
|
70
|
+
# is still unset. The shim's own __lazy_modules__ defers its imports, so this costs one module.
|
|
71
|
+
from . import wcwidth as _wcwidth_module # isort:skip pylint: disable=wrong-import-position
|
|
72
|
+
|
|
73
|
+
if HAS_C_EXTENSION:
|
|
74
|
+
# local
|
|
75
|
+
from ._wcwidth_c import ljust, rjust, width, center
|
|
76
|
+
from ._wcwidth_c import wcwidth as _c_wcwidth
|
|
77
|
+
from ._wcwidth_c import wcswidth, wcstwidth, propagate_sgr, iter_graphemes, strip_sequences
|
|
78
|
+
wcwidth = lru_cache(maxsize=1024)(_c_wcwidth)
|
|
79
|
+
else:
|
|
80
|
+
# local
|
|
81
|
+
from .align import ljust, rjust, center
|
|
82
|
+
from ._width import width
|
|
83
|
+
from ._wcwidth import wcwidth
|
|
84
|
+
from .grapheme import iter_graphemes
|
|
85
|
+
from ._wcswidth import wcswidth, wcstwidth
|
|
86
|
+
from .sgr_state import propagate_sgr
|
|
87
|
+
from .escape_sequences import strip_sequences
|
|
88
|
+
|
|
89
|
+
from ._wcwidth import _wcmatch_version, _wcversion_value # isort:skip # pylint: disable=wrong-import-position
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# The __all__ attribute defines the items exported from statement,
|
|
93
|
+
# 'from wcwidth import *', but also to say, "This is the public API".
|
|
94
|
+
__all__ = ('wcwidth', 'wcswidth', 'wcstwidth', 'width', 'iter_sequences', 'iter_graphemes',
|
|
95
|
+
'iter_graphemes_reverse', 'grapheme_boundary_before',
|
|
96
|
+
'ljust', 'rjust', 'center', 'wrap', 'clip', 'strip_sequences',
|
|
97
|
+
'list_versions', 'list_term_programs', 'propagate_sgr',
|
|
98
|
+
'Hyperlink', 'HyperlinkParams', 'TextSizing', 'TextSizingParams')
|
|
99
|
+
|
|
100
|
+
# Version is stamped by code generation (bin/update-tables.py) from pyproject.toml.
|
|
101
|
+
__version__ = '0.9.2'
|