Ë
    äØjjö'  ã                   ó  — d Z ddlZddlmZ  ej                  d«      Z ej                  dej                  ej                  z  ej                  z  «      Z	 ej                  dej                  ej                  z  ej                  z  «      Z ej                  dej                  «      Z G d„ d	e«      Z G d
„ de«      Zd d„Zd!d„Zd!d„Zd!d„Zd„ Zd„ Zd„ Zd„ Zd„ Zi Zd„ Zd„ Zd"d„Zd#d„Z G d„ d«      Z d„ Z!d„ Z"d„ Z# G d„ de«      Z$y)$z±
    pygments.util
    ~~~~~~~~~~~~~

    Utility functions.

    :copyright: Copyright 2006-2023 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                   ó   — e Zd ZdZy)ÚClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú[/opt/eval-harness/bench_task/venv/lib/python3.12/site-packages/pip/_vendor/pygments/util.pyr   r      s   „ ÚMr   r   c                   ó   — e Zd ZdZy)ÚOptionErrorzƒ
    This exception will be raised by all option processing functions if
    the type or value of the argument is not correct.
    Nr   r   r   r   r   r   "   s   „ òr   r   c                 ó²   — | j                  ||«      }|r|j                  «       }||vr.t        d|›ddj                  t	        t
        |«      «      ›�«      ‚|S )z}
    If the key `optname` from the dictionary is not in the sequence
    `allowed`, raise an error, otherwise return it.
    zValue for option z must be one of z, )ÚgetÚlowerr   ÚjoinÚmapÚstr)ÚoptionsÚoptnameÚallowedÚdefaultÚnormcaseÚstrings         r   Úget_choice_optr   (   sY   € ð
 �[‰[˜ 'Ó*€FÙØ—‘“ˆØ�WÑÝÚ" D§I¡I¬c´#°wÓ.?Ô$@ðBó Cð 	Cà€Mr   c                 ó4  — | j                  ||«      }t        |t        «      r|S t        |t        «      rt        |«      S t        |t        «      st        d|›d|›d�«      ‚|j                  «       dv ry|j                  «       dv ryt        d|›d|›d�«      ‚)	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_optr-   6   s•   € ð �[‰[˜ 'Ó*€FÜ�&œ$ÔØˆÜ	�FœCÔ	 Ü�F‹|ÐÜ˜¤Ô$Ýâ$¢gð/ó 0ð 	0ð 
�‰‹Ð5Ñ	5ØØ	�‰‹Ð6Ñ	6Øåâ$¢gð/ó 0ð 	0r   c                 ó°   — | j                  ||«      }	 t        |«      S # t        $ r t        d|›d|›d�«      ‚t        $ r t        d|›d|›d�«      ‚w xY w)z?As :func:`get_bool_opt`, but interpret the value as an integer.r   r   z ; you must give an integer valuer(   )r   r+   Ú	TypeErrorr   Ú
ValueErrorr,   s       r   Úget_int_optr1   U   sh   € à�[‰[˜ 'Ó*€Fð	0Ü�6‹{ÐøÜò 0Ýâ$¢gð/ó 0ð 	0ô ò 0Ýâ$¢gð/ó 0ð 	0ð0ús	   ”
 Ÿ6Ac                 óÌ   — | j                  ||«      }t        |t        «      r|j                  «       S t        |t        t
        f«      rt	        |«      S t        d|›d|›d�«      ‚)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_optr7   c   sY   € ð �+‰+�g˜wÓ
'€CÜ�#”sÔØ�y‰y‹{ÐÜ	�Cœ$¤˜Ô	'Ü�C‹yÐåâ!¢7ð,ó -ð 	-r   c                 ó   — | j                   syg }| j                   j                  «       j                  «       D ]6  }|j                  «       r#|j                  d|j                  «       z   «       Œ6 n dj	                  |«      j                  «       S )NÚ ú )r
   ÚstripÚ
splitlinesÚappendr   Úlstrip)ÚobjÚresÚlines      r   Údocstring_headlinerB   t   sr   € Ø�;Š;ØØ
€CØ—‘×!Ñ!Ó#×.Ñ.Ó0ò ˆØ�:‰:Œ<Ø�J‰J�s˜TŸZ™Z›\Ñ)Õ*áð	ð
 �7‰7�3‹<×ÑÓ Ð r   c                 óF   ‡ — ˆ fd„}‰ j                   |_         t        |«      S )zAReturn a static text analyser function that returns float values.c           	      ó¤   •— 	  ‰| «      }|sy	 t        dt        dt        |«      «      «      S # t         $ r Y yw xY w# t        t
        f$ r Y yw xY w)Ng        g      ð?)Ú	ExceptionÚminÚmaxÚfloatr0   r/   )ÚtextÚrvÚfs     €r   Útext_analysez%make_analysator.<locals>.text_analyse‚   sb   ø€ ð	Ù�4“ˆBñ Øð	Ü�sœC ¤U¨2£YÓ/Ó0Ð0øô ò 	Ùð	ûô œIÐ&ò 	Ùð	ús   ƒ. �= ®	:¹:½AÁA)r
   Ústaticmethod)rK   rL   s   ` r   Úmake_analysatorrN   €   s!   ø€ ô
ð Ÿ9™9€LÔÜ˜Ó%Ð%r   c                 óÊ  — | j                  d«      }|dk\  r| d| j                  «       }n| j                  «       }|j                  d«      r„	 t        j	                  |dd j                  «       «      D �cg c]  }|r|j                  d«      s|‘Œ c}d   }t        j                  d	|z  t        j                  «      }|j                  |«      �y
yc c}w # t        $ r Y yw xY w)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#!é   ú-éÿÿÿÿFz^%s(\.(exe|cmd|bat|bin))?$T)Úfindr   Ú
startswithÚsplit_path_rer3   r;   Ú
IndexErrorÚreÚcompileÚ
IGNORECASEÚsearch)rI   ÚregexÚindexÚ
first_lineÚxÚfounds         r   Úshebang_matchesra   ‘   sÙ   € ð8 �I‰I�d‹O€EØ�‚zØ˜&˜5�\×'Ñ'Ó)‰
à—Z‘Z“\ˆ
Ø×Ñ˜TÔ"ð	Ü -× 3Ñ 3°J¸q¸r°N×4HÑ4HÓ4JÓ Kö 5˜1Ù !§,¡,¨sÔ"3ò ò 5Ø57ñ9ˆEô —
‘
Ð8¸5Ñ@Ä"Ç-Á-ÓPˆØ�<‰<˜ÓÐ*ØØùò5øäò 	Ùð	ús$   Á(C Á5CÂC ÃC Ã	C"Ã!C"c                 óÚ   — t         j                  | «      }|€y|j                  d«      }t        j                  |t        j
                  «      j                  |j                  «       «      duS )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_rer[   ÚgrouprX   rY   ÚIÚmatchr;   )rI   r\   ÚmÚdoctypes       r   Údoctype_matchesrj   ¾   sT   € ô 	× Ñ  Ó&€AØ€yØØ�g‰g�a‹j€GÜ�:‰:�eœRŸT™TÓ"×(Ñ(¨¯©«Ó9ÀÐEÐEr   c                 ó   — t        | d«      S )z3Check if the file looks like it has a html doctype.Úhtml)rj   )rI   s    r   Úhtml_doctype_matchesrm   Ë   s   € ä˜4 Ó)Ð)r   c                 óò   — t         j                  | «      ryt        | «      }	 t        |   S # t        $ rA t
        j                  | «      }|�Y yt        j                  | dd «      du}|t        |<   |cY S w xY w)z2Check if a doctype exists or if we have some tags.TNiè  )Úxml_decl_rerg   ÚhashÚ_looks_like_xml_cacheÚKeyErrorrd   r[   Útag_re)rI   Úkeyrh   rJ   s       r   Úlooks_like_xmlru   Ó   s|   € ä×Ñ˜ÔØÜ
ˆt‹*€CðÜ$ SÑ)Ð)øÜò Ü×$Ñ$ TÓ*ˆØˆ=ÙÜ�]‰]˜4  ˜;Ó'¨tÐ3ˆØ%'Ô˜cÑ"ØŠ	ðús   £, ¬ A6Á%A6Á5A6c                 ó"   — d| dz	  z   d| dz  z   fS )zoGiven a unicode character code with length greater than 16 bits,
    return the two 16 bit surrogate pair.
    iÀ×  é
   i Ü  iÿ  r   )Úcs    r   Úsurrogatepairry   ã   s!   € ð �a˜2‘gÑ ¨1¨u©9Ñ!5Ð7Ð7r   c                 óP  — g }d|z  dz  }d|dz   z  dz  }|j                  || z   dz   «       |r|D ]  }|j                  ||z   dz   «       Œ n5|D ]0  }t        |dz   «      }|j                  ||dd z   |d	   z   dz   «       Œ2 |j                  |d
z   «       dj                  |«      S )z)Formats a sequence of strings for output.r:   é   rc   z = (ú,ú"NéþÿÿÿrS   ú)rP   )r=   Ú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�˜xÑ'¨&Ñ0Ô1Ù
àò 	1ˆAØ�L‰L˜¨Ñ)¨CÑ/Õ0ñ	1ð ò 	>ˆAä�Q˜‘W“ˆAØ�L‰L˜¨¨#¨2¨Ñ.°°2±Ñ6¸Ñ<Õ=ð	>ð 
‡L�L�˜sÑ"Ô#Ø�9‰9�UÓÐr   c                 ó‚   — g }t        «       }| D ]-  }||v s||v rŒ|j                  |«       |j                  |«       Œ/ |S )za
    Returns a list with duplicates removed from the iterable `it`.

    Order is preserved.
    )Úsetr=   Úadd)ÚitÚalready_seenÚlstÚseenrˆ   s        r   Úduplicates_removedr’   ÿ   sM   € ð €CÜ‹5€DØò ˆØ�‰9˜˜\Ñ)ØØ�
‰
�1ŒØ�‰��ð	ð
 €Jr   c                   ó   — e Zd ZdZd„ Zy)ÚFuturez‡Generic class to defer some work.

    Handled specially in RegexLexerMeta, to support regex string construction at
    first use.
    c                 ó   — t         ‚©N)ÚNotImplementedError©Úselfs    r   r   z
Future.get  s   € Ü!Ð!r   N)r   r   r	   r
   r   r   r   r   r”   r”     s   „ ñó
"r   r”   c                 óö   — 	 | j                  d«      } | dfS # t        $ rX 	 ddl}|j                  «       }| j                  «       } | |fcY S # t        t        f$ r | j                  d«      } | dfcY cY S w xY ww xY w)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)rI   rž   Úprefencodings      r   Úguess_decoder¢     s†   € ð"Ø�{‰{˜7Ó#ˆØ�Wˆ}ÐøÜò "ð	"ÛØ!×6Ñ6Ó8ˆLØ—;‘;“=ˆDØ˜Ð%Ò%øÜ"¤KÐ0ò 	"Ø—;‘;˜xÓ(ˆDØ˜�>Ô!ð	"úð"ús,   ‚ —	A8¡'AÁA8Á$A4Á/A8Á3A4Á4A8c                 ó¸   — t        |dd«      r*	 | j                  |j                  «      } | |j                  fS t	        | «      S # t        $ r Y t	        | «      S w xY w)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¢   )rI   Úterms     r   Úguess_decode_from_terminalr§   .  sd   € ô ˆt�Z Ô&ð	'Ø—;‘;˜tŸ}™}Ó-ˆDð ˜Ÿ™Ð&Ð&Ü˜ÓÐøô	 "ò 	Øô ˜ÓÐð		ús   �A Á	AÁAc                 ó\   — t        | dd«      r| j                  S ddl}|j                  «       S )z7Return our best guess of encoding for the given *term*.r¤   Nr   )r¥   r¤   rž   rŸ   )r¦   rž   s     r   Úterminal_encodingr©   ?  s*   € äˆt�Z Ô&Ø�}‰}ÐÛØ×&Ñ&Ó(Ð(r   c                   ó   — e Zd Zd„ Zy)ÚUnclosingTextIOWrapperc                 ó$   — | j                  «        y r–   )Úflushr˜   s    r   ÚclosezUnclosingTextIOWrapper.closeI  s   € Ø�
‰
�r   N)r   r   r	   r®   r   r   r   r«   r«   G  s   „ ór   r«   )NFr–   )Fr   )r   )%r
   rX   Úior   rY   rV   ÚDOTALLÚ	MULTILINEÚVERBOSErd   rZ   rs   rf   ro   r0   r   rE   r   r   r-   r1   r7   rB   rN   ra   rj   rm   rq   ru   ry   rŠ   r’   r”   r¢   r§   r©   r«   r   r   r   ú<module>r³      s$  ðñó 
Ý ð �—
‘
˜9Ó%€Ø�B—J‘Jð  ð ‡Y�Y�—‘Ñ §
¡
Ñ*ó,Ð ð 
ˆ�‰Ð/Ø—M‘M B§I¡IÑ-°·±Ñ<ó
>€àˆb�j‰jÐ-¨r¯t©tÓ4€ôN�Jô Nô�)ô óó0ó>0ó-ò"	!ò&ò"*òZ
Fò*ð
 Ð òò 8óó&÷ "ñ "ò"ò*ò")ô˜]õ r   