1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
Ë
ñúh/'ãó—dZddlZddlmZejd«Zejdej ejzejz«Z    ejdejej zejz«Z ejdej«Z Gd„d    e«ZGd
„d e«Zd d „Zd!d „Zd!d„Zd!d„Zd„Zd„Zd„Zd„Zd„ZiZd„Zd„Zd"d„Zd#d„ZGd„d«Z d„Z!d„Z"d„Z#Gd„de«Z$y)$z±
    pygments.util
    ~~~~~~~~~~~~~
 
    Utility functions.
 
    :copyright: Copyright 2006-2025 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ó—eZdZdZy)Ú ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N©Ú__name__Ú
__module__Ú __qualname__Ú__doc__©óúLH:\Change_password\venv_build\Lib\site-packages\pip/_vendor/pygments/util.pyrrs„ÚMr rcó—eZdZdZy)Ú OptionErrorzƒ
    This exception will be raised by all option processing functions if
    the type or value of the argument is not correct.
    Nrr r r rr"s„òr rc óƗ|j||«}|r|j«}||vr8tdj|dj    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 {} must be one of {}z, )ÚgetÚlowerrÚformatÚjoinÚmapÚstr)ÚoptionsÚoptnameÚallowedÚdefaultÚnormcaseÚstrings      r Úget_choice_optr(s^€ð
[‰[˜ 'Ó *€FÙØ—‘“ˆØ WÑÜÐA×HÑHÈÐRV×R[ÑR[Ô\_Ô`cÐelÓ\mÓRnÓoÓpÐpØ €Mr có4—|j||«}t|t«r|St|t«r t|«St|t«st d|›d|›d«‚|j «dvry|j «dvryt 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Úintrrr©rrrrs    r Ú get_bool_optr.5s­€ð[‰[˜ 'Ó *€Fܐ&œ$ÔØˆ Ü    FœCÔ     ÜF‹|ÐÜ ˜¤Ô $ܘM¨&¨°<À¸yðI<ð<ó=ð    =à    ‰‹Ð5Ñ    5ØØ    ‰‹Ð6Ñ    6Øä˜N¨6¨*°LÀÀ    ðJ<ð<ó=ð    =r có°—|j||«}    t|«S#t$rtd|›d|›d«‚t$rtd|›d|›d«‚wxYw)z?As :func:`get_bool_opt`, but interpret the value as an integer.rr z ; you must give an integer valuer))rr,Ú    TypeErrorrÚ
ValueErrorr-s    r Ú get_int_optr2Rs€€à [‰[˜ 'Ó *€Fð8ܐ6‹{ÐøÜ ò8ܘM¨&¨°<À¸yðI7ð7ó8ð    8ä ò8ܘN¨6¨*°LÀÀ    ðJ7ð7ó8ð    8ð8ús    ”
Ÿ6Acó̗|j||«}t|t«r|j«St|tt
f«r t    |«St 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.
    rr z; you must give a list value)rr*rÚsplitÚlistÚtupler)rrrÚvals    r Ú get_list_optr8^sf€ð +‰+g˜wÓ
'€Cܐ#”sÔØy‰y‹{ÐÜ    Cœ$¤˜Ô    'ܐC‹yÐä˜M¨#¨° ¸W¸IðF3ð3ó4ð    4r có —|jsyg}|jj«j«D]6}|j«r#|jd|j«z«Œ6ndj    |«j «S)NÚú )r
ÚstripÚ
splitlinesÚappendrÚlstrip)ÚobjÚresÚlines   r Údocstring_headlinerCnsr€Ø ;Š;ØØ
€CØ— ‘ ×!Ñ!Ó#×.Ñ.Ó0òˆØ :‰:Œ<Ø J‰Js˜TŸZ™Z›\Ñ)Õ *á ð    ð
7‰73‹<× Ñ Ó  Ð r cóF‡—ˆfd„}‰j|_t|«S)zAReturn a static text analyser function that returns float values.c    ó¤•—    ‰|«}|sy    tdtdt|«««S#t$rYywxYw#tt
f$rYywxYw)Nggð?)Ú    ExceptionÚminÚmaxÚfloatr1r0)Ú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)rLrMs` r Úmake_analysatorrOzs!ø€ô
ðŸ9™9€LÔÜ ˜ Ó %Ð%r cóÌ—|jd«}|dk\r|d|j«}n|j«}|jd«r…    tj    |ddj ««Dcgc]}|r|jd«s|‘Œc}d}tjd    |›d
tj«}|j|«y ycc}w#t $rYywxYw) 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 ``'^$'``)
    ú
rNz#!éú-éÿÿÿÿFú^z(\.(exe|cmd|bat|bin))?$T) ÚfindrÚ
startswithÚ split_path_rer4r<Ú
IndexErrorÚreÚcompileÚ
IGNORECASEÚsearch)rJÚregexÚindexÚ
first_lineÚxÚfounds      r Úshebang_matchesrc‹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ô—
‘
˜a ˜wÐ&=Ð>ÄÇ Á ÓNˆØ <‰<˜Ó Ð *ØØ ùò5øäò    Ùð    ús$Á (CÁ5CÂCÃCà   C#Ã"C#cóڗtj|«}|€y|jd«}tj|tj
«j |j««duS)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]ÚgrouprZr[ÚIÚmatchr<)rJr^ÚmÚdoctypes    r Údoctype_matchesrl¸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)rl)rJs r Úhtml_doctype_matchesroÅs€ä ˜4 Ó )Ð)r cóò—tj|«ryt|«}    t|S#t$rAt
j |«}|Yytj |dd«du}|t|<|cYSwxYw)z2Check if a doctype exists or if we have some tags.TNiè)Ú xml_decl_reriÚhashÚ_looks_like_xml_cacheÚKeyErrorrfr]Útag_re)rJÚkeyrjrKs    r Úlooks_like_xmlrwÍs|€ä×Ñ˜ÔØÜ
ˆt‹*€CðÜ$ SÑ)Ð)øÜ òÜ × $Ñ $ TÓ *ˆØ ˆ=ÙÜ ]‰]˜4  ˜;Ó '¨tÐ 3ˆØ%'Ô˜cÑ"ØŠ    ð ús£,¬ A6Á%A6Á5A6có"—d|dz    zd|dzzfS)zoGiven 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óP—g}d|zdz}d|dzzdz}|j||zdz«|r|D]}|j||zdz«Œn5|D]0}t|dz«}|j||ddz|d    zdz«Œ2|j|d
z«d j|«S) z)Formats a sequence of strings for output.r;érez = (ú,ú"NéþÿÿÿrTú)rQ)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]-}||vs||vrŒ |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ó—eZdZdZd„Zy)Ú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 rz
Future.gets€Ü!Ð!r N)rrr    r
rr r r r–r–    s „ñó
"r r–cóö—    |jd«}|dfS#t$rX    ddl}|j«}|j«}||fcYS#ttf$r|jd«}|dfcYcYSwxYwwxYw)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.
    zutf-8rNÚlatin1)ÚdecodeÚUnicodeDecodeErrorÚlocaleÚgetpreferredencodingÚ LookupError)rJr Ú prefencodings   r Ú guess_decoder¤s†€ð "؏{‰{˜7Ó#ˆØWˆ}ÐøÜ ò"ð    "Û Ø!×6Ñ6Ó8ˆLØ—;‘;“=ˆDؘÐ%Ò %øÜ"¤KÐ0ò    "Ø—;‘;˜xÓ(ˆDؘ>Ô !ð    "úð "ús,‚—    A8¡'A ÁA8Á $A4Á/A8Á3A4Á4A8có¸—t|dd«r*    |j|j«}||jfSt    |«S#t$r Yt    |«SwxYw)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¤)rJÚterms  r Úguess_decode_from_terminalr©(sd€ôˆtZ Ô&ð    'Ø—;‘;˜tŸ}™}Ó-ˆD𘟙Ð&Ð &Ü ˜Ó Ðøô    "ò    Ø ô ˜Ó Ðð        úsAÁ    AÁAcó\—t|dd«r |jSddl}|j«S)z7Return our best guess of encoding for the given *term*.r¦Nr)r§r¦r r¡)r¨r s  r Úterminal_encodingr«9s*€äˆtZ Ô&؏}‰}ÐÛØ × &Ñ &Ó (Ð(r có—eZdZd„Zy)ÚUnclosingTextIOWrappercó$—|j«yr˜)Úflushršs r ÚclosezUnclosingTextIOWrapper.closeCs €Ø 
‰
 r N)rrr    r°r r r r­r­As„ór r­)NFr˜)Fr)r )%r
rZÚiorr[rXÚDOTALLÚ    MULTILINEÚVERBOSErfr\rurhrqr1rrFrrr.r2r8rCrOrcrlrorsrwr{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ô)ôó
ó=ó:
8ó 4ò     !ò&ò"*òZ
Fò*ð
Ðò ò 8óó& ÷ "ñ"ò"ò*ò")ô˜]õr