R`i' d Z ddlZddlmZ ej d Z ej dej ej z ej z Z ej dej ej z ej z Z ej dej Z
G d d e Z G d
de Zd dZd!d
Zd!dZd!dZd Zd Zd Zd Zd Zi Zd Zd Zd"dZd#dZ G d d Z d Z!d Z"d Z# G d de 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
]*>
z<(.+?)(\s.*?)?>.*?z\s*<\?xml[^>]*\?>c e Zd ZdZy)
ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N__name__
__module____qualname____doc__ /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_vendor/pygments/util.pyr r s Mr r c e Zd ZdZy)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 }||vr.t d|ddj t t
| |S )z}
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, )getlowerr joinmapstr)optionsoptnamealloweddefaultnormcasestrings r
get_choice_optr ( sY
[['
*F
W"DIIc#w.?$@B C CMr c 4 | j || }t |t r|S t |t rt | S t |t st d|d|d |j
dv ry|j
dv ryt 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)1yestrueonT)0nofalseoffFInvalid value )r
isinstanceboolintr r r r r r r s r
get_bool_optr- 6 s [['
*F&$
FC 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 xY 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 06{ 0$g/ 0 0 0$g/ 0 00s
6Ac | j || }t |t r|j S t |t t
f rt | 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 splitlisttupler )r r r vals r
get_list_optr7 c sY ++gw
'C#syy{ C$ 'Cy!7, - -r c | j syg }| j j j D ]6 }|j r#|j d|j z 6 n dj | j S )N )r
strip
splitlinesappendr lstrip)objreslines r
docstring_headlinerB t sm ;;
C!!#..0::<JJsTZZ\)* 1
773< r c F fd} j |_ t | S )zAReturn a static text analyser function that returns float values.c | }|sy t dt dt | S # t $ r Y yw xY w# t t
f$ r Y yw xY w)Ng g ?) Exceptionminmaxfloatr0 r/ )textrvfs r
text_analysez%make_analysator.