Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
_wcwidth.cpython-313.pyc114 linesDownload Raw Back to __pycache__
1�

2��j_���SrSSKJr SSKJr SSKJr SSKJrJrJ	r	J3r4 \"SS9SS	j5r\"S5S9SSj5r\"SS9SSS
jj5r
g)a�6This is a python implementation of wcwidth() and wcswidth().7 8https://github.com/jquast/wcwidth9 10Derived from Markus Kuhn's C code,11 12This is an implementation of wcwidth() and wcswidth() (defined in13IEEE Std 1002.1-2001) for Unicode.14 15http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html16http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html17 18In fixed-width output devices, Latin characters all occupy a single19"cell" position of equal width, whereas ideographic CJK characters20occupy two such cells. Interoperability between terminal-line21applications and (teletype-style) character terminals using the22UTF-8 encoding requires agreement on which character should advance23the cursor by how many cell positions. No established formal24standards exist at present on which Unicode character shall occupy25how many cell positions on character terminals. These routines are26a first attempt of defining such behavior based on simple rules27applied to data provided by the Unicode Consortium.28 29For some graphical characters, the Unicode standard explicitly30defines a character-cell width via the definition of the East Asian31FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.32In all these cases, there is no ambiguity about which width a33terminal shall use. For characters in the East Asian Ambiguous (A)34class, the width choice depends purely on a preference of backward35compatibility with either historic CJK or Western practice.36Choosing single-width for these characters is easy to justify as37the appropriate long-term solution, as the CJK practice of38displaying these characters as double-width comes from historic39implementation simplicity (8-bit encoded characters were displayed40single-width and 16-bit ones double-width, even for Greek,41Cyrillic, etc.) and not any typographic considerations.42 43Much less clear is the choice of width for the Not East Asian44(Neutral) class. Existing practice does not dictate a width for any45of these characters. It would nevertheless make sense46typographically to allocate two character cells to characters such47as for instance EM SPACE or VOLUME INTEGRAL, which cannot be48represented adequately with a single-width glyph. The following49routines at present merely assign a single-cell width to all50neutral characters, in the interest of simplicity. This is not51entirely satisfactory and should be reconsidered before52establishing a formal standard in this area. At the moment, the53decision which Not East Asian (Neutral) characters should be54represented by double-width glyphs cannot yet be answered by55applying a simple rule from the Unicode database content. Setting56up a proper standard for the behavior of UTF-8 character terminals57will require a careful analysis not only of each Unicode character,58but also of each presentation form, something the author of these59routines has avoided to do so far.60 61http://www.unicode.org/unicode/reports/tr11/62 63Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c64�)�annotations)�	lru_cache�)�bisearch)�_LATEST_VERSION�_AMBIGUOUS_TABLE�_ZERO_WIDTH_TABLE�_WIDE_EASTASIAN_TABLE�)�maxsizec�V�[[[URS555nU$)a>65Integer-mapped value of given dotted version string.66 67.. deprecated:: 0.3.068 69    This function is no longer used internally by wcwidth but is retained70    for API compatibility with external tools.71 72:param ver_string: Unicode version string, of form ``n.n.n``.73:returns: tuple of digit tuples, ``tuple(int, [...])``.74�.)�tuple�map�int�split)�75ver_string�retvals  �VD:\code\apps\devtools\python\user_packages\Python313\site-packages\wcwidth/_wcwidth.py�_wcversion_valuerHs%���3�s�Z�-�-�c�2�4�
5�F��M��c��[$)am76Return the supported Unicode version level.77 78.. deprecated:: 0.3.079    This function now always returns the latest version.80 81    This function is no longer used internally by wcwidth but is retained82    for API compatibility with external tools.83 84:param given_version: Ignored. Any value is accepted for compatibility.85:returns: The latest unicode version string.86)r)�
given_versions r�_wcmatch_versionrYs87���ric��U(a[U5OSnSUs=::aS:ag U(aUS:dSUs=::aS:ag Og[U[5(ag[U[5(agUS:Xa[U[5(agg)a�88Given one Unicode codepoint, return its printable length on a terminal.89 90:param wc: A single Unicode character.91:param unicode_version: Ignored. Retained for backwards compatibility.92 93    .. deprecated:: 0.3.094       Only the latest Unicode version is now shipped.95 96:param ambiguous_width: Width to use for East Asian Ambiguous (A)97    characters. Default is ``1`` (narrow). Set to ``2`` for CJK contexts98    where ambiguous characters display as double-width. See99    :ref:`ambiguous_width` for details.100:returns: The width, in cells, necessary to display the character of101    Unicode string character, ``wc``.  Returns 0 if the ``wc`` argument has102    no printable effect on a terminal (such as NUL '\0'), -1 if ``wc`` is103    not printable, or has an indeterminate effect on the terminal, such as104    a control character.  Otherwise, the number of column positions the105    character occupies on a graphic terminal (1 or 2) is returned.106 107See :ref:`Specification` for details of cell measurement.108r� �r�������)�ordrr	r109r)�wc�unicode_version�ambiguous_width�ucss    r�wcwidthr'ns���0�#�b�'�Q�C�110111�S��4�����s�R�x�5�C�/�%�/��0����&�'�'����*�+�+���!����.>� ?� ?��rN)r�str�returnztuple[int, ...])rr(r)r()�autor)r#r(r$r(r%rr)r)�__doc__�112__future__r�	functoolsrr�113_constantsrrr	r114rrr'�rr�<module>r0sk��;�z#� ��c�c��3��
��
� �1��
��
�(�4��/
��/
r
codekingpro/portable-devtools · Team Ai