\% d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z d Z
i fdZi fdZi fd Z
d
Z G d dej Z G d
de j ZddZdS )znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
N )handler) xmlreaderc f | D ]\ }}| || } | S )z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvalues 7/opt/alt/python311/lib64/python3.11/xml/sax/saxutils.py__dict_replacer s7 ggii " "
U
IIc5!!H c | dd } | dd } | dd } |rt | | } | S )zEscape &, <, and > in a string of data.
You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
&&>><<r r dataentitiess r
escaper sY <<W%%D<<V$$D<<V$$D .dH--Kr c | dd } | dd } |rt | | } | dd S )a
Unescape &, <, and > in a string of data.
You can unescape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
r r r r r r r r s r
unescaper " sU <<$$D<<$$D .dH--<<%%%r c i |dddd}t | | } d| v r$d| v rd| dd z } nd | z } nd| z } | S )
a Escape and quote an attribute value.
Escape &, <, and > in a string of data, then quote it for use as
an attribute value. The " character will be escaped as well, if
necessary.
You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
z
z
z )
"'z"%s"z"z'%s')r r r s r
quoteattrr$ 0 sr G(F'vFFFH$!!D
d{{$;;DLLh777DDD=DD}Kr c dd l }|j S t t j r S t t
j t
j f r S t t j r" G fdd } | }d |_ nQt j
}d |_ j |_ j
|_
j |_ n# t $ r Y nw xY wt j ||ddd S )
Nr c ( e Zd Z j Z fdZdS ) _gettextwriter.