2bi'(SrSSKrSSKJr \R"S5r\R"S\R \R-\R-5r \R"S\R\R -\R-5r \R"S\R5r "SS \5r"S S \5rS S jrS!S jrS!SjrS!SjrSrSrSrSrSr0rSrSrS"SjrS#Sjr"SS5r Sr!Sr"Sr#"SS\5r$g)$z pygments.util ~~~~~~~~~~~~~ Utility functions. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N) TextIOWrapperz[/\\ ]z ]*> z<(.+?)(\s.*?)?>.*?z\s*<\?xml[^>]*\?>c\rSrSrSrSrg) ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N__name__ __module__ __qualname____firstlineno____doc____static_attributes__rڋ/builddir/build/BUILDROOT/alt-python313-pip-23.3.1-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pip/_vendor/pygments/util.pyrrsMrrc\rSrSrSrSrg) OptionError"zw This exception will be raised by all option processing functions if the type or value of the argument is not correct. rNrrrrrr"srrc URX5nU(aUR5nXR;a0[SU<SSR[ [ U55<35eU$)zq If the key `optname` from the dictionary is not in the sequence `allowed`, raise an error, otherwise return it. zValue for option z must be one of z, )getlowerrjoinmapstr)optionsoptnamealloweddefaultnormcasestrings rget_choice_optr (sU [[ *F "DIIc#w.?$@BC C Mrc`URX5n[U[5(aU$[U[5(a [U5$[U[5(d[ SU<SU<S35eUR 5S;agUR 5S;ag[ SU<SU<S35e) 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)1yestrueonT)0nofalseoffFInvalid value )r isinstanceboolintrrrrrrrs r get_bool_optr16s[[ *F&$ FC F|  $ $$g/0 0 5 5 6 6$g/0 0rcURX5n[U5$![a [SU<SU<S35e[a [SU<SU<S35ef=f)z?As :func:`get_bool_opt`, but interpret the value as an integer.r"r#z ; you must give an integer valuer,)rr/ TypeErrorr ValueErrorr0s r get_int_optr5Usf [[ *F 06{ 0$g/0 0 0$g/0 00s T"U5nU(dg[S[S[U555$![a gf=f![[ 4a gf=f)Ngg?) Exceptionminmaxfloatr4r3)textrvfs r text_analyse%make_analysator..text_analysesb 4B sCU2Y/0 0    I&  s3A AAAA)r staticmethod)rOrPs` rmake_analysatorrSs! 99L  %%rcURS5nUS:aUSUR5nOUR5nURS5(a[R USSR 55Vs/sH&nU(dM URS5(aM$UPM( snSn[R"S U-[R5nURU5bg gs snf![ a gf=f) aCheck 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#!-Fz^%s(\.(exe|cmd|bat|bin))?$T) findr startswith split_path_rer7r? IndexErrorrecompile IGNORECASEsearch)rMregexindex first_linexfounds rshebang_matchesrfs8 IIdOE z&5\'') ZZ\ T""  - 3 3JqrN4H4H4J K5 K1"#,,s"3 K5579E 85@"--P <<  * 5  s0(C/; C* C*"C*(C/*C// C<;C<c[RU5nUcgURS5n[R"U[R 5R UR55SL$)zCheck 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`groupr]r^Imatchr?)rMramdoctypes rdoctype_matchesrosT   &AyggajG ::eRTT " ( ( 9 EErc[US5$)z3Check if the file looks like it has a html doctype.html)ro)rMs rhtml_doctype_matchesrrs 4 ))rc[RU5(ag[U5n[U$![aB [ R U5nUbg[R USS5SLnU[U'Us$f=f)z2Check if a doctype exists or if we have some tags.TNi) xml_decl_rerlhash_looks_like_xml_cacheKeyErrorrir`tag_re)rMkeyrmrNs rlooks_like_xmlrzs t*C$S))   $ $T * = ]]4; 't 3%'c" s1"A=%A=<A=c"SUS- -SUS--4$)zgGiven a unicode character code with length greater than 16 bits, return the two 16 bit surrogate pair. i iir)cs r surrogatepairr~s! a2g 1u9!5 77rc\/nSU-S-nSUS--S-nURXP-S-5 U(a UHnURXg-S-5 M O6UH0n[US-5nURXhSS-US -S-5 M2 URUS -5 S RU5$) z)Formats a sequence of strings for output.r>rhz = (,"NrX)rU)rAreprr) var_nameseqraw indent_levellines base_indent inner_indentirs r format_linesrs E $q(K,*+a/L LL'&01 A LL)C/ 0AQW A LL#2.26< = LLs"# 99U rc/n[5nUH1nXC;dXA;aMURU5 URU5 M3 U$)zU Returns a list with duplicates removed from the iterable `it`. Order is preserved. )setrAadd)it already_seenlstseenrs rduplicates_removedrsD C 5D  9)  1    Jrc\rSrSrSrSrSrg)Futureiz{Generic class to defer some work. Handled specially in RegexLexerMeta, to support regex string construction at first use. c[eN)NotImplementedErrorselfs rr Future.gets!!rrN)r r r r r rrrrrrrs  "rrcURS5nUS4$![aX SSKnUR5nUR5nX4s$![[4a URS5nUS4ss$f=ff=f)zDecode *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-8rNlatin1)decodeUnicodeDecodeErrorlocalegetpreferredencoding LookupError)rMr prefencodings r guess_decoders "{{7#W} " " !668L;;=D% %"K0 ";;x(D> ! " "s, A9&A A9 %A50A94A55A9c[USS5(a)URUR5nXR4$[ U5$![a Nf=f)zDecode *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)getattrrrrr)rMterms rguess_decode_from_terminalr.sXtZ&& ';;t}}-D& &   "   sA AAcf[USS5(a UR$SSKnUR5$)z7Return our best guess of encoding for the given *term*.rNr)rrrr)rrs rterminal_encodingr?s-tZ&&}}  & & ((rc\rSrSrSrSrg)UnclosingTextIOWrapperiGc$UR5 gr)flushrs rcloseUnclosingTextIOWrapper.closeIs  rrN)r r r r rrrrrrrGsrr)NFr)Fr)r)%r r]iorr^r[DOTALL MULTILINEVERBOSErir_rxrkrtr4rrIrr r1r5r;rFrSrfrorrrvrzr~rrrrrrrrrrrs  9% JJ YY *, /MMBII- < >jj-rtt4 NJN) 0> 0-" !&"*Z F*   8&  """*")]r