Files
ServerSync/lib/pygments/__pycache__/util.cpython-314.pyc

143 lines
14 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
<00> <0C>i/'<00><00>J<00>Rt^RIt^RIHt]P!R4t]P!R]P ]P,]P,4t ]P!R]P]P ,]P,4t ]P!R]P4t !RR]4t!R R
]4tRR ltR R ltR R ltR RltRtRtRtRtRt/tRtRtR!RltR"Rlt!RR4t Rt!Rt"Rt#!RR]4t$R#)#z<>
pygments.util
~~~~~~~~~~~~~
Utility functions.
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
N)<01> 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<00><00>]tRt^tRtRtR#)<04> ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.<2E>N<><06>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__<5F>__doc__<5F>__static_attributes__r<00><00>4/tmp/pip-target-qd_sq_1j/lib/python/pygments/util.pyrrs<00><00>Mr rc<00><00>]tRt^"tRtRtR#)<04> OptionErrorzw
This exception will be raised by all option processing functions if
the type or value of the argument is not correct.
rNrrr rrr"s<00><00>r rc <04><><00>VPW4pV'dVP4pWR9d9\RPVRP \ \ V4444hV#)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, )<07>get<65>lowerr<00>format<61>join<69>map<61>str)<06>options<6E>optname<6D>allowed<65>default<6C>normcase<73>strings&&&&& r<00>get_choice_optr(sZ<00><00>
<15>[<5B>[<5B><17> *<2A>F<EFBFBD><0F><17><1C><1C><1E><06> <0A><1C><19>A<>H<>H<><17>RV<52>R[<5B>R[<5B>\_<>`c<>el<65>\m<>Rn<52>o<>p<>p<> <11>Mr c<04>j<00>VPW4p\V\4'dV#\V\4'd \V4#\V\4'g\ RV: RV R24hVP 4R9dR#VP 4R9dR#\ RV: RV R24h) 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).
<EFBFBD> Invalid type <20> for option z%; use 1/0, yes/no, true/false, on/offTF<54>Invalid value )<04>1<>yes<65>true<75>on)<04>0<>no<6E>false<73>off)r<00>
isinstance<EFBFBD>bool<6F>intrrr<00>rrrrs&&& r<00> get_bool_optr/5s<><00><00><15>[<5B>[<5B><17> *<2A>F<EFBFBD><11>&<26>$<24><1F><1F><15> <0A> <13>F<EFBFBD>C<EFBFBD> <20> <20><13>F<EFBFBD>|<7C><1B> <17><06><03> $<24> $<24><19>M<EFBFBD>&<26><1A><<3C><07>y<EFBFBD>I<<3C><<3C>=<3D> =<3D> <0F><1C><1C><1E>5<> 5<><13> <0F><1C><1C><1E>6<> 6<><14><19>N<EFBFBD>6<EFBFBD>*<2A>L<EFBFBD><17> <09>J<<3C><<3C>=<3D> =r c<04><><00>VPW4p\V4# \d\RT: RT R24h\d\RT: RT R24hi;i)z?As :func:`get_bool_opt`, but interpret the value as an integer.r r!z ; you must give an integer valuer")rr-<00> TypeErrorr<00>
ValueErrorr.s&&& r<00> get_int_optr3Rs~<00><00> <14>[<5B>[<5B><17> *<2A>F<EFBFBD>8<><12>6<EFBFBD>{<7B><1A><> <14>8<><19>M<EFBFBD>&<26><1A><<3C><07>y<EFBFBD>I7<>7<>8<> 8<> <15>8<><19>N<EFBFBD>6<EFBFBD>*<2A>L<EFBFBD><17> <09>J7<>7<>8<> 8<>8<>s<00>
<00>&A<03>Ac<04><><00>VPW4p\V\4'dVP4#\V\\
34'd \ V4#\ RV: RV R24h)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)rr+r<00>split<69>list<73>tupler)rrr<00>vals&&& r<00> get_list_optr9^sj<00><00> <12>+<2B>+<2B>g<EFBFBD>
'<27>C<EFBFBD><11>#<23>s<EFBFBD><1B><1B><12>y<EFBFBD>y<EFBFBD>{<7B><1A> <13>C<EFBFBD>$<24><05><1D> '<27> '<27><13>C<EFBFBD>y<EFBFBD><18><19>M<EFBFBD>#<23><17> <0C>W<EFBFBD>I<EFBFBD>F3<>3<>4<> 4r c<00>F<00>VP'gR#.pVPP4P4FApVP4'd)VPRVP4,4KAM RP V4P 4#)<02><00> )r <00>strip<69>
splitlines<EFBFBD>appendr<00>lstrip)<03>obj<62>res<65>lines& r<00>docstring_headlinerDnsq<00><00> <0E>;<3B>;<3B>;<3B><11>
<0C>C<EFBFBD><13> <0B> <0B>!<21>!<21>#<23>.<2E>.<2E>0<><04> <0F>:<3A>:<3A><<3C><<3C> <0F>J<EFBFBD>J<EFBFBD>s<EFBFBD>T<EFBFBD>Z<EFBFBD>Z<EFBFBD>\<5C>)<29> *<2A> <11> 1<>
<0E>7<EFBFBD>7<EFBFBD>3<EFBFBD><<3C> <1E> <1E> <20> r c<04>Ha<00>V3RlpSPVn\V4#)zAReturn a static text analyser function that returns float values.c <00><><<01>S!V4pT'gR#\R\R\T444# \dR#i;i \\
3dR#i;i)gg<00>?)<06> Exception<6F>min<69>max<61>floatr2r1)<03>text<78>rv<72>fs& <20>r<00> text_analyse<73>%make_analysator.<locals>.text_analyse|sb<00><><00> <17><12>4<EFBFBD><17>B<EFBFBD><12><16> <17><16>s<EFBFBD>C<EFBFBD><03>U<EFBFBD>2<EFBFBD>Y<EFBFBD>/<2F>0<> 0<><30> <19> <17><16> <17><> <1B>I<EFBFBD>&<26> <17><16> <17>s <00>5<00>A<00> A<03>A<03>A<03>A)r <00> staticmethod)rMrNsf r<00>make_analysatorrQzs!<00><><00>
<17><1D>9<EFBFBD>9<EFBFBD>L<EFBFBD><18> <17> <0C> %<25>%r c<04> <00>VPR4pV^8<>dVRVP4pMVP4pVPR4'd<>\P VR,P 44Uu.uF(pV'gK VPR4'dK&VNK* upR
,p\P!RT R2\P4pTPT4eR #R#uupi \ dR#i;i) 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 ``'^$'``)
<EFBFBD>
Nz#!:<3A>NN<4E>-F<>^z(\.(exe|cmd|bat|bin))?$T<><54><EFBFBD><EFBFBD><EFBFBD>) <0B>findr<00>
startswith<EFBFBD> split_path_rer5r=<00>
IndexError<EFBFBD>re<72>compile<6C>
IGNORECASE<EFBFBD>search)rK<00>regex<65>index<65>
first_line<EFBFBD>x<>founds&& r<00>shebang_matchesre<00>s<><00><00>8 <11>I<EFBFBD>I<EFBFBD>d<EFBFBD>O<EFBFBD>E<EFBFBD> <0C><01>z<EFBFBD><19>&<26>5<EFBFBD>\<5C>'<27>'<27>)<29>
<EFBFBD><19>Z<EFBFBD>Z<EFBFBD>\<5C>
<EFBFBD><11><1C><1C>T<EFBFBD>"<22>"<22> <19> -<2D> 3<> 3<>J<EFBFBD>r<EFBFBD>N<EFBFBD>4H<34>4H<34>4J<34> K<>5<> K<>1<EFBFBD><19><17>"#<23>,<2C>,<2C>s<EFBFBD>"3<><17>Q<EFBFBD> K<>5<>57<35>9<>E<EFBFBD><13>
<EFBFBD>
<EFBFBD>a<EFBFBD><05>w<EFBFBD>&=<3D>><3E><02> <0A> <0A>N<><05> <10><<3C><<3C><05> <1E> *<2A><17> <10><>5<><35><19> <19><18> <19>s0<00>,C><00>
C9<04>C9<04>)C9<04>/
C><00>9C><00>> D <03> D c<04><><00>\PV4pVfR#VP^4p\P!V\P
4P VP44RJ#)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)<08>doctype_lookup_rer_<00>groupr\r]<00>I<>matchr=)rKr`<00>m<>doctypes&& r<00>doctype_matchesrm<00>sT<00><00> <1A> <20> <20><14>&<26>A<EFBFBD><08>y<EFBFBD><14><0F>g<EFBFBD>g<EFBFBD>a<EFBFBD>j<EFBFBD>G<EFBFBD> <0A>:<3A>:<3A>e<EFBFBD>R<EFBFBD>T<EFBFBD>T<EFBFBD> "<22> (<28> (<28><17><1D><1D><1F> 9<><14> E<>Er c<04><00>\VR4#)z3Check if the file looks like it has a html doctype.<2E>html)rm)rKs&r<00>html_doctype_matchesrp<00>s<00><00> <1A>4<EFBFBD><17> )<29>)r c<04><00>\PV4'dR#\V4p\V,# \dI\
P T4pTeR#\P TR,4RJpT\T&Tu#i;i)z2Check if a doctype exists or if we have some tags.TN:Ni<4E>N)<08> xml_decl_rerj<00>hash<73>_looks_like_xml_cache<68>KeyErrorrgr_<00>tag_re)rK<00>keyrkrLs& r<00>looks_like_xmlrx<00>s}<00><00><12><18><18><14><1E><1E><13>
<0E>t<EFBFBD>*<2A>C<EFBFBD><12>$<24>S<EFBFBD>)<29>)<29><> <13><12> <1D> $<24> $<24>T<EFBFBD> *<2A><01> <0C>=<3D><17> <13>]<5D>]<5D>4<EFBFBD><05>;<3B> '<27>t<EFBFBD> 3<><02>%'<27><1D>c<EFBFBD>"<22><11> <09> <12>s<00> 7<00>$B
<03>)B
<03> B
c<04>B<00>RV^
, ,RVR,,3#)zgGiven a unicode character code with length greater than 16 bits,
return the two 16 bit surrogate pair.
i<EFBFBD><EFBFBD>i<00>i<>r)<01>cs&r<00> surrogatepairr{<00>s!<00><00> <13>a<EFBFBD>2<EFBFBD>g<EFBFBD> <1E><16>1<EFBFBD>u<EFBFBD>9<EFBFBD>!5<> 7<>7r c<04><><00>.pRV,^,pRV^,,^,pVPWP,R,4V'd)VF!pVPWg,R,4K# MJVFDp\VR,4pVPWhRR,VR ,,R,4KF VPVR,4RPV4#)
z)Formats a sequence of strings for output.r<z = (<28>,<2C>"N<>)rS<00><><EFBFBD><EFBFBD><EFBFBD>rW)r?<00>reprr) <09>var_name<6D>seq<65>raw<61> indent_level<65>lines<65> base_indent<6E> inner_indent<6E>i<>rs &&&& r<00> format_linesr<73><00>s<><00><00> <0E>E<EFBFBD><15> <0C>$<24>q<EFBFBD>(<28>K<EFBFBD><16>,<2C><11>*<2A>+<2B>a<EFBFBD>/<2F>L<EFBFBD> <09>L<EFBFBD>L<EFBFBD><1B>'<27>&<26>0<>1<>
<EFBFBD><14>A<EFBFBD> <11>L<EFBFBD>L<EFBFBD><1C>)<29>C<EFBFBD>/<2F> 0<><15><15>A<EFBFBD><14>Q<EFBFBD><13>W<EFBFBD> <0A>A<EFBFBD> <11>L<EFBFBD>L<EFBFBD><1C>#<23>2<EFBFBD><06>.<2E><11>2<EFBFBD><15>6<><13><<3C> =<3D><15>
<EFBFBD>L<EFBFBD>L<EFBFBD><1B>s<EFBFBD>"<22>#<23> <0F>9<EFBFBD>9<EFBFBD>U<EFBFBD> <1B>r c<04><><00>.p\4pVF3pWC9gWA9dKVPV4VPV4K5 V#)zU
Returns a list with duplicates removed from the iterable `it`.
Order is preserved.
)<03>setr?<00>add)<05>it<69> already_seen<65>lst<73>seenr<6E>s&& r<00>duplicates_removedr<64><00>sD<00><00> <0A>C<EFBFBD> <0E>5<EFBFBD>D<EFBFBD> <0F><01> <0C>9<EFBFBD><01>)<29> <14> <0B>
<EFBFBD>
<EFBFBD>1<EFBFBD> <0A> <0C><08><08><11> <0B> <10>
<0F>Jr c<00>*a<00>]tRtRtoRtRtRtVtR#)<06>Futurei z{Generic class to defer some work.
Handled specially in RegexLexerMeta, to support regex string construction at
first use.
c<08><00>\h<01>N)<01>NotImplementedError<6F><01>selfs&rr<00>
Future.gets<00><00>!<21>!r rN)rrr r
r rr <00>__classdictcell__<5F><01> __classdict__s@rr<>r<> s<00><><00><00><08>
"<22>"r r<>c<04><><00>VPR4pVR3# \dZ^RIpTP4pTP4pY3u# \\3dTPR4pTR3uu#i;ii;i)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-8N<38>latin1)<05>decode<64>UnicodeDecodeError<6F>locale<6C>getpreferredencoding<6E> LookupError)rKr<><00> prefencodings& r<00> guess_decoder<65>s<><00><00> "<22><13>{<7B>{<7B>7<EFBFBD>#<23><04><13>W<EFBFBD>}<7D><1C><> <1D>"<22> "<22> <19>!<21>6<>6<>8<>L<EFBFBD><17>;<3B>;<3B>=<3D>D<EFBFBD><17>%<25> %<25><>"<22>K<EFBFBD>0<> "<22><17>;<3B>;<3B>x<EFBFBD>(<28>D<EFBFBD><17><18>><3E> !<21> "<22><> "<22>s,<00><00> A;<03>&A <02> A;<03> &A7<05>2A;<03>6A7<05>7A;c<04><><00>\VRR4'd*VPVP4pWP3#\ V4# \dLi;i)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.
<EFBFBD>encodingN)<05>getattrr<72>r<>r<>r<>)rK<00>terms&&r<00>guess_decode_from_terminalr<6C>(sX<00><00><0F>t<EFBFBD>Z<EFBFBD><14>&<26>&<26> '<27><17>;<3B>;<3B>t<EFBFBD>}<7D>}<7D>-<2D>D<EFBFBD><18><1D><1D>&<26> &<26> <17><04> <1D><1D><> "<22> <11> <10> <11>s<00>A<00> A<03>Ac<04>h<00>\VRR4'd VP#^RIpVP4#)z7Return our best guess of encoding for the given *term*.r<>N)r<>r<>r<>r<>)r<>r<>s& r<00>terminal_encodingr<67>9s-<00><00><0E>t<EFBFBD>Z<EFBFBD><14>&<26>&<26><13>}<7D>}<7D><1C><11> <11> &<26> &<26> (<28>(r c<00>&a<00>]tRtRtoRtRtVtR#)<05>UnclosingTextIOWrapperiAc<08>&<00>VP4R#r<>)<01>flushr<68>s&r<00>close<73>UnclosingTextIOWrapper.closeCs <00><00> <0C>
<EFBFBD>
<EFBFBD> r rN)rrr r
r<>r r<>r<>s@rr<>r<>As<00><><00><00><15>r r<>)NFr<46>)F<>)r)%r r\<00>iorr]rZ<00>DOTALL<4C> MULTILINE<4E>VERBOSErgr^rvrirrr2rrGrrr/r3r9rDrQrermrprtrxr{r<>r<>r<>r<>r<>r<>r<>rr r<00><module>r<>s<00><01><04>
<EFBFBD><1C><13>
<EFBFBD>
<EFBFBD>9<EFBFBD>%<25> <0A><16>J<EFBFBD>J<EFBFBD> <04><08>Y<EFBFBD>Y<EFBFBD><12><1C><1C><1D><02>
<EFBFBD>
<EFBFBD>*<2A>,<2C><11>
<0C><1A><1A>/<2F><16>M<EFBFBD>M<EFBFBD>B<EFBFBD>I<EFBFBD>I<EFBFBD>-<2D><02> <0C> <0C><<3C>
><3E><06><10>j<EFBFBD>j<EFBFBD>-<2D>r<EFBFBD>t<EFBFBD>t<EFBFBD>4<> <0B>N<01>J<EFBFBD>N<01><08>)<29><08>
<12>=<3D>:
8<> 4<> !<21>&<26>"*<11>Z
F<01>*<2A>
<1B><15> <12> 8<><1C>& <0F> "<22>"<22>"<22>*<1E>")<29><15>]<5D>r