ó
    Eñi>'  ã                   ó(  • S r SSKrSSKJr  \R                  " S5      r\R                  " S\R                  \R                  -  \R                  -  5      r	\R                  " S\R                  \R                  -  \R                  -  5      r\R                  " S\R                  5      r " S S	\5      r " S
 S\5      rS S jrS!S jrS!S jrS!S jrS rS rS rS rS r0 rS rS rS"S jrS#S jr " S S5      r S r!S r"S r# " S S\5      r$g)$z 
pygments.util
~~~~~~~~~~~~~

Utility functions.

:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
é    N)ÚTextIOWrapperz[/\\ ]z”
    <!DOCTYPE\s+(
     [a-zA-Z_][a-zA-Z0-9]*
     (?: \s+      # optional in HTML5
     [a-zA-Z_][a-zA-Z0-9]*\s+
     "[^"]*")?
     )
     [^>]*>
z<(.+?)(\s.*?)?>.*?</.+?>z\s*<\?xml[^>]*\?>c                   ó   • \ rS rSrSrSrg)ÚClassNotFoundé   zCRaised if one of the lookup functions didn't find a matching class.© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pygments/util.pyr   r      s   † ÜMr   r   c                   ó   • \ rS rSrSrSrg)ÚOptionErroré"   zw
This exception will be raised by all option processing functions if
the type or value of the argument is not correct.
r   Nr   r   r   r   r   r   "   s   † ôr   r   c                 óÐ   • U R                  X5      nU(       a  UR                  5       nXR;  a8  [        SR                  USR	                  [        [        U5      5      5      5      eU$ )zq
If the key `optname` from the dictionary is not in the sequence
`allowed`, raise an error, otherwise return it.
z%Value for option {} must be one of {}z, )ÚgetÚlowerr   ÚformatÚjoinÚmapÚstr)ÚoptionsÚoptnameÚallowedÚdefaultÚnormcaseÚstrings         r   Úget_choice_optr!   (   sZ   € ð
 �[‰[˜Ó*€FÞØ—‘“ˆØÓÜÐA×HÑHÈÐRV×R[ÑR[Ô\_Ô`cÐelÓ\mÓRnÓoÓpÐpØ€Mr   c                 ó\  • U R                  X5      n[        U[        5      (       a  U$ [        U[        5      (       a  [        U5      $ [        U[        5      (       d  [        SU< SU S35      eUR                  5       S;   a  gUR                  5       S;   a  g[        SU< SU S35      e)	a  
Intuitively, this is `options.get(optname, default)`, but restricted to
Boolean value. The Booleans can be represented as string, in order to accept
Boolean value from the command line arguments. If the key `optname` is
present in the dictionary `options` and is not associated with a Boolean,
raise an `OptionError`. If it is absent, `default` is returned instead.

The valid string values for ``True`` are ``1``, ``yes``, ``true`` and
``on``, the ones for ``False`` are ``0``, ``no``, ``false`` and ``off``
(matched case-insensitively).
úInvalid type ú for option z%; use 1/0, yes/no, true/false, on/off)Ú1ÚyesÚtrueÚonT)Ú0ÚnoÚfalseÚoffFúInvalid value )r   Ú
isinstanceÚboolÚintr   r   r   ©r   r   r   r    s       r   Úget_bool_optr2   5   s´   € ð �[‰[˜Ó*€FÜ�&œ$×ÑØˆÜ	�FœC×	 Ñ	 Ü�F‹|ÐÜ˜¤×$Ñ$Ü˜M¨&©°<À¸yð I<ð <ó =ð 	=à	�‰‹Ð5Ó	5ØØ	�‰‹Ð6Ó	6Øä˜N¨6©*°LÀÀ	ð J<ð <ó =ð 	=r   c                 ó¶   • U R                  X5      n [        U5      $ ! [         a    [        SU< SU S35      e[         a    [        SU< SU S35      ef = f)z?As :func:`get_bool_opt`, but interpret the value as an integer.r#   r$   z ; you must give an integer valuer-   )r   r0   Ú	TypeErrorr   Ú
ValueErrorr1   s       r   Úget_int_optr6   R   s~   € à�[‰[˜Ó*€Fð8Ü�6‹{ÐøÜó 8Ü˜M¨&©°<À¸yð I7ð 7ó 8ð 	8äó 8Ü˜N¨6©*°LÀÀ	ð J7ð 7ó 8ð 	8ð8ús	   “
 ž:Ac                 óà   • U R                  X5      n[        U[        5      (       a  UR                  5       $ [        U[        [
        45      (       a  [	        U5      $ [        SU< SU S35      e)z¥
If the key `optname` from the dictionary `options` is a string,
split it at whitespace and return it. If it is already a list
or a tuple, it is returned as a list.
r#   r$   z; you must give a list value)r   r.   r   ÚsplitÚlistÚtupler   )r   r   r   Úvals       r   Úget_list_optr<   ^   sj   € ð �+‰+�gÓ
'€CÜ�#”s×ÑØ�y‰y‹{ÐÜ	�Cœ$¤˜×	'Ñ	'Ü�C‹yÐä˜M¨#©°¸W¸Ið F3ð 3ó 4ð 	4r   c                 ó8  • U R                   (       d  g/ nU R                   R                  5       R                  5        H<  nUR                  5       (       a$  UR                  SUR                  5       -   5        M<    O   SR	                  U5      R                  5       $ )NÚ Ú )r   ÚstripÚ
splitlinesÚappendr   Úlstrip)ÚobjÚresÚlines      r   Údocstring_headlinerG   n   so   € Ø�;�;ØØ
€CØ—‘×!Ñ!Ó#×.Ñ.Ö0ˆØ�:‰:�<‰<Ø�J‰J�s˜TŸZ™Z›\Ñ)Ö*áñ	 1ð
 �7‰7�3‹<×ÑÓ Ð r   c                 óH   ^ • U 4S jnT R                   Ul         [        U5      $ )zAReturn a static text analyser function that returns float values.c           	      ó²   >•  T" U 5      nU(       d  g [        S[        S[        U5      5      5      $ ! [          a     gf = f! [        [
        4 a     gf = f)Ng        g      ð?)Ú	ExceptionÚminÚmaxÚfloatr5   r4   )ÚtextÚrvÚfs     €r   Útext_analyseÚ%make_analysator.<locals>.text_analyse|   sb   ø€ ð	Ù�4“ˆBö Øð	Ü�sœC ¤U¨2£YÓ/Ó0Ð0øô ó 	Ùð	ûô œIÐ&ó 	Ùð	ús   ƒ3 ”A ³
A ¿A ÁAÁA)r   Ústaticmethod)rP   rQ   s   ` r   Úmake_analysatorrT   z   s!   ø€ õ
ð Ÿ9™9€LÔÜ˜Ó%Ð%r   c                 ó   • U R                  S5      nUS:¼  a  U SU R                  5       nOU R                  5       nUR                  S5      (       a˜   [        R	                  USS R                  5       5       Vs/ s H&  nU(       d  M  UR                  S5      (       a  M$  UPM(     snS   n[        R                  " S	U S
3[        R                  5      nUR                  U5      b  ggs  snf ! [         a     gf = f)až  Check if the given regular expression matches the last part of the
shebang if one exists.

    >>> from pygments.util import shebang_matches
    >>> shebang_matches('#!/usr/bin/env python', r'python(2\.\d)?')
    True
    >>> shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?')
    True
    >>> shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?')
    False
    >>> shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?')
    False
    >>> shebang_matches('#!/usr/bin/startsomethingwith python',
    ...                 r'python(2\.\d)?')
    True

It also checks for common windows executable file extensions::

    >>> shebang_matches('#!C:\\Python2.4\\Python.exe', r'python(2\.\d)?')
    True

Parameters (``'-f'`` or ``'--foo'`` are ignored so ``'perl'`` does
the same as ``'perl -e'``)

Note that this method automatically searches the whole string (eg:
the regular expression is wrapped in ``'^$'``)
Ú
r   Nz#!é   Ú-éÿÿÿÿFÚ^z(\.(exe|cmd|bat|bin))?$T)Úfindr   Ú
startswithÚsplit_path_rer8   r@   Ú
IndexErrorÚreÚcompileÚ
IGNORECASEÚsearch)rN   ÚregexÚindexÚ
first_lineÚxÚfounds         r   Úshebang_matchesrh   ‹   sì   € ð8 �I‰I�d‹O€EØ�ƒzØ˜&˜5�\×'Ñ'Ó)‰
à—Z‘Z“\ˆ
Ø×Ñ˜T×"Ñ"ð	Ü -× 3Ñ 3°J¸q¸r°N×4HÑ4HÓ4JÔ Kó 5Ò K˜1Üó Ø"#§,¡,¨s×"3÷ Ñ Kñ 5Ø57ñ9ˆEô —
’
˜a ˜wÐ&=Ð>ÄÇÁÓNˆØ�<‰<˜ÓÑ*ØØùò5øäó 	Ùð	ús0   Á(C0 Á;C+Â
C+Â"C+Â(C0 Ã+C0 Ã0
C=Ã<C=c                 óÞ   • [         R                  U 5      nUc  gUR                  S5      n[        R                  " U[        R
                  5      R                  UR                  5       5      SL$ )zµCheck if the doctype matches a regular expression (if present).

Note that this method only checks the first part of a DOCTYPE.
eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
NFé   )Údoctype_lookup_rerb   Úgroupr_   r`   ÚIÚmatchr@   )rN   rc   ÚmÚdoctypes       r   Údoctype_matchesrq   ¸   sT   € ô 	× Ñ  Ó&€AØ�yØØ�g‰g�a‹j€GÜ�:Š:�eœRŸT™TÓ"×(Ñ(¨¯©«Ó9ÀÐEÐEr   c                 ó   • [        U S5      $ )z3Check if the file looks like it has a html doctype.Úhtml)rq   )rN   s    r   Úhtml_doctype_matchesrt   Å   s   € ä˜4 Ó)Ð)r   c                 ó   • [         R                  U 5      (       a  g[        U 5      n [        U   $ ! [         aB    [
        R                  U 5      nUb   g[        R                  U SS 5      SLnU[        U'   Us $ f = f)z2Check if a doctype exists or if we have some tags.TNiè  )Úxml_decl_rern   ÚhashÚ_looks_like_xml_cacheÚKeyErrorrk   rb   Útag_re)rN   Úkeyro   rO   s       r   Úlooks_like_xmlr|   Í   s   € ä×Ñ˜×ÑØÜ
ˆt‹*€CðÜ$ SÑ)Ð)øÜó Ü×$Ñ$ TÓ*ˆØ‰=ÙÜ�]‰]˜4  ˜;Ó'¨tÐ3ˆØ%'Ô˜cÑ"ØŠ	ðús   ¨1 ±"A=Á%A=Á<A=c                 ó"   • SU S-	  -   SU S-  -   4$ )zgGiven a unicode character code with length greater than 16 bits,
return the two 16 bit surrogate pair.
iÀ×  é
   i Ü  iÿ  r   )Úcs    r   Úsurrogatepairr€   Ý   s!   € ð �a˜2‘gÑ ¨1¨u©9Ñ!5Ð7Ð7r   c                 ó\  • / nSU-  S-  nSUS-   -  S-  nUR                  XP-   S-   5        U(       a   U H  nUR                  Xg-   S-   5        M     O6U H0  n[        US-   5      nUR                  XhSS -   US	   -   S-   5        M2     UR                  US
-   5        SR                  U5      $ )z)Formats a sequence of strings for output.r?   é   rj   z = (Ú,Ú"NéþÿÿÿrY   Ú)rV   )rB   Úreprr   )	Úvar_nameÚseqÚrawÚindent_levelÚlinesÚbase_indentÚinner_indentÚiÚrs	            r   Úformat_linesr‘   æ   s½   € à€EØ˜Ñ$ qÑ(€KØ˜,¨Ñ*Ñ+¨aÑ/€LØ	‡L�L�Ñ'¨&Ñ0Ô1Þ
ãˆAØ�L‰L˜Ñ)¨CÑ/Ö0ò ó ˆAä�Q˜‘W“ˆAØ�L‰L˜¨#¨2¨Ñ.°°2±Ñ6¸Ñ<Ö=ñ ð 
‡L�L�˜sÑ"Ô#Ø�9‰9�UÓÐr   c                 óŒ   • / n[        5       nU  H1  nXC;   d  XA;   a  M  UR                  U5        UR                  U5        M3     U$ )zU
Returns a list with duplicates removed from the iterable `it`.

Order is preserved.
)ÚsetrB   Úadd)ÚitÚalready_seenÚlstÚseenr�   s        r   Úduplicates_removedr™   ù   sD   € ð €CÜ‹5€DÛˆØ‹9˜Ó)ÙØ�
‰
�1ŒØ�‰�Žñ	 ð
 €Jr   c                   ó   • \ rS rSrSrS rSrg)ÚFuturei	  z{Generic class to defer some work.

Handled specially in RegexLexerMeta, to support regex string construction at
first use.
c                 ó   • [         e©N)ÚNotImplementedError©Úselfs    r   r   Ú
Future.get  s   € Ü!Ð!r   r   N)r	   r
   r   r   r   r   r   r   r   r   r›   r›   	  s   † ñõ
"r   r›   c                 óú   •  U R                  S5      n U S4$ ! [         aY     SSKnUR                  5       nU R                  U5      n X4s $ ! [        [        4 a    U R                  S5      n U S4s s $ f = ff = f)z³Decode *text* with guessed encoding.

First try UTF-8; this should fail for non-UTF-8 encodings.
Then try the preferred locale encoding.
Fall back to latin-1, which always works.
zutf-8r   NÚlatin1)ÚdecodeÚUnicodeDecodeErrorÚlocaleÚgetpreferredencodingÚLookupError)rN   r¦   Úprefencodings      r   Úguess_decoderª     s‡   € ð"Ø�{‰{˜7Ó#ˆØ�Wˆ}ÐøÜó "ð	"ÛØ!×6Ñ6Ó8ˆLØ—;‘;˜|Ó,ˆDØÐ%Ò%øÜ"¤KÐ0ó 	"Ø—;‘;˜xÓ(ˆDØ˜�>Ô!ð	"úð"ús,   ‚ —
A:¢'AÁ	A:Á%A6Á1A:Á5A6Á6A:c                 ó®   • [        USS5      (       a)   U R                  UR                  5      n XR                  4$ [	        U 5      $ ! [         a     Nf = f)zºDecode *text* coming from terminal *term*.

First try the terminal encoding, if given.
Then try UTF-8.  Then try the preferred locale encoding.
Fall back to latin-1, which always works.
ÚencodingN)Úgetattrr¤   r¬   r¥   rª   )rN   Úterms     r   Úguess_decode_from_terminalr¯   (  sX   € ô ˆt�Z ×&Ñ&ð	'Ø—;‘;˜tŸ}™}Ó-ˆDð Ÿ™Ð&Ð&Ü˜ÓÐøô	 "ó 	Ùð	ús   ”A Á
AÁAc                 óf   • [        U SS5      (       a  U R                  $ SSKnUR                  5       $ )z7Return our best guess of encoding for the given *term*.r¬   Nr   )r­   r¬   r¦   r§   )r®   r¦   s     r   Úterminal_encodingr±   9  s-   € äˆt�Z ×&Ñ&Ø�}‰}ÐÛØ×&Ñ&Ó(Ð(r   c                   ó   • \ rS rSrS rSrg)ÚUnclosingTextIOWrapperiA  c                 ó$   • U R                  5         g r�   )ÚflushrŸ   s    r   ÚcloseÚUnclosingTextIOWrapper.closeC  s   € Ø�
‰
�r   r   N)r	   r
   r   r   r¶   r   r   r   r   r³   r³   A  s   † õr   r³   )NFr�   )Fr   )r   )%r   r_   Úior   r`   r]   ÚDOTALLÚ	MULTILINEÚVERBOSErk   ra   rz   rm   rv   r5   r   rJ   r   r!   r2   r6   r<   rG   rT   rh   rq   rt   rx   r|   r€   r‘   r™   r›   rª   r¯   r±   r³   r   r   r   Ú<module>r¼      s  ðñó 
Ý ð —
’
˜9Ó%€Ø—J’Jð  ð ‡Y�Y�—‘Ñ §
¡
Ñ*ó,Ð ð 
�ŠÐ/Ø—M‘M B§I¡IÑ-°·±Ñ<ó
>€à�jŠjÐ-¨r¯t©tÓ4€ôN�Jô Nô�)ô ô
ô=ô:
8ô4ò 	!ò&ò"*òZ
Fò*ð
 Ð òò 8ôô&÷ "ñ "ò"ò*ò")ô˜]õ r   