Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
hyperlink.cpython-313.pyc86 linesDownload Raw Back to __pycache__
1�

2��j~����SrSSKJr SSKrSSKrSSKJr SSKJr \R"S5r3\R"S5r"S	S4\R5r
"SS\R5rg)
zC5OSC 8 hyperlink parsing and measurement.6 7.. versionadded:: 0.7.08�)�annotationsN�)�width)�_SEQUENCE_CLASSIFYz*\x1b]8;([^;]*);([^\x07\x1b]*)(\x07|\x1b\\)z\x1b]8;;(\x07|\x1b\\)c�h�\rSrSr%SrS\S'SrS\S'SrS\S'\SS	j5r	SS9jr10SSjrSrg
)�HyperlinkParams�z�11Parsed parameters from an OSC 8 hyperlink open sequence.12 13:param url: The hyperlink URL.14:param params: Colon-separated metadata string (often empty).15:param terminator: Sequence terminator (``\x07`` or ``\x1b\\``).16�str�url��params��17terminatorc��[RU5nUcgU"URS5URS5URS5S9$)z�18Parse an OSC 8 open sequence string.19 20Returns ``None`` if *seq* is not a valid OSC 8 open.21 22Example::23 24    >>> HyperlinkParams.parse('\x1b]8;;http://example.com\x07')25    HyperlinkParams(url='http://example.com', params='', terminator='\\x07')26N�r�)rr
r)�HYPERLINK_OPEN_RE�match�group)�cls�seq�ms   �WD:\code\apps\devtools\python\user_packages\Python313\site-packages\wcwidth/hyperlink.py�parse�HyperlinkParams.parse#sC��
�#�#�C�(���9���q�w�w�q�z�!�'�'�!�*������L�L�c�R�SURSURUR3$)z(Generate the OSC 8 open escape sequence.z]8;�;)r
rr��selfs r�	make_open�HyperlinkParams.make_open4s&������
�Q�t�x�x�j����0A�B�Brc� �SUR3$)z)Generate the OSC 8 close escape sequence.z]8;;)rrs r�27make_close�HyperlinkParams.make_close8s���$�/�/�*�+�+r�N)rr28�returnzHyperlinkParams | None�r'r29)
�__name__�30__module__�__qualname__�__firstlineno__�__doc__�__annotations__r
r�classmethodrr!r$�__static_attributes__r&rrrrsA���31
�H��F�C���J����M��M� C�,rrc��\rSrSr%SrS\S'S\S'\SSj5rSS	S32S.SSjjr\SSS
jj5r	SSjr33Srg)�	Hyperlink�=z�34A complete OSC 8 hyperlink with target and inner text.35 36:param params: Parsed open sequence parameters.37:param text: Inner text between the open and close sequences.38rr
r39�textc�t�[RX5nUcgUR5UR54$)a�40Find the matching OSC 8 close sequence.41 42Searches 'text' starting at 'open_end', the position just past the open43sequence.  Returns position of close sequence ``(close_start,44close_end)`` or ``(-1, -1)`` if not found.45 46Per the OSC 8 specification, terminal emulators treat hyperlinks as a47state attribute, not as nested HTML anchors.  A close sequence closes48the current hyperlink regardless of how many open sequences preceded it.49������r7)�HYPERLINK_CLOSE_RE�search�start�end)rr4�open_endrs    r�50find_close�Hyperlink.find_closeHs3��
�%�%�d�5���9�����	�1�5�5�7�#�#rr�r��
control_codes�tabsize�ambiguous_widthc�.�[URUUUS9$)z�51Measure the display width of the hyperlink's inner text.52 53Delegates to :func:`wcwidth.width` with the given parameters.54 55Example::56 57    >>> hl = Hyperlink.parse('\x1b]8;;http://example.com\x07Hello\x1b]8;;\x07', 0)58    >>> hl.display_width()59    560r@)�_widthr4)r rArBrCs    r�
display_width�Hyperlink.display_widthZs!��$��I�I�'��+�	61�	62rc��[R"X5nUcg[RUR	55nUcgURXR
55upVXV4S:XagU"XAUR
5US9$)a�63Parse a complete OSC 8 hyperlink unit from *text* at position *start*.64 65Locates the open sequence, finds the matching close, and returns a66``Hyperlink`` containing the parsed parameters and inner text.  Returns67``None`` if the text at *start* is not a complete OSC 8 hyperlink.68 69Example::70 71    >>> Hyperlink.parse('\x1b]8;;http://example.com\x07Hello\x1b]8;;\x07')72    Hyperlink(params=HyperlinkParams(url='http://example.com', ...), text='Hello')73Nr6)r
r4)rrrrrr=r;)rr4r:rr
�close_start�	close_ends       rr�Hyperlink.parsessw��
�$�$�T�1���9�� �&�&�q�w�w�y�1���>��!$����e�e�g�!>����#�x�/���&�A�E�E�G�K�'@�A�Arc��URR5UR-URR5-$)z5Rebuild the complete OSC 8 hyperlink escape sequence.)r
r!r4r$rs r�
make_sequence�Hyperlink.make_sequence�s0���{�{�$�$�&����2�T�[�[�5K�5K�5M�M�Mrr&N)r4r74r<�intr'ztuple[int, int])rAz+typing.Literal['parse', 'strict', 'ignore']rBrOrCrOr'rO)r)r4r75r:rOr'zHyperlink | Noner()r)r*r+r,r-r.r/r=rFrrMr0r&rrr2r2=s}���
��76
�I��$��$�(FM�� �77�C�78��	79�80�81�82
�
83�2�B��B�0Nrr2)r-�84__future__r�re�typingrEr�escape_sequencesr�compilerr8�85NamedTuplerr2r&rr�<module>rVsh���#�86�
�$�0��J�J�L�M���Z�Z� 8�9��$,�f�'�'�$,�NQN��!�!�QNr
codekingpro/portable-devtools · Team Ai