a
    ӗa                  #   @   s   d Z ddlZddlmZ ddgZd0ddZdd	d
dddddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*"Zh d+Z	d,d- Z
ed.Zd/d ZdS )1z*
General functions for HTML manipulation.
    N)html5escapeunescapeTc                 C   sD   |  dd} |  dd} |  dd} |r@|  dd} |  d	d
} | S )z
    Replace special characters "&", "<" and ">" to HTML-safe sequences.
    If the optional flag quote is true (the default), the quotation mark
    characters, both double quote (") and single quote (') characters are also
    translated.
    &z&amp;<z&lt;>z&gt;"z&quot;'z&#x27;)replace)squote r   0/home/manager/Python-3.9.10/Lib/html/__init__.pyr      s       �u   €   u   ‚u   ƒu   „u   …u   †u   ‡u   ˆu   ‰u   Šu   ‹u   Œ   u   Ž      u   ‘u   ’u   “u   ”u   •u   –u   —u   ˜u   ™u   šu   ›u   œ   u   žu   Ÿ)"r                                                                                                      >~                                                                                     i i  i  i i	 i    r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   i i i i i i i i i i i i i i i i i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  i i  i  i  i  i  i  i  i  i  i i i i
 i i
 i	 i i i c                 C   s   |  d} | d dkr| d dv r<t| dd  dd}nt| dd  d}|tv rbt| S d|  krvd	ksn |d
krdS |tv rdS t|S | tv rt|  S tt| d ddD ]4}| d | tv rt| d |  | |d     S qd|  S d S )Nr7   r   #xXr8   ;rB   i   i  rR   r    r   )	groupintrstrip_invalid_charrefs_invalid_codepointschr_html5rangelen)r   numxr   r   r   _replace_charref[   s$    
"rd   z7&(#[0-9]+;?|#[xX][0-9a-fA-F]+;?|[^\t\n\f <&#;]{1,32};?)c                 C   s   d| vr| S t t| S )a^  
    Convert all named and numeric character references (e.g. &gt;, &#62;,
    &x3e;) in the string s to the corresponding unicode characters.
    This function uses the rules defined by the HTML 5 standard
    for both valid and invalid character references, and the list of
    HTML 5 named character references defined in html.entities.html5.
    r   )_charrefsubrd   )r   r   r   r   r   z   s    )T)__doc__re_reZhtml.entitiesr   r_   __all__r   r\   r]   rd   compilere   r   r   r   r   r   <module>   sV   
%
