Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2�j"���SrSSKJr SSKrSSKJr SSKJr SSKrSSKJr S'Sjr	S(S	jr3\"S45rS)SjrS*Sjr
S+S
jr\R"S\R 5r\R"S5r\R"S\R 5rS,SjrS-SjrSr\R"S\-S-5rS-SjrS.Sjr\R"S5rS-SjrS/SjrS0Sjr1SkrS1SjrS2Sjr 1Skr!S3S jr"S-S!jr#\R"S"\R S#9r$\R"S$\R S#9r%S4S%jr&S4S&jr'g)5z!Utilities for parsing source text�)�annotationsN)�Match)�TypeVar�)�entitiesc�>�[X5$![a gf=f�z�5Returns the Unicode value of the character at the specified location.6 7@param - index The zero-based index of the desired character.8If there is no character at the specified index, NaN is returned.9 10This was added for compatibility with python11N)�ord�12IndexError��src�poss  �^D:\code\apps\devtools\python\user_packages\Python313\site-packages\markdown_it/common/utils.py�13charCodeAtr
s%����3�8�}�������s��14�c�,�X$![a gf=fr	)rrs  r�	charStrAtrs ����x�������s��15��_ItemTVc�"�USUU-XS-S-$)zk16Remove element from array and put another array at those position.17Useful for some operations with tokens18Nr�)r
r�newElementss   r�arrayReplaceAtr.s"���t��9�{�"�S�q���^�3�3�c���US:�aUS::agUS:�aUS::agUS-S:Xd	US-S:XagUS:�aUS	::agUS19:XagUS:�aUS::agUS
:�aUS::agUS:�+$)Ni�i��Fi��i��i��i��r������i��r��cs r�isValidEntityCoder"8s����F�{�q�F�{���F�{�q�F�{��	20�V����Q��Z�F�$:���D�y�Q�$�Y���D�y���D�y�Q�$�Y���D�y�Q�$�Y���H��rc��[U5$)z�Convert ordinal to unicode.21 22Note, in the original Javascript two string characters were required,23for codepoints larger than `0xFFFF`.24But Python 3 can represent any unicode codepoint in one character.25)�chrr s r�
fromCodePointr%Ns
���q�6�MrzD\\([!"#$%&\'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])|&([a-z#][a-z0-9]{1,31});z
#([0-9]{1,8})z#x([a-f0-9]{1,8})c�J�U[;a	[U$Sn[RU5=n(a[UR	S5S5nO7[26RU5=n(a[UR	S5S5nUb[
U5(a[U5$U$)zVConvert HTML entity patterns,27see https://spec.commonmark.org/0.30/#entity-references28Nr�29�)r�DIGITAL_ENTITY_BASE10_RE�	fullmatch�int�group�DIGITAL_ENTITY_BASE16_REr"r%)�match�name�code�pats    r�replaceEntityPatternr2bs����x����~���D�&�0�0��6�6�s�6��3�9�9�Q�<��$��(�2�2�4�8�	8��	8��3�9�9�Q�<��$����-�d�3�3��T�"�"��Lrc�R�SSjnSU;aSU;aU$[RX5$)Nc��URS5nU(aU$URS5n[UR5U5$)Nr�)r,r2)r.�escaped�entitys   r�
replacer_func�"unescapeAll.<locals>.replacer_funcvs7���+�+�a�.����N����Q���#�E�K�K�M�6�:�:r�\�&)r.z30Match[str]�return�str)�UNESCAPE_ALL_RE�sub)�stringr8s  r�unescapeAllrAus.��;��6��c��/��
����}�5�5rz#\\!"#$%&'()*+,./:;<=>?@\[\]^`{}|_~-z\\([z])c�.�[RSU5$)zStrip escape \ charactersz\1)�ESCAPE_CHARr?�r@s r�stripEscaperE�s���?�?�5�&�)�)rc��URSS5nURSS5nURSS5nURSS5nU$)	zHReplace special characters "&", "<", ">" and '"' to HTML-safe sequences.r;z&amp;�<z&lt;�>z&gt;�"z&quot;)�replace)�raws r�31escapeHtmlrL�sI���+�+�c�7�32#�C�33
�+�+�c�6�34"�C�35
�+�+�c�6�36"�C�37
�+�+�c�8�38$�C��Jrz[.?*+^$[\]\\(){}|-]c�2�[RSU5nU$)Nz\$&)�REGEXP_ESCAPE_REr?rDs r�escapeRErO�s��
�
!�
!�&�&�
1�F��Mrc��US;$)z(Check if character code is a whitespace.)�	� r�r0s r�isSpacerT�s
���<��rc��US;$)z#Check if character is a whitespace.)�	� r��chs r�39isStrSpacerZ�s
��
���r>�0rQr'r��
rR�/ �_ ��c�.�US:�aUS::agU[;$)z"Zs (unicode class) || [\t\f\v\r\n]i i40 T)�
MD_WHITESPACErSs r�isWhiteSpacerd�s���v�~�$�&�.���=� � rc�L�[R"U5RS5$)z.Check if character is a punctuation character.)�P�S)�unicodedata�category�41startswithrXs r�isPunctCharrk�s������#�.�.�z�:�:r> �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�:�;�<�=�>�?�@�[�\�]�^�_�`�{�|�}�~c��U[;$)a%Markdown ASCII punctuation characters.42 43::44 45    !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~46 47See http://spec.commonmark.org/0.15/#ascii-punctuation-character48 49Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.50 51)�MD_ASCII_PUNCTrXs r�isMdAsciiPunctr��s�����rc��[R"SSUR55nUR5R	5$)z#Helper to unify [reference labels].z\s+rW)�rer?�strip�lower�upperrDs r�normalizeReferencer��s4���V�V�F�C�����
0�F�X�<�<�>���!�!rz^<a[>\s])�flagsz^</a\s*>c�>�[[RU55$�N)�bool�LINK_OPEN_RE�searchrDs r�52isLinkOpenr�4s����#�#�F�+�,�,rc�>�[[RU55$r�)r��
LINK_CLOSE_REr�rDs r�isLinkCloser�8s���
�$�$�V�,�-�-r)r
r=rr+r<�53int | None)r
r=rr+r<�54str | None)r
�
list[_ItemTV]rr+rr�r<r�)r!r+r<r�)r!r+r<r=)r.r=r/r=r<r=)r@r=r<r=)rKr=r<r=)r0r�r<r�)rYr�r<r�)r0r+r<r�)rYr=r<r�)rYr+r<r�)r@r=r<r�)(�__doc__�55__future__rr�r�typingrrhrrrrrr"r%�compile�56IGNORECASEr>r)r-r2rA�	ESCAPABLErCrErLrNrOrTrZrcrdrkr�r�r�r�r�r�r�rrr�<module>r�sM��'�"�	��������)�57��4�	�4� �4�/<�4��4��,��*�*�V��M�M����:�:�&6�7���:�:�&:�B�M�M�J���&586�
7�	��j�j��9�,�u�4�5��*�59��:�:�4�5��� �60�61�
�!�;�62!��H �0"�f�z�z�+�R�]�]�;���63�64�;�b�m�m�<�
�-�.r
codekingpro/portable-devtools · Team Ai