a
XC?h�/ � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z dd� Z
i fdd �Zi fd
d�Zi fdd
�Z
dd� ZG dd� dej�ZG dd� de j�Zddd�ZdS )znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
� N� )�handler)� xmlreaderc C s" |� � D ]\}}| �||�} q| S )z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�value� r �5/opt/alt/python39/lib64/python3.9/xml/sax/saxutils.py�__dict_replace s r
c C s6 | � dd�} | � dd�} | � dd�} |r2t| |�} | S )z�Escape &, <, 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
��dataZentitiesr r r �escape s
r c C s2 | � dd�} | � dd�} |r&t| |�} | � 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 r r r �unescape" s
r c C sV i |�dddd��}t | |�} d| v rJd| v r@d| �dd� } qRd | } nd| } | 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 r r r � quoteattr0 s
r c s� � d u rdd l }|jS t� tj�r&� S t� tjtjf�r<� S t� tj�rlG � fdd�d�}|� }dd� |_ nBt�
� }dd� |_� j|_z� j
|_
� j|_W n ty� Y n0 tj||ddd d
�S )Nr c s e Zd Z� jZ� fdd�ZdS )z _gettextwriter.